magento 指定送货时间
一:配置config.xml
<?xml version="1.0"?>
<!--
/**
* @category More
* @package More_Deliverydate
* @author More
* @license
*/
-->
<config>
<modules>
<More_Deliverydate>
<version>0.1.8</version>
</More_Deliverydate>
</modules>
<frontend>
<routers><!--设置前台路由 当结账点击下一步的时候出发-->
<checkout>
<args>
<modules>
<More_Deliverydate before="Mage_Checkout">More_Deliverydate</More_Deliverydate>
</modules>
</args>
</checkout>
</routers>
<layout>
<updates>
<deliverydate>
<file>deliverydate.xml</file>
</deliverydate>
</updates>
</layout>
<events><!--订单保存 监听保存数据到order quote表-->
<sales_order_save_after>
<observers>
<order_set_shippingarrivaldate>
<type>model</type>
<class>More_Deliverydate_Helper_Data</class>
<method>saveShippingArrivalDate</method>
</order_set_shippingarrivaldate>
</observers>
</sales_order_save_after>
</events>
</frontend>
<admin>
<routers>
<deliverydate>
<use>admin</use>
<args>
<module>More_Deliverydate</module>
<frontName>deliverydate</frontName>
</args>
</deliverydate>
</routers>
</admin>
<adminhtml><!--添加后台导航菜单-->
<menu>
<deliverydate module="deliverydate">
<title>Deliverydate</title>
<sort_order>71</sort_order>
<children>
<items module="deliverydate">
<title>Manage Items</title>
<sort_order>0</sort_order>
<action>deliverydate/adminhtml_deliverydate</action>
</items>
</children>
</deliverydate>
</menu>
<acl><!--权限-->
<resources>
<all>
<title>Allow Everything</title>
</all>
<admin>
<children>
<More_Deliverydate>
<title>Deliverydate Module</title>
<sort_order>10</sort_order>
</More_Deliverydate>
<system>
<children>
<config>
<children>
<deliverydate>
<title>Delivery Date</title>
</deliverydate>
</children>
</config>
</children>
</system>
</children>
</admin>
</resources>
</acl>
<layout>
<updates>
<deliverydate>
<file>deliverydate.xml</file>
</deliverydate>
</updates>
</layout>
<events>
<sales_order_save_after>
<observers>
<set_order_shippingarrivaldate>
<type>model</type>
<class>More_Deliverydate_Helper_Data</class>
<method>saveShippingArrivalDateAdmin</method>
</set_order_shippingarrivaldate>
</observers>
</sales_order_save_after>
</events>
</adminhtml>
<global>
<models>
<deliverydate>
<class>More_Deliverydate_Model</class>
<resourceModel>deliverydate_mysql4</resourceModel>
</deliverydate>
<deliverydate_mysql4>
<class>More_Deliverydate_Model_Mysql4</class>
<entities>
<deliverydate>
<table>deliverydate</table>
</deliverydate>
</entities>
</deliverydate_mysql4>
<checkout>
<rewrite><!--重写type_onepage-->
<type_onepage>More_Deliverydate_Model_Type_Onepage</type_onepage>
</rewrite>
</checkout>
</models>
<resources>
<deliverydate_setup>
<setup>
<module>More_Deliverydate</module>
</setup>
<connection>
<use>core_setup</use>
</connection>
</deliverydate_setup>
<deliverydate_write>
<connection>
<use>core_write</use>
</connection>
</deliverydate_write>
<deliverydate_read>
<connection>
<use>core_read</use>
</connection>
</deliverydate_read>
</resources>
<blocks>
<deliverydate>
<class>More_Deliverydate_Block</class>
</deliverydate>
<checkout>
<rewrite>
<onepage>More_Deliverydate_Block_Onepage</onepage>
<onepage_progress>More_Deliverydate_Block_Onepage_Progress</onepage_progress>
</rewrite>
</checkout>
<deliverydateonepage>
<class>More_Deliverydate_Block_Onepage</class>
</deliverydateonepage>
<sales>
<rewrite>
<order_info>More_Deliverydate_Block_Order_Info</order_info>
</rewrite>
</sales>
</blocks>
<helpers>
<deliverydate>
<class>More_Deliverydate_Helper</class>
</deliverydate>
</helpers>
<default>
<deliverydate>
<deliverydate_general>
<enabled>0</enabled>
<on_which_page>1</on_which_page>
<deliverydate_html>Please choose your preferrable future delivery time for current #order.</deliverydate_html>
<deliverydate_format>d/M/Y</deliverydate_format>
<deliverytime_format>g:i a</deliverytime_format>
<deliverydate_dayoff></deliverydate_dayoff>
</deliverydate_general>
</deliverydate>
</default>
</global>
</config>
二:local\More\Deliverydate\sql\deliverydate_setup mysql4-install-0.1.0.php
添加送货时间和留言到sales_flat_quote sales_flat_order表
<?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();
(责任编辑:最模板) |