Skip to main content
Magento

Magento Community – 1.9.1 – Fixing Attribute Position Set Issue

By |October 18, 2016 March 4th, 2022No Comments

In the latest version of Magento Community 1.9.1, the configurable product options and dropdowns are not sorted based on the attribute position set. Instead, they use simple product ids to determine the list order.

This may confuse the customer as well as the admin at times. This issue can be fixed by following the steps given below.

Step 1:

By default, we set the attribute position using the following path.Catalog > Attributes > Manage Attributes > (in the below example we have selected one product attribute called “Shoe size”) > Manage Labels/Options (left side navigation).In this page, we set the options “Position” like the below image.

Step 2:

Next, we need to add the simple product under one configurable product as given below.

Step 3:

Now check the configurable product attribute option on front-end. It will look like the below image.

In the above image, the product attribute options list is based on the simple product ids instead of attribute position set.

Step 4:

We can solve this issue by adding the small piece of code in the file Collection.php.For that copy the file   app/code/core/Mage/Catalog/Model/Resource/Product/Type/Configurable/Attribute/Collection.phpto local folder    app/code/local/Mage/Catalog/Model/Resource/Product/Type/Configurable/Attribute/Collection.phpPlease add the following code in line 305.

The code given in the iframe should be placed above the code of Magento shown below

foreach ($values as $data) {

$this->getItemById($data[‘product_super_attribute_id’])->addPrice($data);

}

Step 5:

Now clear the cache and check it on front-end. The attribute option looks like the following image.

Now the product attribute options list will be sorted based on the position and not by the simple product ids.

Even though this is a small issue, it can become an irritant for the admin and affect the user experience of the customer. We faced this issue while working on a client project and wanted to share the same so that the community benefits as a whole.

Please let us know your comments and feedback.

Are you still in Magento 1? Check out the advantages of Magento 2 and its benefits for your business. Start your Magento migration today.

Balasubramaniam

Author Balasubramaniam

Balasubramaniam, aka Bala, is a Certified Magento Developer Plus Senior Software Engineer and one of our gems in the Magento team. A quick learner, he owns the projects that he works in and ensures they are delivered on time. He is very good at analyzing/fixing bugs and Magento customizations.

More posts by Balasubramaniam

Discover What You’re Missing

Get the weekly email full of actionable ideas and insights you can use at work and home.