I want to add one new custom field to one page checkout in Magento. I have created a module with installer:
$installer = $this;
$installer->startSetup();
$set
Add an observer :
<events>
<checkout_type_onepage_save_order>
<observers>
<Savefield_observer>
<type>singleton</type>
<class>mymodule/observer</class>
<method>Savefield</method>
</Savefield_observer>
</observers>
</checkout_type_onepage_save_order>
</events>
And in the mymodule/savefield/model/obsever.php file add this:
class Mymodule_Savefield_Model_Observer
{
public function Savefield($observer){
//get event data
$event = $observer->getEvent();
//get order
$order = $event->getOrder();
//set the variable here
$order->setMyField($fieldVal);
}
}