intandem Posted April 2, 2013 Share Posted April 2, 2013 (edited) Is it possible to somehow sort the tags in the Tags Block module in alphabetical order? Edited May 1, 2013 by intandem (see edit history) Link to comment Share on other sites More sharing options...
PascalVG Posted April 2, 2013 Share Posted April 2, 2013 What PS version? Link to comment Share on other sites More sharing options...
PascalVG Posted April 2, 2013 Share Posted April 2, 2013 For 1.5.3.1 edit the file /classes/Tag.php find the function getMainTags : public static function getMainTags($id_lang, $nb = 10) { $groups = FrontController::getCurrentCustomerGroups(); $sql_groups = (count($groups) ? 'IN ('.implode(',', $groups).')' : '= 1'); return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(' SELECT t.name, COUNT(pt.id_tag) AS times FROM `'._DB_PREFIX_.'product_tag` pt LEFT JOIN `'._DB_PREFIX_.'tag` t ON (t.id_tag = pt.id_tag) LEFT JOIN `'._DB_PREFIX_.'product` p ON (p.id_product = pt.id_product) '.Shop::addSqlAssociation('product', 'p').' WHERE t.`id_lang` = '.(int)$id_lang.' AND product_shop.`active` = 1 AND product_shop.`id_product` IN ( SELECT cp.`id_product` FROM `'._DB_PREFIX_.'category_group` cg LEFT JOIN `'._DB_PREFIX_.'category_product` cp ON (cp.`id_category` = cg.`id_category`) WHERE cg.`id_group` '.$sql_groups.' ) GROUP BY t.id_tag ORDER BY t.name ASC LIMIT 0, '.(int)$nb); } Change red text. Save. Reload page (If it doesn't do anything, maybe you need to go to Advanced Parameters -> Perfornamce and in the smarty section change the folowing options: set to force compilation cache to off then reload page with tags block and see it it works. (N.B. Don't forget to change the smarty settings back after you're finished trying! Otherwise your site will slowdown...) Didn't try it, but I expect this to work. Give it a try and let us know. Hope this helps, Pascal Link to comment Share on other sites More sharing options...
intandem Posted May 1, 2013 Author Share Posted May 1, 2013 (edited) Hi! I'm on 1.5.4 but followed your instructions anyway and it worked like a treat! Thanks! Edited May 1, 2013 by intandem (see edit history) Link to comment Share on other sites More sharing options...
deli-cart Posted February 1, 2014 Share Posted February 1, 2014 Works perfectly on 1.5.2. Thanks! Link to comment Share on other sites More sharing options...
Tomasci Posted March 4, 2014 Share Posted March 4, 2014 Still works like a charm on 1.5.6.2 How do I sort Tags per tag ID? Is there a way to sort them in backoffice? If not I can just make new ones in prefered order.. Thanks! Link to comment Share on other sites More sharing options...
PascalVG Posted March 6, 2014 Share Posted March 6, 2014 Hi Tomzie, soory for delayed response. Extremely busy lately... I expect: ORDER BY t.id_tag ASC should do the ordering bu tag id. Where exactly do you need the tag-order in back office? pascal 1 Link to comment Share on other sites More sharing options...
Tomasci Posted March 6, 2014 Share Posted March 6, 2014 Hi Tomzie, soory for delayed response. Extremely busy lately... I expect: ORDER BY t.id_tag ASC should do the ordering bu tag id. Where exactly do you need the tag-order in back office? pascal If I could order them in back office: catalogue / tags (some like position ordering of products sorted by category in catalogue/products) But then I would have to 'order by position' in front office. That would be awesome! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now