How do I add an attribute + it's sortorder (position) to the product list collection?

In the catalog category list we use 1 text attribute (brand) and 1 list attribute (size) .... for every product we have to use getAttribute() and getAttributetext() ....

BUt: how can I

  1. add the brand attribute to the list collection?
  2. add the size attribute + it's position (sort order) to the list collection?

Can this easily be added to the query? or how do I do this?


1 Answer 1


Copy the file \app\code\core\Mage\Catalog\Block\Product\List.php to \app\code\local\Mage\Catalog\Block\Product\List.php

In the function _getProductCollection after the statement

$this->_productCollection = $layer->getProductCollection();

add below code.


You can also override the List class by adding below code into a custom module's config.xml.

  • Thx. This looks almost complete. But I don't see how we are retrieving the position column of the attribute
    – snh_nl
    Jan 7, 2017 at 17:08
  • You mean you want to add position of options of the attribute size? Jan 7, 2017 at 17:18
  • I eventually need to sort by the attribute position of the options. Yes.
    – snh_nl
    Jan 7, 2017 at 17:21
  • Also does the query get the language specific version? And if not exist fallback to default/admin value. Seems difficult to do ....
    – snh_nl
    Jan 7, 2017 at 17:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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