4

I need to set a fieldset like below for a custom table pos_agent

customer fieldset xml,

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="urn:magento:framework:DataObject/etc/fieldset.xsd">
<scope id="global">
    <fieldset id="customer_account">
        <field name="prefix">
            <aspect name="create" />
            <aspect name="update" />
            <aspect name="name" />
        </field>
        <field name="firstname">
            <aspect name="create" />
            <aspect name="update" />
            <aspect name="name" />
        </field>
        <field name="middlename">
            <aspect name="create" />
            <aspect name="update" />
            <aspect name="name" />
        </field>
        <field name="lastname">
            <aspect name="create" />
            <aspect name="update" />
            <aspect name="name" />
        </field>
        <field name="suffix">
            <aspect name="create" />
            <aspect name="update" />
            <aspect name="name" />
        </field>
        <field name="email">
            <aspect name="create" />
            <aspect name="update" />
        </field>
        <field name="password">
            <aspect name="create" />
        </field>
        <field name="confirmation">
            <aspect name="create" />
        </field>
        <field name="dob">
            <aspect name="create" />
            <aspect name="update" />
        </field>
        <field name="taxvat">
            <aspect name="create" />
            <aspect name="update" />
        </field>
        <field name="gender">
            <aspect name="create" />
            <aspect name="update" />
        </field>
    </fieldset>
    <fieldset id="customer_address">
        <field name="vat_id">
            <aspect name="to_quote_address" />
        </field>
        <field name="vat_is_valid">
            <aspect name="to_quote_address" />
        </field>
        <field name="vat_request_id">
            <aspect name="to_quote_address" />
        </field>
        <field name="vat_request_date">
            <aspect name="to_quote_address" />
        </field>
        <field name="vat_request_success">
            <aspect name="to_quote_address" />
        </field>
    </fieldset>
    <fieldset id="sales_convert_order_address">
        <field name="vat_id">
            <aspect name="to_quote_address" />
        </field>
        <field name="vat_is_valid">
            <aspect name="to_quote_address" />
        </field>
        <field name="vat_request_id">
            <aspect name="to_quote_address" />
        </field>
        <field name="vat_request_date">
            <aspect name="to_quote_address" />
        </field>
        <field name="vat_request_success">
            <aspect name="to_quote_address" />
        </field>
    </fieldset>
    <fieldset id="sales_convert_quote_address">
        <field name="vat_id">
            <aspect name="to_order_address" />
            <aspect name="to_customer_address" />
        </field>
        <field name="vat_is_valid">
            <aspect name="to_order_address" />
            <aspect name="to_customer_address" />
        </field>
        <field name="vat_request_id">
            <aspect name="to_order_address" />
            <aspect name="to_customer_address" />
        </field>
        <field name="vat_request_date">
            <aspect name="to_order_address" />
            <aspect name="to_customer_address" />
        </field>
        <field name="vat_request_success">
            <aspect name="to_order_address" />
            <aspect name="to_customer_address" />
        </field>
    </fieldset>
    <fieldset id="sales_copy_order_billing_address">
        <field name="vat_id">
            <aspect name="to_order" />
        </field>
        <field name="vat_is_valid">
            <aspect name="to_order" />
        </field>
        <field name="vat_request_id">
            <aspect name="to_order" />
        </field>
        <field name="vat_request_date">
            <aspect name="to_order" />
        </field>
        <field name="vat_request_success">
            <aspect name="to_order" />
        </field>
    </fieldset>
    <fieldset id="order_address">
        <field name="vat_id">
            <aspect name="to_customer_address" />
        </field>
        <field name="vat_is_valid">
            <aspect name="to_customer_address" />
        </field>
        <field name="vat_request_id">
            <aspect name="to_customer_address" />
        </field>
        <field name="vat_request_date">
            <aspect name="to_customer_address" />
        </field>
        <field name="vat_request_success">
            <aspect name="to_customer_address" />
        </field>
    </fieldset>
</scope>

This is a fieldset.xml in module-customer/etc, I think this xml layout file is used for the name request from front end.

usage of the above xml is here,

$customerAccount = $this->_fieldsetConfig->getFieldset('customer_account');
    foreach ($customerAccount as $code => $field) {
        if (isset($field['name'])) {
            $fields[$code] = $code;

        }
    }

i had tried same like this for my custom table but not works. Please anyone help me to create a fieldset with a layout xml file. Thanks in advance.

  • please anyone help me – Ask Bytes Sep 24 '18 at 8:24
1

Please try with below fieldset.xml

<?xml version="1.0"?><config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Object/etc/fieldset.xsd">
<scope id="global">
    <fieldset id="sales_convert_quote">
        <field name="custom_fieldset">
            <aspect name="to_order" />
        </field>
    </fieldset>        
    <fieldset id="quote_convert_item">
        <field name="custom_sku">
            <aspect name="to_order_item" />
        </field>
    </fieldset>         
    <fieldset id="sales_convert_order">
        <field name="custom_fieldset">
            <aspect name="to_quote" />
            <aspect name="to_invoice" />
            <aspect name="to_shipment" />
            <aspect name="to_cm" />
        </field>
    </fieldset>        
    <fieldset id="sales_convert_order_item">
        <field name="custom_sku">
            <aspect name="to_quote_item" />
            <aspect name="to_invoice_item" />
            <aspect name="to_shipment_item" />
            <aspect name="to_cm_item" />
        </field>            
    </fieldset>
</scope>

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.