I have my comparable products page in a table.
In my fist row there is Description.
In my 3rd row there is SKU
I want to move my SKU in the first row
How to achieve it?
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.Sign up to join this community
The attributes that are displayed in the compare list are retrieved in the method
Mage_Catalog_Model_Resource_Product_Compare_Item_Collection::getComparableAttributes but this method does not sort the attributes in any way.
So they are retrieved in the way that mysql wants it. Which is not very predictable.
You can take the result of that method and try to parse the result and rearrange the attributes as you want, or you can override the method and after the line
->where('main_table.attribute_id IN(?)', $attributeIds) add this
->order(new Zend_Db_Expr('CASE WHEN main_table.attribute_code = "sku" THEN 1 ELSE 0 END DESC'));