I created attribute custom_attribute for category with some default value. If I save category(for example for store 26) with some value for this attribute I can get via:

Mage::getModel('catalog/category')->load(12); //example where you will get data for your category with this custom_attribute value

But, if you try to load category collection and even use addAttriuteToSelect('custom_attribute'), you won't get a it's value in case you didn't save for default store manually some value.

That's becuase if you look in app/code/core/Mage/Catalog/Model/Resource/Collection/Abstract.php line 127, you will see that they join table where store_id = 0. That's mean that you need to save category with your custom_attribute for default store.

I've quick idea via observer to assign attribute value for default store.

If there any more clean solutions?


Your Answer

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