I have products collection.
$_products = Mage::getModel('catalog/product')->getCollection();
In admin panel in Catalog->Manage Categories->Category products i have position for each product. How i can sort $_products by position ?
If you want to sort products by position in category $category_id. you can use the following
//Load the category model
$category = Mage::getModel('catalog/category')->load($category_id)
->getProductCollection()
->addAttributeToSort('position', 'ASC');
$products_list = $category->getData();
you will get all products sorted by position in that category $category_id
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With