开发者

How to load products which is not in particular category in magento

开发者 https://www.devze.com 2023-03-15 06:29 出处:网络
I have to load all available products from the part开发者_Go百科icular attribute-set value additionally it needs to filter only the products which are not under particular category/categories. How can

I have to load all available products from the part开发者_Go百科icular attribute-set value additionally it needs to filter only the products which are not under particular category/categories. How can i load product collection here. Please help me


<?php
$storeId            = Mage::app()->getStore()->getId();
$catalog            = $this->getLayout()->createBlock('catalog/product_list')->setStoreId($storeId);
$collection         = $catalog->getProductCollection()->addAttributeToSelect('*');
$collection->getSelect()->where(category_id != { cat_id } )->limit($this->products_count);

$_productCollection = $collection;
?>

This isn't teste yet and I'm not sure if category_id is the correct value that is used in the database. But it should give you a good start.

0

精彩评论

暂无评论...
验证码 换一张
取 消