Magento CMS Block Collection, can't filter by store id - addStoreFilter([storeid]) not working
collections, magento, php
Solution
What do you exactly mean with unfiltered?
The addStoreFilter has a 2nd parameter to include the admin store as well
addStoreFilter($store, $withAdmin = true)
So if you have any static blocks linked to all stores, these will also be in your collection.
Is this the issue you have?
Problem
How to filter a cms/block (static block) collection ? This works for cms page: ``` $model = Mage::getModel('cms/page'); $collection = $model->getCollection()->addStoreFilter(3); ``` This does NOT work (returns unfiltered collection): ``` $model = Mage::getModel('cms/block'); $collection = $model->getCollection()->addStoreFilter(3); ``` I also tried working with the resource models 'cms/block' and 'cms/block_collection', no results. Why is Magento that inconsequent ?! Sometimes I really start hating Magento for this. Please help.