Magento: Loading attributes per store
I have a custom module that exports data to our fulfillment system when the user checks out. Be开发者_高级运维fore export I need to run the address through a verification service. Since we are charged for this service, I need to configure the user name and password for the service per store. I have added the attributes I need, however I cannot figure out how to load them per store. How can I tell my resource model to load based off the store?
How have you added them? It strikes me that they'd be perfect candidates for config values, and Magento wraps the whole per-store-setting thing there really well - take a look in a system.xml file for one of the built-in modules (or a downloaded one...they tend to be simpler) and how it builds the fields up and specifies at what 'scope' (global, store, store-view) settings can be applied.
Then you can access the values from your code with Mage::getStoreConfigValue('your/config/key')
and it will give you the correct value for the scope you're in, or the default if you haven't set one for a particular store.
精彩评论