0

Magento can sort products by a manually set position in a category. When I echo the select of a collection (echo $productCollection->getSelect()) it shows as cat_index`.`position` AS `cat_index_position in the query.

But the products in the resulting list do not contain this position. How could I get it into the product list?

Thank you

  • Try echoing $productCollection->addFieldToSelect('position')->getSelect() and check the result. – Anshu Mishra Aug 23 '18 at 13:08
-1

The position was there all along. There is no need to alter the collection. The field's name is cat_index_position.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.