Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is <fieldsets> in Magento Config.xml

Tags:

magento

What is the <fieldsets> tags do in config.xml ? Could you please explain me about fieldset in core config file and custom module config file?

Thanks!

like image 988
Maniprakash Chinnasamy Avatar asked Nov 09 '13 07:11

Maniprakash Chinnasamy


People also ask

What is config XML in Magento?

xml is a configuration file which is used to create configuration fields in Magento 2 System Configuration. The system. xml is a configuration file which is used to create configuration fields in Magento 2 System Configuration. You will need this if your module has some settings which the admin needs to set.


1 Answers

The <fieldsets>* tag is usually only found in config.xml files.

The <fieldsets> tag is mainly used to define which fields (attributes) are to be copied to where while converting objects, e.g. in a quote to order conversion.

Excerpt of app/code/core/Mage/Sales/etc/config.xml:

<config>
    <!-- : -->
    <global>
        <!-- : -->
        <fieldsets>
            <!-- : -->
            <sales_convert_quote>
                <remote_ip>
                    <to_order>*</to_order>
                </remote_ip>
                <x_forwarded_for>
                    <to_order>*</to_order>
                </x_forwarded_for>
                <customer_id>
                    <to_order>*</to_order>
                </customer_id>
                <customer_email>
                    <to_order>*</to_order>
                </customer_email>
                <!-- : -->
                <items_qty>
                    <to_order>total_qty_ordered</to_order>
                </items_qty>
            </sales_convert_quote>
            <!-- : -->
        </fieldsets>
        <!-- : -->
    </global>
    <!-- : -->
</config>

Furthermore, the <fieldsets> tag is used to define the fields which are to be parsed/converted while importing/exporting products or customers via Magento Dataflow.

Edit:

<fieldsets> automatically transport the data's from one table to another table ?

No. They just define what is to be copied to where for a specific aspect.

Scan the Magento source for Mage::helper('core')->copyFieldset() occurrences to see how the real copy processes look like.

For customer/product dataflows scan for Mage::getConfig()->getFieldset() calls, respectively.


* Note the trailing s in <fieldsets>. This is not about the HTML <fieldset> tag.

like image 189
Jürgen Thelen Avatar answered Oct 13 '22 16:10

Jürgen Thelen