Fresh install of Magento 1.9.1.
Magento is ignoring the attribute position set in Catalogue->Attributes->Manage Attributes->Manage Labels/Options for a configurable prod
The answer by Meogi works but is not the perfect answer as it will only sort the options on the frontend. Try creating an order from the admin panel for a configurable product. You will still get the incorrectly sorted attribute option list.
Instead, you can copy app/code/core/Mage/Catalog/Model/Resource/Product/Type/Configurable/Attribute/Collection.php to local folder app/code/local/Mage/Catalog/Model/Resource/Product/Type/Configurable/Attribute/Collection.php and apply this patch:
Index: app/code/local/Mage/Catalog/Model/Resource/Product/Type/Configurable/Attribute/Collection.php
===================================================================
--- app/code/local/Mage/Catalog/Model/Resource/Product/Type/Configurable/Attribute/Collection.php
+++ app/code/local/Mage/Catalog/Model/Resource/Product/Type/Configurable/Attribute/Collection.php
@@ -301,7 +301,28 @@
}
}
}
+ /**
+ * Mage 1.9+ fix for configurable attribute options not sorting to position
+ * @author Harshit
+ */
+ $sortOrder = 1;
+ foreach ($this->_items as $item) {
+ $productAttribute = $item->getProductAttribute();
+ if (!($productAttribute instanceof Mage_Eav_Model_Entity_Attribute_Abstract)) {
+ continue;
+ }
+ $options = $productAttribute->getFrontend()->getSelectOptions();
+ foreach ($options as $option) {
+ if (!$option['value']) {
continue;
}
+ if (isset($values[$item->getId() . ':' . $option['value']])) {
+ $values[$item->getId() . ':' . $option['value']]['order'] = $sortOrder++;
+ }
+ }
+ }
+ usort($values, function ($a, $b) {
+ return $a['order'] - $b['order'];
+ });
+
foreach ($values as $data) {
$this->getItemById($data['product_super_attribute_id'])->addPrice($data);
}
If you are hesitant of copying across a core file to local folder then I can create a quick module,
this Collection.php file and just override the _loadPrices() function and introduce this fix.