Hi I am using Delivery Date Extension in my website i need to add one more field on that so that i added below
data.php
public function saveShippingArrivalDate($observer){
$order = $observer->getEvent()->getOrder();
if (Mage::getStoreConfig('deliverydate/deliverydate_general/on_which_page')==2){
$desiredArrivalDate = Mage::helper('deliverydate')->getFormatedDeliveryDateToSave(Mage::app()->getRequest()->getParam('shipping_arrival_date'));
if (isset($desiredArrivalDate) && !empty($desiredArrivalDate)){
$order->setShippingArrivalComments(Mage::app()->getRequest()->getParam('shipping_arrival_comments'));
$order->setShippingArrivalDate($desiredArrivalDate);
}
}else{
$cart = Mage::getModel('checkout/cart')->getQuote()->getData();
$desiredArrivalDate = Mage::helper('deliverydate')->getFormatedDeliveryDateToSave($cart['shipping_arrival_date']);
$shipping_arrival_comments = $cart['shipping_arrival_comments'];
if (isset($desiredArrivalDate) && !empty($desiredArrivalDate)){
$order->setShippingArrivalComments($shipping_arrival_comments);
$order->setShippingArrivalTime($shipping_arrival_time);
$order->setShippingArrivalDate($desiredArrivalDate);
}
}
}
public function saveShippingArrivalDateAdmin($observer){
$order = $observer->getEvent()->getOrder();
$cart = Mage::app()->getRequest()->getParams();
$desiredArrivalDate = Mage::helper('deliverydate')->getFormatedDeliveryDateToSave($cart['shipping_arrival_date_display']);
$shipping_arrival_comments = $cart['shipping_arrival_comments'];
if (isset($desiredArrivalDate) && !empty($desiredArrivalDate)){
$order->setShippingArrivalComments($shipping_arrival_comments);
$order->setShippingArrivalTime($shipping_arrival_time);
$order->setShippingArrivalDate($desiredArrivalDate);
}
}
observer.php
class Bc_Deliverydate_Model_Observer
{
public function checkout_controller_onepage_save_shipping_method($observer)
{
if (Mage::getStoreConfig('deliverydate/deliverydate_general/on_which_page')==1){
$request = $observer->getEvent()->getRequest();
$quote = $observer->getEvent()->getQuote();
$desiredArrivalDate = Mage::helper('deliverydate')->getFormatedDeliveryDateToSave($request->getPost('shipping_arrival_date', ''));
if (isset($desiredArrivalDate) && !empty($desiredArrivalDate)){
$quote->setShippingArrivalDate($desiredArrivalDate);
$quote->setShippingArrivalComments($request->getPost('shipping_arrival_comments'));
$quote->setShippingArrivalTime($request->getPost('shipping_arrival_time'));
$quote->save();
}
}
return $this;
}
}
phtml
<dd>
<ul style="border-top: 1px solid #D1D1D1; margin-top: 12px; padding-top: 10px;">
<li>
<label for="page_date-end">Delivery Date:</label>
<input name="shipping_arrival_date_display" id="shipping_arrival_date_display" value="" title="date" class=" input-text" style="width: 100px;" type="text"> <img src="<?php echo Mage::getBaseUrl('skin')?>adminhtml/default/default/images/grid-cal.gif" alt="" class="v-middle" id="shipping_arrival_date_trig" title="Select Date" style=""> <a href="javascript:void(0)" id="link_reset" style="margin-left:5px;"><img src="<?php echo $this->getSkinUrl('images/ico_reset.png');?>" alt="" class="v-middle" title="Reset"></a>
<input name="shipping_arrival_date" id="shipping_arrival_date" value="" onChange="shippingArrivalDateOnChange(this); return false;" title="date" type="hidden">
</li>
<textarea cols="65" rows="8" name="shipping_arrival_time" id="shipping_arrival_time"></textarea>
<li>
<label for="shipping_arrival_comments">Delivery Comments:</label><br/>
<textarea cols="65" rows="8" name="shipping_arrival_comments" id="shipping_arrival_comments"></textarea></li>
<li> <i><?php echo Mage::getStoreConfig('deliverydate/deliverydate_general/deliverydate_html'); ?></i>
</li>
</dd>
sql
<?php
$installer = $this;
$installer->startSetup();
$installer->run("
-- DROP TABLE IF EXISTS {$this->getTable('deliverydate')};
CREATE TABLE {$this->getTable('deliverydate')} (
`deliverydate_id` int(11) unsigned NOT NULL auto_increment,
`title` varchar(255) NOT NULL default '',
`filename` varchar(255) NOT NULL default '',
`content` text NOT NULL default '',
`status` smallint(6) NOT NULL default '0',
`created_time` datetime NULL,
`update_time` datetime NULL,
PRIMARY KEY (`deliverydate_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
");
$this->_conn->addColumn($this->getTable('sales_flat_quote'), 'shipping_arrival_date', 'datetime');
$this->_conn->addColumn($this->getTable('sales_flat_quote'), 'shipping_arrival_comments', 'text');
$this->_conn->addColumn($this->getTable('sales_flat_order'), 'shipping_arrival_date', 'datetime');
$this->_conn->addColumn($this->getTable('sales_flat_order'), 'shipping_arrival_comments', 'text');
$installer->endSetup();
also i create field in this tables sales_flat_quote sales_flat_order
filed name is shipping_arrival_time
my problem is it's not storing in Database what is the problem also shipping_arrival_comments also not storing comments working in local system but not in a live anything i need to do on this
i am using this extension Link