Hi,
The default presentation of search results is on relevence.
How can i change this to rating?
Thanks,
Marco.
It did the trick! Thanks for your quick response,
Marco.
Can i also set these search results to be in random order?
I would like random to be the first result and then user can sort by other fields.
Hi,
Yes - random sort can be easily added (and made to be the default). In search.php, make the following changes:
After the following EXISTING code:
$orderByDefault = array();
$orderByDefault["rand"] = "RAND()";
After the following EXISTING code:
$orderByFullText = array();
$orderByFullText["rand"] = "RAND()";
After the following EXISTING code:
$sortRelevance = ($sort=="relevance"?"<strong>".translate("Relevance")."</strong>":"<a href='".$sortHREF."relevance'>".translate("Relevance")."</a>");
$sortRand = ", ".($sort=="rand"?"<strong>".translate("Random")."</strong>":"<a href='".$sortHREF."rand'>".translate("Random")."</a>");
Modify the following code:
$banner["h3"] = translate("Order by").": ".$sortRelevance.$sortRating." | ".translate("Price").": ".$sortPriceAsc.", ".$sortPriceDesc;
$banner["h3"] = translate("Order by").": ".$sortRelevance.$sortRand.$sortRating." | ".translate("Price").": ".$sortPriceAsc.", ".$sortPriceDesc;
Finally, to make random the default sort, look for the following code at the top of search.php (line 8 in the distribution):
$sort = (isset($_GET["sort"])?$_GET["sort"]:"relevance");
...and change this to:
$sort = (isset($_GET["sort"])?$_GET["sort"]:"rand");
Cheers,
David.
Hi Marco,
In search.php you will find the following code on line 8:
$sort = (isset($_GET["sort"])?$_GET["sort"]:"relevance");
Change this to:
$sort = (isset($_GET["sort"])?$_GET["sort"]:"rating");
That should do the trick!
Cheers,
David.