3

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'));
$collection->getSelect()->limit(8);
5

Try this

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

$collection = Mage::getModel('catalog/product')->getCollection()
            ->addAttributeToSelect('*');
$collection->addStoreFilter($storeId);
$collection->addWebsiteFilter($websiteIds);
| improve this answer | |
0

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.

| improve this answer | |
  • My requirement is display products on front page, i am not displaying categories here. – Mathew Aug 26 '15 at 8:58
  • Then you should post the code you are using. – Marius Aug 26 '15 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 '15 at 9:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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