2

Synopsis

I have created a basic local module that is designed to listen to an observer , which it does perfectly fine. However I wish the observer method to pull out some configured settings which changes the behaviour of it's task.

I want to add a new section under the Catalog tab; I found this question.

I do not want to create a new tab, instead I do want a new section under the existing Catalog tab (similarly to Catalog > Inventory).

Current behaviour

Currently inside the control panel I click Catalog > Catalog, low and behold inside this tab is a group called Section Name Under Catalog Tab. I also don't see my group Group Name.

Expected behaviour

I click Catalog > Section Name Under Catalog Tab, inside this tab is a group called Group Name with my enable/disable field.

  • As per Image example 1 - I'd expect a section called Section Name Under Catalog Tab;
  • As per Image example 2 - I'd expect this to expand into a view with my group Group Name;
  • Finally the group should contain the form present in Image exmaple 2.

Code snippets

local/Vendor/Module/etc/adminhtml.xml

<?xml version="1.0" ?>
<config>
    <acl>
        <resources>
            <admin>
                <children>
                    <system>
                        <children>
                            <config>
                                <children>
                                    <mymodule translate="title" module="mymodule">
                                        <title>Section inside Catalog</title>
                                    </mymodule>
                                </children>
                            </config>
                        </children>
                    </system>
                </children>
            </admin>
        </resources>
    </acl>
</config>

local/Vendor/Module/etc/system.xml

<?xml version="1.0" ?>
<config>
    <sections>
        <mymodule translate="label" module="mymodule">
            <label>Section Name Under Catalog Tab</label>
            <tab>catalog</tab>
            <frontend_type>text</frontend_type>
            <sort_order>0</sort_order>
            <show_in_default>0</show_in_default>
            <show_in_website>1</show_in_website>
            <show_in_store>1</show_in_store>
            <groups>
                <category_options translate="label">
                    <label>Group Name</label>
                    <frontend_type>text</frontend_type>
                    <sort_order>1</sort_order>
                    <show_in_default>1</show_in_default>
                    <show_in_website>1</show_in_website>
                    <show_in_store>1</show_in_store>
                    <fields>
                        <active translate="label">
                            <label>Enabled</label>
                            <frontend_type>select</frontend_type>
                            <source_model>adminhtml/system_config_source_enabledisable</source_model>
                            <sort_order>1</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>
                        </active>
                    </fields>
                </category_options>
            </groups>
        </mymodule>
    </sections>
</config>
  • can you provide a screenshot of what you see? I'm kind of slow today and I don't really understand the result you are getting. – Marius Jan 20 '14 at 14:02
  • I've updated the question with additional resources. – ash Jan 20 '14 at 14:35
4

Conclusion

I've solved this and there were a couple of confusing aspects. Some of the XML tag names were incorrect and the module reference too was invalid.

In case someone else gets the same issue, I will wrap this up.

app/etc/modules/Myvendor_Mymodule.xml contains:

<?xml version="1.0" ?>
<config>
    <modules>
        <Myvendor_Mymodule>
            <active>true</active>
            <codePool>local</codePool>
            <depends>
                <!-- Added this dependency to ensure it's loaded first -->
                <Mage_Catalog />
            </depends>
        </Myvendor_Mymodule>
    </modules>
</config>

code/local/Myvendor/Mymodule/etc/config.xml contains:

<?xml version="1.0" ?>
<config>
    <modules>
        <Myvendor_Mymodule>
            <version>1.0.0</version>
        </Myvendor_Mymodule>
    </modules>
    <global>
        <models>
            <myvendor_mymodule>
                <class>Myvendor_Mymodule_Model</class>
            </myvendor_mymodule>
        </models>
        <helpers>
            <myvendor_mymodule>
                <class>Myvendor_Mymodule_Model</class>
            </myvendor_mymodule>
        </helpers>
    </global>
</config>

local/Myvendor/Mymodule/etc/system.xml contains:

<?xml version="1.0" ?>
<config>
    <sections>

        <!-- I don't know if this is necessary but prefixed with the parent name -->

        <catalog_mymodule translate="label" module="mymodule">
            <label>My Section (inside Catalog)</label>

            <!-- appears to define the catalog tab as the parent -->
            <tab>catalog</tab>

            <frontend_type>text</frontend_type>
            <sort_order>0</sort_order>
            <show_in_default>0</show_in_default>
            <show_in_website>1</show_in_website>
            <show_in_store>1</show_in_store>
            <groups>

                <!-- This group should appear inside it's own space. -->

                <mymoule_group translate="label">
                    <label>Group Name</label>
                    <frontend_type>text</frontend_type>
                    <sort_order>1</sort_order>
                    <show_in_default>1</show_in_default>
                    <show_in_website>1</show_in_website>
                    <show_in_store>1</show_in_store>
                    <fields>
                        <active translate="label">
                            <label>Enabled</label>
                            <frontend_type>select</frontend_type>
                            <source_model>adminhtml/system_config_source_enabledisable</source_model>
                            <sort_order>1</sort_order>
                            <show_in_default>1</show_in_default>
                            <show_in_website>1</show_in_website>
                            <show_in_store>1</show_in_store>
                        </active>
                    </fields>
                </mymoule_group>
            </groups>
        </catalog_mymodule>
    </sections>
</config>

local/Myvendor/Mymodule/etc/adminhtml.xml contains:

<?xml version="1.0" ?>
<config>
    <acl>
        <resources>
            <admin>
                <children>
                    <system>
                        <children>
                            <config>
                                <children>

                                    <catalog_mymodule translate="title" module="mymodule">
                                        <title>ACL Name for my section</title>
                                    </catalog_mymodule>
                                </children>
                            </config>
                        </children>
                    </system>
                </children>
            </admin>
        </resources>
    </acl>
</config>
  • should each secton with module="mymodule" not be module="myvendor_mymodule" – David Manners Jan 20 '14 at 15:29
  • I think it should be, however when I tried using that it never worked and the module was valid. – ash Jan 20 '14 at 15:38
  • Just FYI: catalog_mymodule prefixing with catalog doesn't matter. – Fabian Blechschmidt Mar 23 '14 at 10:21
  • module="myvendor_mymodule" is name of helper – anshuman Oct 24 '17 at 7:00

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.