I need get data from text area in which customer write comment, than that comment I need add to order using sales_order_place_before event and save order to sales_flat_order. Customer comment must add to table with new column which I created, it's named 'comment'

  • What have you done so far ? Aug 30, 2019 at 16:07
  • I'm stuck, I can't get data from text area which located in checkout block, and than add this comment to order in sales_flet_order(to my custom column 'comment'). Aug 30, 2019 at 16:10
  • Have you created Order Atrribute ? Aug 30, 2019 at 16:11
  • no, can you tell me more about this Order Atrribute? Aug 30, 2019 at 16:12

1 Answer 1


Step 1 : Create custom order attribute. Create a custom module and create a Mysql installer file in your module. {/app/code/local/namespace/modulename/sql/module_setup/mysql4-install-1.1.php}. Before this make sure you have added all resource model related information in etc/config.xml.

Put the content in the file.

$installer = $this;

$installer->addAttribute("order", "order_comment", array("type"=>"varchar"));
$installer->addAttribute("quote", "order_comment", array("type"=>"varchar"));

Step 2 : Create an Observer to save the details for event checkout_type_onepage_save_order.

class Namespace_Modulename_Model_Observer 
    public function saveCustomData($event)
        $quote = $event->getSession()->getQuote();
        $quote->setData('order_comment', $event->getRequestModel()->getPost('order_comment'));

        return $this;

Step 3: In your etc/config file make sure you write fiedset quote to order conversion code.



For more reference on custom EAV Order attribute please refer http://ka.lpe.sh/2013/05/10/magento-add-attribute-to-order/

Hope it finds you helpful. Thanks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.