You are here:  » how to include category and brand on search results

Support Forum



how to include category and brand on search results

Submitted by atman on Tue, 2006-10-03 20:30 in

hi,

how do i include the category and brand

similar to this page

http://lingerie.gynogapod.co.uk/category/Hosiery/

and invisible if category or brand does not exist.

addition:
if possible, a list of merchants carrying the specific product, a direct jump to the merchant site or a link to the /merchant/merchantname page.

thank you.

atman

Submitted by support on Wed, 2006-10-04 07:39

Hi atman,

The owner of that site posted the code for that mod in this thread (thanks, Simon!):

http://www.pricetapestry.com/node/53

The mod goes in html/searchresults.php, where you currently have (line 20):

<p><?php print substr($product["description"],0,250); ?></p>

Change that to:

<p>
<?php print substr($product["description"],0,250); ?>
<?php
if ($product["category"])
{
print "<p><small><b>Category: </b><a href='" .$config_baseHREF ."category/".tapestry_hyphenate($product["category"])."/'> ".substr($product["category"],0,30)."</a> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
} else {
print "<p><small>";
}
if ($product["brand"])
{
print "<b>Brand: </b><a href='" .$config_baseHREF ."brand/".tapestry_hyphenate($product["brand"])."/'>" .substr($product["brand"],0,30). "</a></small></p>";
} else {
print "</small></p>";
}
?>
</p>

I've made one minor change to Simon's original - that is to use tapestry_hyphenate() instead of urlencode() which will give the same link as used on the category and brand pages - but either method will work fine.

Regarding your second question, i'm afraid you cannot display a list of merchants on the seearch results page because they are not returned in the query. Only 1 merchant, and the minimum and maxium price are in the result set.

Cheers,
David.