如何在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);