如何在主页上为每个类别获取magento中的特色产品?

时间:2015-11-24 05:26:51

标签: php magento

我使用管理面板创建了一个新属性。从每个类别我设置2-6产品作为特色。在主页上,我可以使用此代码获取所有特色产品:

$_helper = $this->helper('catalog/output');
$storeId = Mage::app()->getStore()->getId();
$catalog = $this->getLayout()
->createBlock('catalog/product_list')->setStoreId($storeId);
// get all products that are marked as featured
$collection = Mage::getModel('catalog/product')->getCollection();
$collection->getSelect()->limit(6);
$collection->addAttributeToSelect('featured_product');
$collection->addFieldToFilter(array(
array('attribute' => 'featured', 'eq' => true),
));

现在我有几个类别男人,女人,孩子。每个类别都有子类别。

现在我的问题是如何重新安排我的收藏代码,以便我可以获得男性的特色产品,然后是女性的特色产品,然后是儿童的特色产品?

0 个答案:

没有答案