Jump to content

The sort-order of attribute groups


Recommended Posts

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.html

and the first attribute group should be "closing" :-(

Grateful for any ideas or input,

Gekko

Link to comment
Share on other sites

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

  • 3 weeks later...

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 = Gender
Name = 03.font Public Name = Font

Then, 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

  • 3 months later...

hi rocky tried you fix but the attributes still aint appearing for me in any sort of order. this is my code

public 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

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?


Thanks

Gareth

Link to comment
Share on other sites

  • 1 month later...

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

  • 6 months later...

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

  • 1 month later...
  • 2 months later...
  • 4 years later...

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...