Reputation: 11
I have problem to show product list on magento. My current code only shows filter by category:
Example:
{{block type="catalog/product_list" name="home.catalog.product.list" alias="products_homepage" category_id="18" template="catalog/product/list.phtml"}}
I only want it to filter by store id
{{block type="catalog/product_list" name="home.catalog.product.list" alias="products_homepage" store_id="4" template="catalog/product/list.phtml"}}
This doesn't work.
Any suggestions?
Upvotes: 1
Views: 945
Reputation: 12809
That won't work. You will need to modify / override the product listing block.
copy
/app/code/core/Mage/Catalog/Block/Product/List.php
to
/app/code/local/Mage/Catalog/Block/Product/List.php
You would need to modify _getProductCollection()
You could add something like this
if($this->getStoreId()) {
$this->_productCollection->addStoreFilter($this->getStoreId());
}
$this->getStoreId() will pull through the value you use in your tag: store_id="3"
Upvotes: 1