You are here:  » Sort by Product Rating as default

Support Forum



Sort by Product Rating as default

Submitted by npaitken on Fri, 2010-01-29 13:41 in

Hi David,

Was wondering if it's possible to have 'category pages' and 'search queries' sorted by "product rating" as default, rather than "Relevance".

Thanks,
NEil

Submitted by support on Fri, 2010-01-29 13:50

Hi Neil,

Sure - at the top of search.php look for the following code:

  $sort = (isset($_GET["sort"])?$_GET["sort"]:"relevance");

...and REPLACE with:

  $parts = explode(":",$q);
  if (($parts[0]=="merchant") || ($parts[0]=="brand"))
  {
    $sortDefault = "relevance";
  }
  else
  {
    $sortDefault = "rating";
  }
  $sort = (isset($_GET["sort"])?$_GET["sort"]:$sortDefault);

Cheers,
David.

Submitted by npaitken on Fri, 2010-01-29 13:57

Yes, works perrfectly and looks great! Thanks again David.

Submitted by npaitken on Mon, 2010-02-01 13:54

Hi David,

Just noticed that when I'm using search external the results are still sorted by relevance. Is there any way to have this apply to search external results too.

ALso, with search external results, is there any way to control how much of the TITLE displays. For example, have a maximum of 30 characters of the TITLE displayed. I'd like to do this as some pages where I'm using search external look too busy when I have products with long titles.

Thanks,
Neil

Submitted by support on Mon, 2010-02-01 14:37

Hi Neil,

If you could email me your latest searchExternal.php and html/searchresults.php i'll make both changes for you. Regarding product names; if you like I'll code it so that it breaks on a space and not mid-word after x characters (e.g. 25)...

Cheers,
David.