You are here:  » Search on Category and Brand?

Support Forum



Search on Category and Brand?

Submitted by Paulzie on Sun, 2007-12-30 21:29 in

Is it possible to search on Category AND Brand at the same time?

I've seen this thread but it's refering to creating a seperate drop down on the category page.
http://www.pricetapestry.com/node/212

I'd like to create a link on the Product page so that users can see other products of similar type and brand.

Cheers

Paul

Submitted by support on Mon, 2007-12-31 12:10

Hi Paul,

If you make the first step of changes described in that thread (to add brandFilter support to search.php) you can then construct links that will search category and brand. To do this, you would need to build a search link such as:

search.php?q=category:widgets:&brandFilter=Foo

On the product page, you can access the category and brand of the product being displayed via the following variables:

$mainProduct["category"]
$mainProduct["brand"]

...so, to construct a link to similar products, you could add code similar to the following where required within html/product.php:

<?php
if ($mainProduct["category"] && $mainProduct["brand"])
{
  
$href $config_baseHREF."search.php?q=category:".urlencode($mainProduct["category"]).":&brandFilter=".urlencode($mainProduct["brand"]);
  print 
"<a href='".$href."'>Similar Products</a>";
}
?>

Hope this helps!
Cheers,
David.