![]() |
Magento Get most popular products in a category
Magento get most popular products in any specified category using below code, you can show them in the sidebar of product detail page to let your visitors know the popularity of the products for that category.
$category = Mage::getModel('catalog/category')->load($categoryId); $products = Mage::getResourceModel('reports/product_collection') ->addOrderedQty() //total number of quantities ordered ->addAttributeToSelect('*') //get all attributes ->setOrder('ordered_qty', 'desc') //most ordered quantity products first ->addCategoryFilter($category); |
| All times are GMT +8. The time now is 06:28 PM. |
Powered by vBulletin Version 3.8.7
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.