magento custom order attribute value not saving -
i created attribute order , quote using installer script. can seen in entity_attribute table. in checkout want set value , save order. created event , observer function. value wont saving. help please.
config.xml
<sales_order_save_after> <observers> <clickandcollect_save_location_orderattributes> <type>model</type> <class>balance_clickandcollect_model_observer</class> <method>savelocationorderattributes</method> </clickandcollect_save_location_orderattributes> </observers> </sales_order_save_after>
observer.php
public function savelocationorderattributes($observer){ $event = $observer->getevent(); $order = $event->getorder(); //$quote = $event->getquote(); $order->setlocation('1'); }
can please help me solve this. cannot understand did create mistake.
thank you
i think missing save method
you must have alter observer code below
public function savelocationorderattributes($observer){ $event = $observer->getevent(); $order = $event->getorder(); //$quote = $event->getquote(); //or load order $order_id = $order->getid(); $order = mage::getmodel('sales/order')->load($order_id); $order->setlocation('1'); $order->save(); }
so save order updated value.
hope help you
magento
No comments:
Post a Comment