Hi
I dont know if this exists, at present there is a order by relevence and price, I would also like to order by A-Z, would this be posible.
Thanks
Brent
Hi David
Is it possible to extend the above code to sort by either A-Z OR Z-A
Tasha
Hi Tasha,
That's doable - here's a copy of the instructions above assuming no modifications made so far, which will add A-Z and Z-A to the sort options. You can of course change the text displayed for these in the code below where it says translate("A-Z") and translate("Z-A") - just replace with the require text.
$orderByDefault = array();
$orderByDefault["nameAZ"] = "name ASC";
$orderByDefault["nameZA"] = "name DESC";
After the following EXISTING code:
$orderByFullText = array();
$orderByFullText["nameAZ"] = "name ASC";
$orderByFullText["nameZA"] = "name DESC";
After the following EXISTING code:
$sortRelevance = ($sort=="relevance"?"<strong>".translate("Relevance")."</strong>":"<a href='".$sortHREF."relevance'>".translate("Relevance")."</a>");
$sortNameAZ = ", ".($sort=="nameAZ"?"<strong>".translate("A-Z")."</strong>":"<a href='".$sortHREF."nameAZ'>".translate("A-Z")."</a>");
$sortNameZA = ", ".($sort=="nameZA"?"<strong>".translate("Z-A")."</strong>":"<a href='".$sortHREF."nameZA'>".translate("Z-A")."</a>");
Modify the following code:
$banner["h3"] = translate("Order by").": ".$sortRelevance.$sortRating." | ".translate("Price").": ".$sortPriceAsc.", ".$sortPriceDesc;
$banner["h3"] = translate("Order by").": ".$sortRelevance.$sortNameAZ.$sortNameZA.$sortRating." | ".translate("Price").": ".$sortPriceAsc.", ".$sortPriceDesc;
Hope this helps,
Cheers,
David.
That was quick, many thanks shall give it ago this afternoon.
Been given the job while boss on hols he also mentioned sorting category page A-Z on seperate pages, looked on forum but cannot find info he said was there.
Tasha
Hi Tasha,
Might have been referring to this thread:
http://www.pricetapestry.com/node/266
Cheers,
David.
Hello Brent,
Yes - that can be easily added. In search.php, make the following changes:
After the following EXISTING code:
$orderByDefault = array();
$orderByDefault["name"] = "name";
After the following EXISTING code:
$orderByFullText = array();
$orderByFullText["name"] = "name";
After the following EXISTING code:
$sortRelevance = ($sort=="relevance"?"<strong>".translate("Relevance")."</strong>":"<a href='".$sortHREF."relevance'>".translate("Relevance")."</a>");
$sortName = ", ".($sort=="name"?"<strong>".translate("Name")."</strong>":"<a href='".$sortHREF."name'>".translate("Name")."</a>");
Modify the following code:
$banner["h3"] = translate("Order by").": ".$sortRelevance.$sortRating." | ".translate("Price").": ".$sortPriceAsc.", ".$sortPriceDesc;
$banner["h3"] = translate("Order by").": ".$sortRelevance.$sortName.$sortRating." | ".translate("Price").": ".$sortPriceAsc.", ".$sortPriceDesc;
This will add the "Name" sort option to the list of sort options, and you can of course change the legend to "A-Z" if you wish just by changing the text within the the calls to the translate() function. If you're unsure of where the changes need to go feel free to email me a copy of your existing search.php and i'll pop the changes in for you.
Cheers,
David.