Jump to content

How to change the order of the attributes in the product combination


Angar

Recommended Posts

On 3/15/2024 at 7:08 PM, Daresh said:

You are mixing two things here. Combination is not attribute, it does not have position in the database. 

You're right, I mean combinations. Is there any solution to change the order of combinations in the back office? I tried editing /classes/Product.php but it doesn't change anything.

On 3/17/2024 at 1:14 PM, Prestashop Addict said:

You want to sort it in backoffice or front?

I want to change this in backoffice. One of my customers exports products to eBay and he said that he needs to have "color" on the first position, because without this he can't export products to eBay.

Link to comment
Share on other sites

After careful investigation, I found that the sorting order depends on:

admin/index.php/sell/catalog/products/combinations/form/1-2-3-4-5-6-7-8

Where did 1-2-3-4-5-6-7-8 come from? I have been troubleshooting for a long time and still can't figure it out. PrestaShop is getting more and more complicated.

Link to comment
Share on other sites

Oh, after the final efforts, I found the sorting BUG and the solution:

classes/Product.php

Replace ORDER BY pa.`id_product_attribute`' with ORDER BY ag.`position`' in the getAttributeCombinationsById method.

image.thumb.png.af637c5c69cb4504ec0f61bbbb67a351.png

image.thumb.png.5aee5d202b73dc824a41a061d78ed88b.png

image.thumb.png.b4cc49abf0dd6efcd390c32fa971bdcc.png

 

At present, we see that it has been displayed according to the attribute group sorting. If there are other places where the sorting is incorrect, please repeat the above method to replace the sorting rules.

 

 

  • Thanks 1
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...