eddieblunt Posted July 9, 2010 Share Posted July 9, 2010 Can anyone tell me how i can change the order of the colours in my colour picker?At the moment its always alphabetical.Also i would like to show the colours that cost extra, seperate to the standard colours, is this possible?Thanks,Eddie Link to comment Share on other sites More sharing options...
rocky Posted July 10, 2010 Share Posted July 10, 2010 The attributes and colours are all retrieves using the same query in the getAttributesGroups function in classes/Product.php (in PrestaShop v1.3.1): public function getAttributesGroups($id_lang) { return Db::getInstance()->ExecuteS(' SELECT ag.`id_attribute_group`, ag.`is_color_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` 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 al.`name`'); } As you can see at the end, they are ordered by name. You can change it to order by a.`id_attribute` to sort them by ID instead. It isn't possible to manually choose the order. Link to comment Share on other sites More sharing options...
eddieblunt Posted July 10, 2010 Author Share Posted July 10, 2010 Thanks! Thats done it Link to comment Share on other sites More sharing options...
Mister Denial Posted September 15, 2010 Share Posted September 15, 2010 Hello, I tried using this on PS 1.3.1 but it did not change anything, it still sorts alphabetically. Is there anything else I might need to change to make it work? Help would be very much appreciated! Link to comment Share on other sites More sharing options...
noesac Posted October 3, 2010 Share Posted October 3, 2010 Hello, I tried using this on PS 1.3.1 but it did not change anything, it still sorts alphabetically. Is there anything else I might need to change to make it work? Help would be very much appreciated! I'm looking at the code now and it seems to be different in v1.3, which is why you probably don't see a difference. Link to comment Share on other sites More sharing options...
Mister Denial Posted October 4, 2010 Share Posted October 4, 2010 Hi noesac,thanks for the feedback! I have found a workaround using empty spaces to force the options in the order I want, but this is far form being a good solution, nor one that will work in a full production environment. If anyone has an idea on how to solve this for PS 1.3.1. that would be really great! Link to comment Share on other sites More sharing options...
noesac Posted October 4, 2010 Share Posted October 4, 2010 Hi noesac,thanks for the feedback! I have found a workaround using empty spaces to force the options in the order I want, but this is far form being a good solution, nor one that will work in a full production environment. If anyone has an idea on how to solve this for PS 1.3.1. that would be really great! Would you mind elaborating on this approach that you've taken?I've also been hunting for a better way to deal with this, but nothing yet! Link to comment Share on other sites More sharing options...
Mister Denial Posted October 4, 2010 Share Posted October 4, 2010 I used an invisible character from the symbol map which in the hierarchy of symbols comes after the letter Z. I don't remember the exact name, I think it was something like "small blank space". I placed none in front of my first option, one in front of the second option, two in front of the third, etc... Because this symbol is considered to come after Z in the alphabet, this method will sort your options alphabetically without regard for the actual first visible letter. For example in my case it looks like thisSizes:XS_S__M___L____XL_____XXL(with _ replacing the invisible character for this example)It is far from perfect, but it's less annoying than having your options sorted against all logic (L, M, S, XL, XS, XXL) Link to comment Share on other sites More sharing options...
noesac Posted October 4, 2010 Share Posted October 4, 2010 Ah ok thanks, quite a clever work around but probably wouldn't work for my scenario. Link to comment Share on other sites More sharing options...
Mister Denial Posted October 4, 2010 Share Posted October 4, 2010 No problem! I am also hoping that someone will figure out a real solution for this sorting issue.Anyone? Link to comment Share on other sites More sharing options...
sm3004 Posted November 2, 2010 Share Posted November 2, 2010 Am having the same issues, need to sort from XS to XL but it's putting them alphabetically.Anyone know a fix? rocky's fix does not work in Prestashop 1.3.1.1. changed "ORDER BY al.`name`" to "order by a.`id_attribute`" and no changes at all. tried other variations and nothing happens. Link to comment Share on other sites More sharing options...
jafarek Posted August 19, 2011 Share Posted August 19, 2011 And still no one has solved the problem? I have a Presta 1.4.4.0 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