Hi,
I am trying to understand the mechanism behind search. After studying the code, I see that you differentiate between three categories product, category and brand (fine, but why do you delegate the search to brand if if the category is specified)?
Also, there is an option labelled bw. Dave, could you briefly explain why it is needed and when it is invoked?
Many Thanks,
Chris
Hi Chris,
The merchant: category: and brand: search cases are all handled by the same section of code. What it does is use the actual value of the first part of the query (e.g. "category") as the name of the field to compare against when constructing the SQL. It just happens to be that brand is the last entry in the switch statement, however they could be in any order.
The bw: modifier is a "Begins With" search, so for example a query of "bw:red" would return all products with red as the first word. The intention was that this could be used to provide an alphabetical product index (e.g. "bw:A") but this turned out to be impractical given the number of products most sites are using Vs. the recommended number of links per page.
Hope this helps,
Cheers,
David,