0

I create a system.xml:

<?xml version="1.0"?>
<config>
    <sections>
        <checkout translate="label" module="checkoutext">
            <groups>
                <remove_step_login translate="label">
                    <label>Remove Step Login</label>
                    <sort_order>10</sort_order>
                    <show_in_default>1</show_in_default>
                    <show_in_website>1</show_in_website>
                    <show_in_store>1</show_in_store>
                    <fields>
                        <step_login translate="label">
                            <label>Step Login</label>
                            <frontend_type>select</frontend_type>
                            <source_model>adminhtml/system_config_source_yesno</source_model>
                            <sort_order>3</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>
                        </step_login>
                    </fields>
                </remove_step_login>
            </groups>
        </checkout>
    </sections>
</config>

i tried get value from field and display to screen but failed:

public function testAction(){
        $test = Mage::getStoreConfig('checkout/remove_step_login/step_login');
        echo $test;
    }

it's alway return null.

3
  • 3
    did you save the value in your system->configuration? I mean do you see any value for this field when editing it in the admin?
    – Marius
    Commented Oct 8, 2013 at 13:40
  • @Marius: oh, you right. i tried save config and it run, thanks you so much
    – rocky
    Commented Oct 8, 2013 at 13:53
  • You can set default value in config.xml in <default> tag Commented Oct 8, 2013 at 15:48

1 Answer 1

4

So for the sake of having an answer on a question. For a value to return from the function getStoreConfig it has to be saved in the database.

The default return of this function is null.

Note: there is also a function getStoreConfigFlag which returns a boolean

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.