How can I get a configuration value for a specific website?

There is Mage::getStoreConfig() but no Mage::getWebsiteConfig().


I am exporting configuration data on website level - so somehow I want the website scope setting ...

4 Answers 4


Usually, you're not supposed to do this. Mage::getStoreConfig() will automatically return the store value, the website value, the global value, or the default value depending on the configuration of the field.

However, if you really need to disregard the store value and get the website value, you can do it this way:

  • 2
    Don't forget to add the websiteId. i.e. <br/> Mage::app()->getWebsite($websiteId)->getConfig('web/unsecure/base_url')
    – Eduardo
    Dec 1, 2016 at 11:10

This is a rare case, as settings are inherited to store level and usually getStoreConfig() takes the website settings into account.

You can use Mage_Core_Model_Website::getConfig() - but be a aware that there is a slight difference to Mage_Core_Model_Store::getConfig() where also some processing is being done (for example substitution of {{...}}) - this kind of substitution is not done on the website level.

If the value can only be changed on website level, another option would be to obtain just some random store of the website and then use getStoreConfig().


This can be derived using the specific website code if known.

$value = Mage::getConfig()->getNode('websites/[website_code]/section/group/field');
  • This should be marked as the correct answer. You can get websites from Mage::app()->getWebsites() and the code from the website: $website->getCode()
    – Michael
    Aug 13, 2016 at 11:12
  • Good stuff @benmarks. I agree, this should be marked as the right answer. I know it's not common to get a config value by website but in some cases it is.. for example, I needed to do this when running an export of products by website in a cron job task.
    – Eduardo
    Dec 1, 2016 at 11:05

I might be wrong, but as far as I remember, the configuration scope is always bound to stores. If you set a value on a website level, it will be available on any store of that website unless you set a different value on the store level.

Say you have website A and store A1 and A2 are stores for that website. Assume that A has the value 5 for a given property

Then Mage::getStoreConfig() will return 5 for that property both for A1 and A2. If you set the property to 3 for A1, then Mage::getStoreConfig() will return 3 for A1 and 5 for A2 for that property.

  • You are perfectly right - but: I am exporting configuration data on website level - so somehow I want the website scope setting ... I know this is a quite rare case.
    – Alex
    Feb 14, 2013 at 9:35
  • @Alex You should probably mention that in your question, too ;)
    – mpaepper
    Feb 14, 2013 at 9:53

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.