1

This is part of my system.xml:

<config>
    <sections>
            <mynamespace_mymodule translate="label" module="mynamespace_mymodule">
        .....
                    <groups>
                       <display translate="label" module="mynamespace_mymodule">
                            <label>Display settings</label>
                            <frontend_type>text</frontend_type>
                            <sort_order>20</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>
                            <fields>
                                <showlinks translate="label">
                                    <label>Custom Text</label>
                                    <frontend_type>select</frontend_type>
                                    <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>
                                    <source_model>adminhtml/system_config_source_yesno</source_model>
                                </showlinks>
                            </fields>
                        </display>
                     </groups>
                 </mynamespace_mymodule>
            </sections>
</config>

This is how I got the value from my dropdown:

Mage::getStoreConfigFlag('mynamespace_mymodule/display/showlinks', 1)

and the results is always false. I checked the value from db and it is 1 or yes. The selected value is yes but it always returns me NOT null but false. Why ?

1

Your updated code:

  <config>
<sections>
        <mycustommodule translate="label" module="mynamespace_mymodule">
    .....
                <groups>
                   <display translate="label" module="mynamespace_mymodule">
                        <label>Display settings</label>
                        <frontend_type>text</frontend_type>
                        <sort_order>20</sort_order>
                        <show_in_default>1</show_in_default>
                        <show_in_website>1</show_in_website>
                        <show_in_store>1</show_in_store>
                        <fields>
                            <showlinks translate="label">
                                <label>Custom Text</label>
                                <frontend_type>select</frontend_type>
                                <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>
                                <source_model>adminhtml/system_config_source_yesno</source_model>
                            </showlinks>
                        </fields>
                    </display>
                 </groups>
             </mycustommodule>
        </sections>

your code for store configuration.

Mage::getStoreConfigFlag('mycustommodule/display/showlinks', 1)
0

To get system configuration use this code:

 Mage::getStoreConfig('sections/groups/fields',Mage::app()->getStore()->getId());

so in your case

section is may be wrong.

Mage::getStoreConfig('mynamespace_mymodule/display/showlinks', 1);

If you want to use same function than

 Mage::getStoreConfigFlag('mynamespace_mymodule/display/showlinks', 1)
  • I updated my post , my xml. Most probably its wrong name in the xml or smth. But I am too blind to see it. Can you check my update? thnx – Attila Naghi Aug 30 '17 at 13:45

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.