I am working in magento one website multiple stores platform, i successfully created one website with 3 stores and 3 store view. I assigned a category to my default store and products in it, but i getting other products also. Let me know how i can go to correct direction.

$collection = Mage::getModel('catalog/product')->setStoreId($storeId)->getCollection()->addAttributeToSelect('*')->addWebsiteFilter($website_id)->addAttributeToFilter‌​('type_id', array('eq' => 'simple'));

2 Answers 2


Try this

$websiteIds = array(Mage::app()->getStore()->getWebsiteId());
$storeId = Mage::app()->getStore()->getStoreId();

$collection = Mage::getModel('catalog/product')->getCollection()

If your category has the flag "Is anchor" set to Yes then it will display products from its subcategories too.
Also, rebuilding your indexes won't hurt either.

  • My requirement is display products on front page, i am not displaying categories here.
    – Mathew
    Aug 26, 2015 at 8:58
  • Then you should post the code you are using.
    – Marius
    Aug 26, 2015 at 9:00
  • $collection = Mage::getModel('catalog/product')->setStoreId($storeId) ->getCollection() ->addAttributeToSelect('*')->addWebsiteFilter($website_id)->addAttributeToFilter('type_id', array('eq' => 'simple')); $collection->getSelect()->limit(8); This is my query by which i am getting products.
    – Mathew
    Aug 26, 2015 at 9:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.