Magento convert quote item to order item

If you have custom product attribute(s), then you may need to convert them to quote item and then to order item in Magento when an order is placed. That helps the order get the product attributes details and saves it in order tables to reference in the backend Manage Orders screen. This allows you to know what values for the product is selected by the customer, so that you can consider it when dispatching the order items.

This is a two way process where first the product attribute converts to quote item, and then quote item (with your product attribute’s value) converts to order item.

To do this you will have to put the below code in your module’s config.xml file:

    <!--convert your custom product attribute "myattribute" from quote item to order item-->

    <!--add your custom product attribute "myattribute" to quote item-->
                    <myattribute />

    <!--convert product attribute to quote item through event observer-->

And in your Model/Observer.php

public function convertAttribute(Varien_Event_Observer $observer) {
    $item = $observer->getQuoteItem();
    $product = $observer->getProduct();
    return $this;

Leave a Reply