0

I'm trying to order my foreach for the products associated with the configurable product. I would like the values ​​to be printed in ascending order by position relative to the size attribute.

At the moment I printed these values

L, M, S, XL, XS

I would like my order to be like this:

XS, S, M, L, XL

I already ordered correctly in Manage Attributes and I tried with this code, but it does not work:

$simple_collectionSize = $simple_collection = $conf->getUsedProductCollection()->setOrder('position', 'ASC')->addAttributeToSelect('*')->addFilterByRequiredOptions();

or

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.