You are here:  » Get an alphabetically ordered list of countries instead of brands


Get an alphabetically ordered list of countries instead of brands

Submitted by cerbero on Sat, 2012-06-09 17:53 in

Hello and congrats for this great script :)
I'm using the brand field to insert countries from a xml feed.

The problem is that countries format is the following:
US UK ES DE IT

How can I have these countries ordered alphabetically,
each one showing their products (like /brand/ page actually does)?

Thank you for your support.
Best regards,
Andrea

Submitted by support on Sun, 2012-06-10 09:43

Hi Andrea,

You can easily change /brand/ to /country/ via your .htaccess - simply replace the /brand/ rewrite rules (lines 19-21) with:

RewriteRule ^country/$ brands.php
RewriteRule ^country/(.*)/$ search.php?q=brand:$1:&rewrite=1&%{QUERY_STRING} [L]
RewriteRule ^country/(.*)/(.*).html$ search.php?q=brand:$1:&page=$2&rewrite=1&%{QUERY_STRING} [L]

...and then finally (if required and you don't already have links created by your theme) in incdex.php, look for where the link to /brand/ is generated by the following code at line 22:

print "<a href='".($config_useRewrite?"brand/":"brands.php")."'>".translate("brand")."</a>";

...and REPLACE with:

print "<a href='".($config_useRewrite?"country/":"brands.php")."'>".translate("country")."</a>";

Cheers,
David.
--
PriceTapestry.com