Jump to content

attributes order inside each combinations


lcsh

Recommended Posts

Hello everyone,

I need help to create combinations on my Prestashop 1.7.8.7.

When i generate combinations from B.O.>product>combination, attributes inside each combination are ordered by their unique ID. I want them to be ordered by the position of the attribute_group.

Exemple :
attribute_group "Size" position = 1. 
Attribute_group "Color" position = 2.

"S" attribute_id = 2
"red" attribute_id = 1
"green" attribute_id = 3 

I generate combinations with Size : S and Color Red and Green. It will output like this :
Size - S, Color - green

Color - red, Size - S

Why the "size" appear 1st on the first example, but 2nd on the second example?
It's because it is ordered by the ID of the combination.

But i want these to be ordered by the POSITION of the attribute_group , like size is ALWAYS position 1, and color ALWAYS position 2.
like this:
size - S, Color - green
size - S, Color - red


Is it possible to edit some controllers to correct that ? Which one ?
Why it isn't the default behavior ?
 

Edited by lcsh (see edit history)
Link to comment
Share on other sites

  • lcsh changed the title to attributes order inside each combinations
5 minutes ago, QuickUpdate.net said:

OR (dont know if it applies to newest PS versions) make "color" attributes appear last

i don't understand what you said there.
How do you do that ? (in older version?) 

5 minutes ago, QuickUpdate.net said:

you would need to create some kind of mapping between attribute order and attribute id to get the result you want

I will give a look about that. I dont know what it is for now. 

Thank you for your answer !

Edited by lcsh (see edit history)
Link to comment
Share on other sites

Thanks QuickUpdate for these answers. 
Actually, the "color" thing will not work for my case.
The mapping solution seem to be a lot of work, but maybe possible, i will search somebody that can do that.
 

 

does anyone see any other possibilities?

Link to comment
Share on other sites

Now i better understand your issue, actually the "mapping" is the position of the attribute group so you need to find where the attributes are displayed and change the code there to display them in the order of the attribute groups (IDs) and not the attribute IDs

Momentarily can't tell where that change needs to be done if anyone else knows maybe they can post it

Edited by QuickUpdate.net (see edit history)
Link to comment
Share on other sites

This night i thought about another way to resolve my problem :

Is it possible to edit every attribute_id directly on the DB, and how they are assigned when new attributes are created, so that:
all Size attribute_id are 1xxx , all color attribute_id are 2xxx, etc .... ?
Then the position of attribute_group will be respected.

Edit existing attribute_id i can do it manually, it will take time, because i created a lot of attributes.
But edit how attribute_id are newly assigned is something i dont know how to do for now.

Really, part of my question is : Why isn't it the default behaviour ? should i report it on github ?

Need some exterior views here 🆘 

 

Link to comment
Share on other sites

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