views:

318

answers:

1

I have a custom module that exports data to our fulfillment system when the user checks out. Before 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?

+1  A: 

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.

Greg
Business users need to be able to manage the user/pass. I already created an administration panel for the business users. Since we are running magento balances across multiple servers, syncing up these files will cause a management nightmare
MANCHUCK
the values are in the database, the files just define the fields that get shown in the System->Configuration section... so I'm not quite sure I understand how it's different to what you're after
Greg
Oh I was under the impression that it would not write to the database. Ill give it a shot and see what happens
MANCHUCK
This was the solution that I needed. After some searching I was able to find what I need to configure. A Slight change is needed in my model since I really do not need attributes just config paths but hey live and learn
MANCHUCK