eddieblunt Posted April 19, 2012 Share Posted April 19, 2012 Can anyone suggest a way of sorting an attributes drop-down menu in any other way but alphabetical? I've got size and colour menus for my products, i would like to choose my own order for the colours, for example; light blue and dark blue next to eachother in the list. The sizes: small, medium, large, xl , xxl in that order, not alphabetical. Hope someone can help?! Link to comment Share on other sites More sharing options...
Mike Kranzler Posted April 19, 2012 Share Posted April 19, 2012 Hi eddieblunt, This is a feature you will find in our upcoming release of version 1.5, but in the meantime I would recommend you either try the suggestion posted here or check out this module developed by one of the most active members of our community. I hope this helps. -Mike Link to comment Share on other sites More sharing options...
eddieblunt Posted April 19, 2012 Author Share Posted April 19, 2012 Thanks Mike, I've made the chanage as below: public function getAttributesGroups($id_lang) { $result = Db::getInstance()->ExecuteS(' SELECT ag.`id_attribute_group`, agl.`name` AS group_name, agl.`public_name` AS public_group_name, a.`id_attribute`, al.`name` AS attribute_name, a.`color` AS attribute_color, pa.`id_product_attribute`, pa.`quantity`, pa.`price`, pa.`ecotax`, pa.`weight`, pa.`default_on`, pa.`reference`, pa.`unit_price_impact`, pa.`minimal_quantity` FROM `'._DB_PREFIX_.'product_attribute` pa LEFT JOIN `'._DB_PREFIX_.'product_attribute_combination` pac ON pac.`id_product_attribute` = pa.`id_product_attribute` LEFT JOIN `'._DB_PREFIX_.'attribute` a ON a.`id_attribute` = pac.`id_attribute` LEFT JOIN `'._DB_PREFIX_.'attribute_group` ag ON ag.`id_attribute_group` = a.`id_attribute_group` LEFT JOIN `'._DB_PREFIX_.'attribute_lang` al ON a.`id_attribute` = al.`id_attribute` LEFT JOIN `'._DB_PREFIX_.'attribute_group_lang` agl ON ag.`id_attribute_group` = agl.`id_attribute_group` WHERE pa.`id_product` = '.intval($this->id).' AND al.`id_lang` = '.intval($id_lang).' AND agl.`id_lang` = '.intval($id_lang).' ORDER BY agl.`name`, al.`name`, pa.`id_product_attribute`'); /* Modify SQL result - hide 01. 02. */ $resultsArray = array(); foreach ($result AS $row) { $row['attribute_name'] = preg_replace('/^[0-9]+\./', '', $row['attribute_name']); $resultsArray[] = $row; } return $resultsArray; } it removes the 01. 02. etc, but the order stays alphabetical? If i replace the new code with the original code, the order is correct because of the numbers, any ideas why the new code is not ordering correctly once the numbers are removed? Link to comment Share on other sites More sharing options...
Mike Kranzler Posted April 19, 2012 Share Posted April 19, 2012 Hi eddieblunt, The point of that modification is to allow you to manually order the attributes using numbers, but that they will not show up on your site as long as you follow that pattern. If you remove those numbers, it renders that part of the code obsolete and won't be of much help when it comes to reordering your attributes. -Mike Link to comment Share on other sites More sharing options...
eddieblunt Posted April 19, 2012 Author Share Posted April 19, 2012 Hi eddieblunt, The point of that modification is to allow you to manually order the attributes using numbers, but that they will not show up on your site as long as you follow that pattern. If you remove those numbers, it renders that part of the code obsolete and won't be of much help when it comes to reordering your attributes. -Mike I wasn't very clear.. I've added the numbers to my attributes to get the correct order, the new code removes the numbers on the product page which is correct, but the order is wrong still? Link to comment Share on other sites More sharing options...
Mike Kranzler Posted April 19, 2012 Share Posted April 19, 2012 I wasn't very clear.. I've added the numbers to my attributes to get the correct order, the new code removes the numbers on the product page which is correct, but the order is wrong still? Can you please post a link to one of the product listings where I can check this out for myself? -Mike Link to comment Share on other sites More sharing options...
eddieblunt Posted April 19, 2012 Author Share Posted April 19, 2012 Can you please post a link to one of the product listings where I can check this out for myself? -Mike Have a look at this page: http://banksystickers.com/10-banksy-balloon-girl-vinyl-wall-art-sticker.html I'm only looking at the size menu at the moment, if you add an item to the cart, you'll see the number added before the size. 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