且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何从 magento 电子商务中的特定类别中获取产品

更新时间:2023-11-30 11:49:40

您基本上是加载类别,获取产品集合,然后进行适当的过滤.

You basically load up the category, get the Product Collection and then filter appropriately.

$products = Mage::getModel('catalog/category')->load($category_id)
 ->getProductCollection()
 ->addAttributeToSelect('*')
 ->addAttributeToFilter('status', 1)
 ->addAttributeToFilter('visibility', 4)
 ->addAttributeToFilter('special_price', array('neq' => ""))
 ->setOrder('price', 'ASC')
 ;