I have found plenty of questions and answers regarding how to load categories from a particular store, but this is a different issue.
My problem is, having loaded the categories that I want, their attribute data is always the default / global value.
Mage::getModel('catalog/category')->getCollection()
->addAttributeToSelect(array('name', 'description')
->addAttributeToFilter('is_active', 1)
->addIdFilter('31,32,33,34') // has to be a string, array doesn't work!
->setStoreId(2);
In the above example, the names and descriptions that I get back are the default values, not the ones set for store ID 2. It looks like setStoreId
does nothing.
I know that the categories themselves are not connected with a particular store view, but the attributes are: in the admin panel, you can set values per store view, per website and globally. I've set them per store view.
I've tried ->addStoreFilter(2)
but Mage_Catalog_Model_Category_Collection doesn't support that, I get a PHP fatal error. Looks like it's a product-specific filter.
Does anyone know what I'm missing?
setProductStoreId
which allows you to set where the products will come from butjoinUrlRewrite
for example usesMage::app()->getStore()
which implies you can't easily join the URLs for a different store. You could trysetStoreId
on the model beforegetCollection
but I'm not sure it'll have the desired effect.