David Ansermot Web Developer / TYPO3 Integrator

19oct/100

Magento : Add sorting condition

Today, I add to make my category menu reflect the category order in the backend (not ordered by name).

The only thing you have to do is to add “addAttributeToSort(‘attName’, ‘sortDirection’)” in your template the next function in the loading instruction.

$collection = Mage::getResourceModel(’catalog/category_collection’)
->addAttributeToSelect(’name’)
->addAttributeToSort('position', 'asc')
->addAttributeToFilter('is_active', 1)
->load();

Hope it’ll help you too.
Enjoy

qrCode

Posts that maybe you want to read ::

Commentaires (0) Trackbacks (0)

Aucun commentaire pour l'instant


Leave a comment

(required)

Aucun trackbacks pour l'instant