Skip to main content
2 of 4
added 89 characters in body
Robert
  • 2.2k
  • 3
  • 37
  • 84

addAttributeToSort() not working

I have configurable product create with attribute size, I try to list this attribute size in the product description, but addAttributeToSort() not working. My code is:

if($_product->getTypeId() == "configurable"):
    $conf = Mage::getModel('catalog/product_type_configurable')->setProduct($_product);

    $simple_collection = $conf->getUsedProductCollection()->addAttributeToSelect('*')->addAttributeToSort('size','ASC')->addFilterByRequiredOptions();

right now I have something like this:

100g
10g
25g

enter image description here

If I use DESC instead ASC I have this sorting:

25g
10g
100g
Robert
  • 2.2k
  • 3
  • 37
  • 84