I have created one module for storing custom checkout field value in sales_flat_order custom filed. the filed is created. but the value it not storing after place order. I am new in Magento.
app/code/local/Iclp/Orderattribute/etc/config.xml
<?xml version="1.0"?>
<config>
<modules>
<Iclp_Orderattribute>
<version>0.1.0</version>
</Iclp_Orderattribute>
</modules>
<global>
<helpers>
<orderattribute>
<class>Iclp_Orderattribute_Helper</class>
</orderattribute>
</helpers>
<models>
<orderattribute>
<class>Iclp_Orderattribute_Model</class>
<resourceModel>orderattribute_mysql4</resourceModel>
</orderattribute>
</models>
<resources>
<salesattribute1422420996_setup>
<setup>
<module>Iclp_Orderattribute</module>
<class>Mage_Sales_Model_Mysql4_Setup</class>
</setup>
<connection>
<use>core_setup</use>
</connection>
</salesattribute1422420996_setup>
<salesattribute1422420996_write>
<connection>
<use>core_write</use>
</connection>
</salesattribute1422420996_write>
<salesattribute1422420996_read>
<connection>
<use>core_read</use>
</connection>
</salesattribute1422420996_read>
</resources>
<events>
<checkout_type_onepage_save_order> <!-- identifier of the event we want to catch -->
<observers>
<checkout_type_onepage_save_order_handler> <!-- identifier of the event handler -->
<type>model</type> <!-- class method call type; valid are model, object and singleton -->
<class>orderattribute/observer</class> <!-- observers class alias -->
<method>getorderattribute</method> <!-- observer's method to be called -->
<args></args> <!-- additional arguments passed to observer -->
</checkout_type_onepage_save_order_handler>
</observers>
</checkout_type_onepage_save_order>
</events>
</global>
</config>
app/code/local/Iclp/Orderattribute/Model/Observer.php
<?php
class Iclp_Orderattribute_Model_Observer
{
public function getorderattribute(Varien_Event_Observer $observer)
{
$event = $observer->getEvent();
$order = $event->getOrder();
$fieldVal = Mage::app()->getFrontController()->getRequest()->getParams();
$order->setOrder_Attribute($fieldVal['order_attribute']);
//echo "<script>alert('fff');</script>" ;
}
}
sql/salesattribute1422420996_setup/mysql4-install-0.1.0.php
<?php
$installer = $this;
$installer->startSetup();
$installer->addAttribute("order", "order_attribute", array("type"=>"varchar"));
$installer->endSetup();
I think there is misconfiguration in your module.
Have you assign new attribute to qoute?