如何在magento中按产品名称获取所有产品收集订单? [英] how to get all product collection order by product name in magento?
本文介绍了如何在magento中按产品名称获取所有产品收集订单?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在magento中按产品名称获取产品收集订单吗?有什么想法吗?
I want to get the product collection order by product name in magento? any idea??
推荐答案
获取按产品名称升序排序的所有产品:-
Get all products sorted by product name ascending:-
$collection = Mage::getModel('catalog/product')
->getCollection()
->addAttributeToSort('name', 'ASC');
获取所有按产品名称降序排列的产品:-
Get all products sorted by product name descending:-
$collection = Mage::getModel('catalog/product')
->getCollection()
->addAttributeToSort('name', 'DESC');
获取数量有限的产品(例如:10个产品),按产品名称升序排列:-
Get limited number of products (for example: 10 products) sorted by product name ascending:-
$collection = Mage::getModel('catalog/product')
->getCollection()
->addAttributeToSort('name', 'ASC')
->setPageSize(10);
这篇关于如何在magento中按产品名称获取所有产品收集订单?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文