0

I'm trying to understand the config paths, but I have problems with getting values from the payment section.

My goal was to get the value of the sandbox_flag of paypal_express, but I am not even able to get the merchant country via

$configValue = Mage::getStoreConfig('payment/account/merchant_country');

Since the config xmls of payments are a bit bigger than others, I think that I need another approach?

0

Try following way:

$sandboxFlag = Mage::getStoreConfig('paypal/wpp/sandbox_flag');

How you get config value?

Open app/code/core/Mage/Paypal/etc/system.xml

<sandbox_flag translate="label">
    <label>Sandbox Mode</label>
    <config_path>paypal/wpp/sandbox_flag</config_path>
    <frontend_type>select</frontend_type>
    <source_model>adminhtml/system_config_source_yesno</source_model>
    <sort_order>80</sort_order>
    <show_in_default>1</show_in_default>
    <show_in_website>1</show_in_website>
    <shared>1</shared>
</sandbox_flag>

If 'config_path' tag is present, then Magento use this as path. If config_path is not present then use section/group/field. E.g:

Open app/code/core/Mage/Contacts/etc/system.xml

If you check contacts active or not.

Mage::getStoreConfig('contacts/contacts/enabled'); // 'section/group/field'
  • Thank you, your path was working. I took the first sandbox_flag occuring in the system.xml which gave my the config_path payment/payflow_advanced/sandbox_flag and this was always NULL. So in the future, I should always search the whole system.xml. But at least the approach to watch config_path was right :-) Thanks for your help. – alexandre Apr 10 '17 at 16:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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