You are here:  » Search Results Banner


Search Results Banner

Submitted by marco@flapper on Wed, 2012-02-01 09:42 in

Hi,
After a search the search results are displayed and you can sort the results.

I use this HTML in the settings-banner but wanted to add the possibility to sort on Brand and sort on category. How can I do that?

<div class='pto_search_banner'>
Found: %RESULTS_FROM% tot %RESULTS_TO% van %RESULTS_TOTAL%
|
Sort on:
<a href='%RELEVANCE%'>Relevance</a>%IF_USEINTERACTION%,
<a href='%RATING%'>Review</a>%ENDIF_USEINTERACTION%
Prijs:
<a href='%PRICEASC%'>Low to High</a>,
<a href='%PRICEDESC%'>High to low</a>
</div>

Submitted by support on Wed, 2012-02-01 13:45

Hi Marco,

Category and brand sort can be added quite easily. Firstly, in pto_search.php look for the following code at line 95:

    $orderByFullText["priceDesc"] = "minPrice DESC";

...and REPLACE with:

    $orderByFullText["priceDesc"] = "minPrice DESC";
    $orderByFullText["category"] = "category";
    $orderByFullText["brand"] = "brand";
    $orderByDefault["category"] = "category";
    $orderByDefault["brand"] = "brand";

...and then look for the following code around line 417:

  $html = str_replace("%PRICEDESC%",$sortBaseHREF."priceDesc",$html);

...and REPLACE with:

  $html = str_replace("%PRICEDESC%",$sortBaseHREF."priceDesc",$html);
  $html = str_replace("%CATEGORY%",$sortBaseHREF."category",$html);
  $html = str_replace("%BRAND%",$sortBaseHREF."brand",$html);

You can then add the additional sort options to your banner template using %CATEGORY% and %BRAND% for example:

<div class='pto_search_banner'>
Found: %RESULTS_FROM% tot %RESULTS_TO% van %RESULTS_TOTAL%
|
Sort on:
<a href='%CATEGORY%'>Category</a>,
<a href='%BRAND%'>Brand</a>,
<a href='%RELEVANCE%'>Relevance</a>%IF_USEINTERACTION%,
<a href='%RATING%'>Review</a>%ENDIF_USEINTERACTION%
Prijs:
<a href='%PRICEASC%'>Low to High</a>,
<a href='%PRICEDESC%'>High to low</a>
</div>

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by marco@flapper on Thu, 2012-02-02 08:41

Hi,
Works. Thanks.