1

Can Anyone Please Help me to data convert quote_item to order_item Table Using Field-set.

First I am Create file etc/extension_attributes.xml and use code

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Api/etc/extension_attributes.xsd">
    <extension_attributes for="Magento\Checkout\Api\Data\ShippingInformationInterface">
        <attribute code="temp_id" type="decimal"/> 
    </extension_attributes>
</config>

After Create Another File in etc/fieldset.xml and put code

<?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="sales_convert_quote_item">
<field name="temp_id">
<aspect name="to_sales_order_item"/>
</field>
</fieldset>
</scope>
</config>

and also created the column in both tables.

2

Follow This Step(DevDocs)

etc/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">
            <!-- Copy quote to sale order fields -->
            <fieldset id="sales_convert_quote">
                <field name="your_field">
                    <aspect name="to_order" />
                </field>
            </fieldset>
        </scope>
    </config>

Seem that we need to use Observer sales_model_service_quote_submit_before to assign the new fields:

  • thank you for using the observe working perfectly ... – Vishal Baraiya Aug 13 at 12:00
  • happy coding bro ..... :) – Rk Rathod Aug 13 at 12:02

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.