Gekko Posted October 22, 2009 Share Posted October 22, 2009 Greetings, I see other had problems with this, however I didn't find any solution so excuse me for bringing up this question once again.So, my products has attributes in different group and I can't seem to understand what is dictating the order in which they appear? I even went into the database and checked the order there and I find no correlation with the output in my presta shop? Anyone out there solved this mystery?Here is my product:http://www.breathcatchers.com/shop/corsets/20-classic-corset.htmland the first attribute group should be "closing" :-(Grateful for any ideas or input,Gekko Link to comment Share on other sites More sharing options...
rocky Posted October 23, 2009 Share Posted October 23, 2009 Have a look at the function getAttributesGroups in classes/Product.php. It looks like attribute groups are sorted by product attribute ID. You could try changing this to agl.`public_name` to sort by name. Link to comment Share on other sites More sharing options...
Gekko Posted October 23, 2009 Author Share Posted October 23, 2009 Interesting! I'll give it a try and let you know how things went.Even more interesting would be to change the ID's around maybe? Also have a sort problem with the CMS articles and the sort order they are output. Or would that be a too risky thing to play around with?Thank you Have a look at the function getAttributesGroups in classes/Product.php. It looks like attribute groups are sorted by product attribute ID. You could try changing this to agl.`public_name` to sort by name. Link to comment Share on other sites More sharing options...
afuniman Posted November 9, 2009 Share Posted November 9, 2009 Thanks Rocky. This actually worked quite well for me. One thing that I did to make it easier was to preface my attribute group name with 01., 02., 03., etc..... so that I could put the groups in the order that I wanted them to appear. For example: Name = 01.personalize Public Name = Personalize this Item?Name = 02.gender Public Name = GenderName = 03.font Public Name = FontThen, I changed what you suggested from agl.`public_name` to agl.'name`. That way, I didn't have to preface the public name with anything to keep it in the order I wanted. Does that make sense? I hope this helps someone. Link to comment Share on other sites More sharing options...
DaveP Posted February 17, 2010 Share Posted February 17, 2010 I'm just looking at this myself and notice that the last line of the function is:ORDER BY pa.`id_product_attribute`');So could someone please advise what this should be changed to ? ( to order by public name ! )TIA, Dave Link to comment Share on other sites More sharing options...
rocky Posted February 17, 2010 Share Posted February 17, 2010 You should use agl.`public_name`to sort by the attribute groups by public name. Link to comment Share on other sites More sharing options...
DaveP Posted February 17, 2010 Share Posted February 17, 2010 Thanks Rocky,Yes I see that above, so does it then become:ORDER BY agl.`public_name`’);As I'm brand new here, I just wanted to make 100% and not break things cheers Dave Link to comment Share on other sites More sharing options...
rocky Posted February 17, 2010 Share Posted February 17, 2010 Yes, change: ORDER BY pa.`id_product_attribute`'); to: ORDER BY agl.`public_name`'); Except add an apostrophe between the ` and ). For some reason, the forum is removing that character. Link to comment Share on other sites More sharing options...
DaveP Posted February 17, 2010 Share Posted February 17, 2010 Cheers...Dave Link to comment Share on other sites More sharing options...
tatamifightwear Posted February 17, 2010 Share Posted February 17, 2010 hi rocky tried you fix but the attributes still aint appearing for me in any sort of order. this is my codepublic function getAttributeCombinaisons($id_lang) { return Db::getInstance()->ExecuteS(' SELECT pa.*, ag.`id_attribute_group`, ag.`is_color_group`, agl.`name` AS group_name, al.`name` AS attribute_name, a.`id_attribute` 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` AND al.`id_lang` = '.intval($id_lang).') LEFT JOIN `'._DB_PREFIX_.'attribute_group_lang` agl ON (ag.`id_attribute_group` = agl.`id_attribute_group` AND agl.`id_lang` = '.intval($id_lang).') WHERE pa.`id_product` = '.intval($this->id).' ORDER BY agl.`public_name`'); }the order is still all over the place. do i need to add 01., 02. before the public name? Link to comment Share on other sites More sharing options...
rocky Posted February 18, 2010 Share Posted February 18, 2010 You could do that, or you could try the following instead: ORDER BY agl.`public_name`, al.`name` to sort the attributes alphabetically as well as the attribute groups. Link to comment Share on other sites More sharing options...
tatamifightwear Posted February 23, 2010 Share Posted February 23, 2010 Hi guys i have done this and now it works great, i can get the attributes into alphabetical order. Only problem i get now is that when i go to the combinations generator it works great and produces lets say 20 quantity. When i go the combinations page of the product it shows 20 for each attribute but when i go to the front office and click on the product it says warning last item in stock and only 1 item.Any ideas on how to fix this guys? and what could have happened?ThanksGareth Link to comment Share on other sites More sharing options...
pasko Posted April 14, 2010 Share Posted April 14, 2010 It is find for attribute groups.How to do it for the attributes?Thanks. Link to comment Share on other sites More sharing options...
tomerg3 Posted April 14, 2010 Share Posted April 14, 2010 I have an Attribute Order module on my site, besides letting you sort attribute groups and items, you can also copy attributes from one product to another, or to all the products in a category.You can see it on my site, or in the Jobs and offers sections (look for attribute order in the title) Link to comment Share on other sites More sharing options...
boylibre Posted October 21, 2010 Share Posted October 21, 2010 Hi Tomerg3, I just bought Attribute Order and installed it. Installation is successful but when I can't change the order. It seems to work when you move the order up and down but when ever you come back to the module, it always reset to the original order.Can you help?Thanks,boy Link to comment Share on other sites More sharing options...
boylibre Posted October 21, 2010 Share Posted October 21, 2010 Just to update to this forum, in case someone face the same problem as mine. Check your file permission, make sure it is set to 755 for files and folder under Modules. Thanks to Tomer for the support. Link to comment Share on other sites More sharing options...
highwaykind Posted December 17, 2010 Share Posted December 17, 2010 in classes/Product.phpif agl 'public_name' is not working for you, try ORDER BY agl.`name`'); (in stead of al.'name').Works great here to change the attribute order to the way I numbered them in the backend.01.Number one02.Number two etc. Link to comment Share on other sites More sharing options...
Dishpet Posted March 12, 2011 Share Posted March 12, 2011 There is another work around here http://www.prestashop.com/forums/viewthread/57129/#392981 that worked for me with no ill effects so far and I am running PrestaShop v.1.3.7. So far so good for me. Link to comment Share on other sites More sharing options...
gr_fenix Posted May 7, 2015 Share Posted May 7, 2015 What about PS 1.6? I want to sort the combination attributes by position. Thanks 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