Magento - addStoreFilter not working?

前端 未结 4 2110
灰色年华
灰色年华 2020-12-18 09:10

When getting a product collection in Magento, I would expect the StoreFilter to do just that, filter by the current store. But I can\'t get it to work.

Say I have 2

4条回答
  •  猫巷女王i
    2020-12-18 09:23

    I think

    You don't need to do any joins as the magento's setStoreId() will work.

     $collection = Mage::getModel("catalog/product")
    ->getCollection()
    ->setStoreId(1) //change store Id according your needs
    ->addAttributeToSelect(array('name','url','sku'))
    ->setPageSize(20);                
    

    This will get maximum 20 products from store id 1

提交回复
热议问题