deliverytime_mc - Version 1.0.0

Version Notes

Magecheckout Checkout Delivery time

Download this release

Release Info

Developer Magecheckout
Extension deliverytime_mc
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

Files changed (27) hide show
  1. app/code/local/Magecheckout/DeliveryTime/Block/Adminhtml/System/Config/Source/Time/Range.php +19 -0
  2. app/code/local/Magecheckout/DeliveryTime/Block/Adminhtml/Totals/Order/View/Delivery.php +11 -0
  3. app/code/local/Magecheckout/DeliveryTime/Block/Checkout/Container.php +14 -0
  4. app/code/local/Magecheckout/DeliveryTime/Block/Deliverytime.php +71 -0
  5. app/code/local/Magecheckout/DeliveryTime/Helper/Data.php +62 -0
  6. app/code/local/Magecheckout/DeliveryTime/Model/Deliverytime.php +13 -0
  7. app/code/local/Magecheckout/DeliveryTime/Model/Mysql4/Deliverytime.php +9 -0
  8. app/code/local/Magecheckout/DeliveryTime/Model/Mysql4/Deliverytime/Collection.php +9 -0
  9. app/code/local/Magecheckout/DeliveryTime/Model/Observer.php +97 -0
  10. app/code/local/Magecheckout/DeliveryTime/Model/System/Config/Source/General/Format.php +12 -0
  11. app/code/local/Magecheckout/DeliveryTime/Model/System/Config/Source/General/Position.php +12 -0
  12. app/code/local/Magecheckout/DeliveryTime/controllers/IndexController.php +21 -0
  13. app/code/local/Magecheckout/DeliveryTime/etc/adminhtml.xml +41 -0
  14. app/code/local/Magecheckout/DeliveryTime/etc/config.xml +159 -0
  15. app/code/local/Magecheckout/DeliveryTime/etc/system.xml +107 -0
  16. app/code/local/Magecheckout/DeliveryTime/sql/magecheckout_deliverytime_setup/mysql4-install-0.1.0.php +26 -0
  17. app/design/adminhtml/default/default/layout/magecheckout/deliverytime.xml +10 -0
  18. app/design/adminhtml/default/default/template/magecheckout/deliverytime/totals/order/view/delivery.phtml +26 -0
  19. app/design/frontend/base/default/layout/magecheckout/deliverytime.xml +61 -0
  20. app/design/frontend/base/default/template/magecheckout/deliverytime/deliverytime.phtml +110 -0
  21. app/design/frontend/base/default/template/magecheckout/deliverytime/order/email.phtml +84 -0
  22. app/design/frontend/base/default/template/magecheckout/deliverytime/order/print.phtml +93 -0
  23. app/design/frontend/base/default/template/magecheckout/deliverytime/order/view.phtml +98 -0
  24. app/design/frontend/base/default/template/magecheckout/deliverytime/shipping/container.phtml +15 -0
  25. app/etc/modules/Magecheckout_DeliveryTime.xml +9 -0
  26. package.xml +2 -0
  27. skin/frontend/base/default/css/magecheckout/deliverytime/images/calendar.png +0 -0
app/code/local/Magecheckout/DeliveryTime/Block/Adminhtml/System/Config/Source/Time/Range.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magecheckout_DeliveryTime_Block_Adminhtml_System_Config_Source_Time_Range extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
4
+ {
5
+ public function __construct()
6
+ {
7
+ $this->addColumn('start', array(
8
+ 'label' => Mage::helper('deliverytime')->__('Time Start'),
9
+ 'style' => 'width:150px',
10
+ ));
11
+ $this->addColumn('end', array(
12
+ 'label' => Mage::helper('deliverytime')->__('Time End'),
13
+ 'style' => 'width:150px',
14
+ ));
15
+ $this->_addAfter = false;
16
+ $this->_addButtonLabel = Mage::helper('deliverytime')->__('Add Range');
17
+ parent::__construct();
18
+ }
19
+ }
app/code/local/Magecheckout/DeliveryTime/Block/Adminhtml/Totals/Order/View/Delivery.php ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magecheckout_DeliveryTime_Block_Adminhtml_Totals_Order_View_Delivery
4
+ extends Mage_Adminhtml_Block_Template
5
+ {
6
+ public function _construct()
7
+ {
8
+ parent::_construct();
9
+ $this->setTemplate('magecheckout/deliverytime/totals/order/view/delivery.phtml');
10
+ }
11
+ }
app/code/local/Magecheckout/DeliveryTime/Block/Checkout/Container.php ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magecheckout_DeliveryTime_Block_Checkout_Container extends Mage_Core_Block_Template
4
+ {
5
+ public function getPosition()
6
+ {
7
+ return Mage::helper('deliverytime')->getPoisition();
8
+ }
9
+
10
+ protected function _toHtml()
11
+ {
12
+ return parent::_toHtml();
13
+ }
14
+ }
app/code/local/Magecheckout/DeliveryTime/Block/Deliverytime.php ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magecheckout_DeliveryTime_Block_Deliverytime extends Mage_Core_Block_Template
4
+ {
5
+ public function getJsDateFormat()
6
+ {
7
+ $format = Mage::helper('deliverytime')->getDateFormat();
8
+ if ($format === 'Y-m-d') {
9
+ return 'yy-mm-dd';
10
+ } elseif ($format === 'd-m-Y') {
11
+ return 'dd-mm-yy';
12
+ }
13
+
14
+ return 'yy-mm-dd';
15
+ }
16
+
17
+ public function getShortJsDateFormat()
18
+ {
19
+ $format = Mage::helper('deliverytime')->getDateFormat();
20
+ if ($format === 'Y-m-d') {
21
+ return 'mm-dd';
22
+ } elseif ($format === 'd-m-Y') {
23
+ return 'dd-mm';
24
+ }
25
+
26
+ return 'mm-dd';
27
+ }
28
+
29
+ public function getWeekDays()
30
+ {
31
+ return Mage::helper('deliverytime')->getWeekDays();
32
+ }
33
+
34
+ public function getJsSpecifyDays()
35
+ {
36
+ $day = Mage::helper('deliverytime')->getSpecifyDays();
37
+ $array = array_map('trim', explode(',', $day));
38
+ $jsArray = json_encode($array);
39
+
40
+ return $jsArray;
41
+ }
42
+
43
+ public function getRange()
44
+ {
45
+ return Mage::helper('deliverytime')->getRange();
46
+ }
47
+
48
+ public function getRangeByKey($key)
49
+ {
50
+ $range = Mage::helper('deliverytime')->getRange();
51
+ if ($range)
52
+ return $range[$key];
53
+
54
+ return null;
55
+ }
56
+
57
+ public function getSessionData()
58
+ {
59
+ if (Mage::getSingleton('core/session')->getData('delivery_time_current_data'))
60
+ return Mage::getSingleton('core/session')->getData('delivery_time_current_data');
61
+
62
+ return null;
63
+ }
64
+
65
+ public function getRouteName()
66
+ {
67
+ $routeName = Mage::app()->getRequest()->getRouteName();
68
+
69
+ return $routeName;
70
+ }
71
+ }
app/code/local/Magecheckout/DeliveryTime/Helper/Data.php ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Magecheckout_DeliveryTime_Helper_Data extends Mage_Core_Helper_Abstract
3
+ {
4
+ const XML_PATH_ENABLED = 'deliverytime/general/is_enabled';
5
+ const XML_PATH_GENERAL_CONFIG = 'deliverytime/general/';
6
+ const XML_PATH_TIME_CONFIG = 'deliverytime/time/';
7
+
8
+
9
+ public function isEnabled($storeId = null)
10
+ {
11
+ if (!$storeId) {
12
+ $storeId = Mage::app()->getStore()->getId();
13
+ }
14
+
15
+ return Mage::getStoreConfig(self::XML_PATH_ENABLED, $storeId);
16
+ }
17
+
18
+ public function getPoisition()
19
+ {
20
+ return $this->getGeneralConfig('position');
21
+ }
22
+
23
+ public function getGeneralConfig($name, $storeId = null)
24
+ {
25
+ if (!$storeId) {
26
+ $storeId = Mage::app()->getStore()->getId();
27
+ }
28
+
29
+ return Mage::getStoreConfig(self::XML_PATH_GENERAL_CONFIG . $name, $storeId);
30
+
31
+ }
32
+
33
+ public function getDateFormat()
34
+ {
35
+ return $this->getGeneralConfig('format');
36
+ }
37
+
38
+ public function getWeekDays()
39
+ {
40
+ return $this->getTimeConfig('days');
41
+ }
42
+
43
+ public function getTimeConfig($name, $storeId = null)
44
+ {
45
+ if (!$storeId) {
46
+ $storeId = Mage::app()->getStore()->getId();
47
+ }
48
+
49
+ return Mage::getStoreConfig(self::XML_PATH_TIME_CONFIG . $name, $storeId);
50
+
51
+ }
52
+
53
+ public function getSpecifyDays()
54
+ {
55
+ return $this->getTimeConfig('holidays');
56
+ }
57
+
58
+ public function getRange()
59
+ {
60
+ return unserialize($this->getTimeConfig('range'));
61
+ }
62
+ }
app/code/local/Magecheckout/DeliveryTime/Model/Deliverytime.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magecheckout_DeliveryTime_Model_Deliverytime extends Mage_Core_Model_Abstract
4
+ {
5
+ const BEFORE_SHIPPING = 0;
6
+ const AFTER_SHIPPING = 1;
7
+
8
+ public function _construct()
9
+ {
10
+ parent::_construct();
11
+ $this->_init('deliverytime/deliverytime');
12
+ }
13
+ }
app/code/local/Magecheckout/DeliveryTime/Model/Mysql4/Deliverytime.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magecheckout_DeliveryTime_Model_Mysql4_Deliverytime extends Mage_Core_Model_Mysql4_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ $this->_init('deliverytime/deliverytime', 'deliverytime_id');
8
+ }
9
+ }
app/code/local/Magecheckout/DeliveryTime/Model/Mysql4/Deliverytime/Collection.php ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Magecheckout_DeliveryTime_Model_Mysql4_Deliverytime_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
3
+ {
4
+ public function _construct()
5
+ {
6
+ parent::_construct();
7
+ $this->_init('deliverytime/deliverytime');
8
+ }
9
+ }
app/code/local/Magecheckout/DeliveryTime/Model/Observer.php ADDED
@@ -0,0 +1,97 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magecheckout_DeliveryTime_Model_Observer
4
+ {
5
+ public function checkoutControllerOnepageSaveShippingMethod($observer)
6
+ {
7
+ $request = $observer->getEvent()->getRequest();
8
+ if (!$this->_isEnable())
9
+ return $this;
10
+ if ($request->getPost('date-picker')) {
11
+ $datePost = $request->getPost('date-picker');
12
+ $rangePost = $request->getPost('time-range');
13
+ $configRange = Mage::helper('deliverytime')->getRange();
14
+ if (!$configRange)
15
+ return $this;
16
+ $range = $configRange[$rangePost];
17
+
18
+
19
+ $data = array(
20
+ 'delivery_date' => $datePost,
21
+ 'time_start' => $range['start'],
22
+ 'time_end' => $range['end'],
23
+ );
24
+ Mage::getSingleton('checkout/session')->setData('delivery_time_data', $data);
25
+ }
26
+
27
+ return $this;
28
+ }
29
+
30
+ /**
31
+ * process controller_action_predispatch event
32
+ *
33
+ * @return Magecheckout_DeliveryTime_Model_Observer
34
+ */
35
+ protected function _isEnable()
36
+ {
37
+ return Mage::helper('deliverytime')->isEnabled();
38
+ }
39
+
40
+ public function checkoutSubmitAllAfter($observer)
41
+ {
42
+ $event = $observer->getEvent();
43
+ if (!$event)
44
+ return $this;
45
+ if (!$this->_isEnable())
46
+ return $this;
47
+ $order = $event->getOrder();
48
+ if (!Mage::getSingleton('checkout/session')->getData('delivery_time_data'))
49
+ return $this;
50
+ $deliveryData = Mage::getSingleton('checkout/session')->getData('delivery_time_data');
51
+ if (!is_array($deliveryData)) {
52
+ $deliveryData = array();
53
+ }
54
+ if (!$order || !$order->getId())
55
+ return $this;
56
+
57
+ $data = array(
58
+ 'delivery_date' => $deliveryData['delivery_date'],
59
+ 'time_start' => $deliveryData['time_start'],
60
+ 'time_end' => $deliveryData['time_end'],
61
+ 'order_id' => $order->getId()
62
+ );
63
+ $model = Mage::getModel('deliverytime/deliverytime');
64
+ $model->setData($data)->save();
65
+
66
+ }
67
+
68
+ /*
69
+ *
70
+ * Secured checkout
71
+ */
72
+ public function controllerActionLayoutLoadAfter($observer)
73
+ {
74
+ $event = $observer->getEvent();
75
+ if (!$event)
76
+ return $this;
77
+ if (!$this->_isEnable())
78
+ return $this;
79
+ $fullActionName = $event->getAction()->getFullActionName();
80
+ $layout = $event->getLayout();
81
+ if ($fullActionName === 'securedcheckout_index_index'
82
+ || $fullActionName === 'securedcheckout_checkout_saveAddressTrigger'
83
+ || $fullActionName === 'securedcheckout_checkout_ajaxCartItem'
84
+ ) {
85
+ $layout->getUpdate()->addHandle('deliverytime_osc');
86
+ }
87
+
88
+ return $this;
89
+ }
90
+
91
+ public function securedcheckoutSaveOrderSessionDataAfter($observer)
92
+ {
93
+ Mage::getSingleton('core/session')->setData('delivery_time_current_data', null);
94
+
95
+ return $this;
96
+ }
97
+ }
app/code/local/Magecheckout/DeliveryTime/Model/System/Config/Source/General/Format.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magecheckout_DeliveryTime_Model_System_Config_Source_General_Format
4
+ {
5
+ public function toOptionArray()
6
+ {
7
+ return array(
8
+ 'Y-m-d' => Mage::helper('deliverytime')->__('Year - Month - Day'),
9
+ 'd-m-Y' => Mage::helper('deliverytime')->__('Day - Month - Year'),
10
+ );
11
+ }
12
+ }
app/code/local/Magecheckout/DeliveryTime/Model/System/Config/Source/General/Position.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magecheckout_DeliveryTime_Model_System_Config_Source_General_Position
4
+ {
5
+ public function toOptionArray()
6
+ {
7
+ return array(
8
+ '0' => Mage::helper('deliverytime')->__('Before Shipping Method'),
9
+ '1' => Mage::helper('deliverytime')->__('After Shipping Method'),
10
+ );
11
+ }
12
+ }
app/code/local/Magecheckout/DeliveryTime/controllers/IndexController.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Magecheckout_DeliveryTime_IndexController extends Mage_Core_Controller_Front_Action
4
+ {
5
+ /**
6
+ * index action
7
+ */
8
+ public function saveDataAction()
9
+ {
10
+ if ($this->getRequest()->isPost()) {
11
+ $date = $this->getRequest()->getParam('date');
12
+ $range = $this->getRequest()->getParam('range');
13
+ $data = array(
14
+ 'date' => $date,
15
+ 'range' => $range,
16
+ );
17
+ Mage::getSingleton('core/session')->setData('delivery_time_current_data', $data);
18
+ }
19
+
20
+ }
21
+ }
app/code/local/Magecheckout/DeliveryTime/etc/adminhtml.xml ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+
3
+ <config>
4
+ <acl>
5
+ <resources>
6
+ <all>
7
+ <title>Allow Everything</title>
8
+ </all>
9
+ <admin>
10
+ <children>
11
+ <system>
12
+ <children>
13
+ <config>
14
+ <children>
15
+ <deliverytime module="deliverytime" translate="title">
16
+ <title>Delivery Time</title>
17
+ <sort_order>68</sort_order>
18
+ </deliverytime>
19
+ </children>
20
+ </config>
21
+ </children>
22
+ </system>
23
+ <deliverytime module="deliverytime" translate="title">
24
+ <title>DeliveryTime</title>
25
+ <sort_order>71</sort_order>
26
+ <children>
27
+ <deliverytime module="deliverytime" translate="title">
28
+ <title>Manage Items</title>
29
+ <sort_order>0</sort_order>
30
+ </deliverytime>
31
+ <settings module="deliverytime" translate="title">
32
+ <title>Settings</title>
33
+ <sort_order>1000</sort_order>
34
+ </settings>
35
+ </children>
36
+ </deliverytime>
37
+ </children>
38
+ </admin>
39
+ </resources>
40
+ </acl>
41
+ </config>
app/code/local/Magecheckout/DeliveryTime/etc/config.xml ADDED
@@ -0,0 +1,159 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+
3
+ <config>
4
+ <modules>
5
+ <Magecheckout_DeliveryTime>
6
+ <version>0.1.0</version>
7
+ </Magecheckout_DeliveryTime>
8
+ </modules>
9
+ <frontend>
10
+ <routers>
11
+ <deliverytime>
12
+ <use>standard</use>
13
+ <args>
14
+ <module>Magecheckout_DeliveryTime</module>
15
+ <frontName>deliverytime</frontName>
16
+ </args>
17
+ </deliverytime>
18
+ </routers>
19
+ <layout>
20
+ <updates>
21
+ <deliverytime>
22
+ <file>magecheckout/deliverytime.xml</file>
23
+ </deliverytime>
24
+ </updates>
25
+ </layout>
26
+ <translate>
27
+ <modules>
28
+ <Magecheckout_DeliveryTime>
29
+ <files>
30
+ <default>Magecheckout_DeliveryTime.csv</default>
31
+ </files>
32
+ </Magecheckout_DeliveryTime>
33
+ </modules>
34
+ </translate>
35
+ </frontend>
36
+ <admin>
37
+ <routers>
38
+ <deliverytimeadmin>
39
+ <use>admin</use>
40
+ <args>
41
+ <module>Magecheckout_DeliveryTime</module>
42
+ <frontName>deliverytimeadmin</frontName>
43
+ </args>
44
+ </deliverytimeadmin>
45
+ </routers>
46
+ </admin>
47
+ <adminhtml>
48
+ <layout>
49
+ <updates>
50
+ <deliverytime>
51
+ <file>magecheckout/deliverytime.xml</file>
52
+ </deliverytime>
53
+ </updates>
54
+ </layout>
55
+ <translate>
56
+ <modules>
57
+ <Magecheckout_DeliveryTime>
58
+ <files>
59
+ <default>Magecheckout_DeliveryTime.csv</default>
60
+ </files>
61
+ </Magecheckout_DeliveryTime>
62
+ </modules>
63
+ </translate>
64
+ </adminhtml>
65
+ <global>
66
+ <models>
67
+ <deliverytime>
68
+ <class>Magecheckout_DeliveryTime_Model</class>
69
+ <resourceModel>deliverytime_mysql4</resourceModel>
70
+ </deliverytime>
71
+ <deliverytime_mysql4>
72
+ <class>Magecheckout_DeliveryTime_Model_Mysql4</class>
73
+ <entities>
74
+ <deliverytime>
75
+ <table>magecheckout_deliverytime</table>
76
+ </deliverytime>
77
+ </entities>
78
+ </deliverytime_mysql4>
79
+ </models>
80
+ <resources>
81
+ <magecheckout_deliverytime_setup>
82
+ <setup>
83
+ <module>Magecheckout_DeliveryTime</module>
84
+ </setup>
85
+ <connection>
86
+ <use>core_setup</use>
87
+ </connection>
88
+ </magecheckout_deliverytime_setup>
89
+ <deliverytime_write>
90
+ <connection>
91
+ <use>core_write</use>
92
+ </connection>
93
+ </deliverytime_write>
94
+ <deliverytime_read>
95
+ <connection>
96
+ <use>core_read</use>
97
+ </connection>
98
+ </deliverytime_read>
99
+ </resources>
100
+ <blocks>
101
+ <deliverytime>
102
+ <class>Magecheckout_DeliveryTime_Block</class>
103
+ </deliverytime>
104
+ </blocks>
105
+ <helpers>
106
+ <deliverytime>
107
+ <class>Magecheckout_DeliveryTime_Helper</class>
108
+ </deliverytime>
109
+ </helpers>
110
+ <events>
111
+ <checkout_controller_onepage_save_shipping_method>
112
+ <observers>
113
+ <delivery_time_onepage_save_shipping_method>
114
+ <class>deliverytime/observer</class>
115
+ <method>checkoutControllerOnepageSaveShippingMethod</method>
116
+ </delivery_time_onepage_save_shipping_method>
117
+ </observers>
118
+ </checkout_controller_onepage_save_shipping_method>
119
+ <checkout_submit_all_after>
120
+ <observers>
121
+ <delivery_time_onepage_submit_all_after>
122
+ <type>singleton</type>
123
+ <class>deliverytime/observer</class>
124
+ <method>checkoutSubmitAllAfter</method>
125
+ </delivery_time_onepage_submit_all_after>
126
+ </observers>
127
+ </checkout_submit_all_after>
128
+ <!-- Intergrate OSC-->
129
+ <controller_action_layout_load_before>
130
+ <observers>
131
+ <delivery_time_layout_load_after>
132
+ <type>singleton</type>
133
+ <class>deliverytime/observer</class>
134
+ <method>controllerActionLayoutLoadAfter</method>
135
+ </delivery_time_layout_load_after>
136
+ </observers>
137
+ </controller_action_layout_load_before>
138
+ <securedcheckout_save_order_session_data_after>
139
+ <observers>
140
+ <delivery_time_usnset_sesion_data>
141
+ <type>singleton</type>
142
+ <class>deliverytime/observer</class>
143
+ <method>securedcheckoutSaveOrderSessionDataAfter</method>
144
+ </delivery_time_usnset_sesion_data>
145
+ </observers>
146
+ </securedcheckout_save_order_session_data_after>
147
+ </events>
148
+
149
+ </global>
150
+
151
+ <default>
152
+ <deliverytime>
153
+ <general>
154
+ <is_enabled>1</is_enabled>
155
+ </general>
156
+ </deliverytime>
157
+ </default>
158
+
159
+ </config>
app/code/local/Magecheckout/DeliveryTime/etc/system.xml ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+
3
+ <config>
4
+ <tabs>
5
+ <magecheckout translate="label">
6
+ <label>Magecheckout Extensions</label>
7
+ <sort_order>100</sort_order>
8
+ </magecheckout>
9
+ </tabs>
10
+ <sections>
11
+ <deliverytime translate="label" module="deliverytime">
12
+ <class>separator-top</class>
13
+ <label>Delivery Time</label>
14
+ <tab>magecheckout</tab>
15
+ <frontend_type>text</frontend_type>
16
+ <sort_order>299</sort_order>
17
+ <show_in_default>1</show_in_default>
18
+ <show_in_website>1</show_in_website>
19
+ <show_in_store>1</show_in_store>
20
+ <groups>
21
+ <general translate="label">
22
+ <label>General Configuration</label>
23
+ <frontend_type>text</frontend_type>
24
+ <sort_order>1</sort_order>
25
+ <show_in_default>1</show_in_default>
26
+ <show_in_website>1</show_in_website>
27
+ <show_in_store>1</show_in_store>
28
+ <fields>
29
+ <is_enabled translate="label">
30
+ <label>Enable</label>
31
+ <frontend_type>select</frontend_type>
32
+ <sort_order>1</sort_order>
33
+ <source_model>adminhtml/system_config_source_yesno</source_model>
34
+ <show_in_default>1</show_in_default>
35
+ <show_in_website>1</show_in_website>
36
+ <show_in_store>1</show_in_store>
37
+ </is_enabled>
38
+ <position translate="label">
39
+ <label>Select position to show delivery time field</label>
40
+ <frontend_type>select</frontend_type>
41
+ <sort_order>10</sort_order>
42
+ <source_model>deliverytime/system_config_source_general_position</source_model>
43
+ <show_in_default>1</show_in_default>
44
+ <show_in_website>1</show_in_website>
45
+ <show_in_store>1</show_in_store>
46
+ </position>
47
+ <format translate="label">
48
+ <label>Date Format</label>
49
+ <frontend_type>select</frontend_type>
50
+ <sort_order>20</sort_order>
51
+ <source_model>deliverytime/system_config_source_general_format</source_model>
52
+ <show_in_default>20</show_in_default>
53
+ <show_in_website>1</show_in_website>
54
+ <show_in_store>1</show_in_store>
55
+ </format>
56
+ </fields>
57
+ </general>
58
+ <time translate="label">
59
+ <label>Time Configuration</label>
60
+ <frontend_type>text</frontend_type>
61
+ <sort_order>10</sort_order>
62
+ <show_in_default>1</show_in_default>
63
+ <show_in_website>1</show_in_website>
64
+ <show_in_store>1</show_in_store>
65
+ <fields>
66
+ <days translate="label">
67
+ <label>Weekend days</label>
68
+ <frontend_type>multiselect</frontend_type>
69
+ <sort_order>1</sort_order>
70
+ <source_model>adminhtml/system_config_source_locale_weekdays</source_model>
71
+ <show_in_default>1</show_in_default>
72
+ <show_in_website>1</show_in_website>
73
+ <show_in_store>1</show_in_store>
74
+ <comment>- No delivery at these days</comment>
75
+ </days>
76
+ <holidays translate="label">
77
+ <label>National holidays</label>
78
+ <frontend_type>textarea</frontend_type>
79
+ <sort_order>10</sort_order>
80
+
81
+ <show_in_default>1</show_in_default>
82
+ <show_in_website>1</show_in_website>
83
+ <show_in_store>1</show_in_store>
84
+ <comment><![CDATA[
85
+ - Systax: <b style='color:red'>m-d</b> or <b style='color:red'>d-m</b> follow your Date Format<br>
86
+ - Separate by command ','.<br>
87
+ - No delivery at these days]]></comment>
88
+ </holidays>
89
+ <range translate="label">
90
+ <label>Time Range</label>
91
+ <frontend_model>deliverytime/adminhtml_system_config_source_time_range</frontend_model>
92
+ <backend_model>adminhtml/system_config_backend_serialized_array</backend_model>
93
+ <sort_order>20</sort_order>
94
+ <show_in_default>20</show_in_default>
95
+ <show_in_website>1</show_in_website>
96
+ <show_in_store>1</show_in_store>
97
+ <comment><![CDATA[
98
+ - Systax: <b style='color:red'>hh:mm</b><br>
99
+ - Example: Start 9:00 -> 21:00 <br>
100
+ - Time format: 24h]]></comment>
101
+ </range>
102
+ </fields>
103
+ </time>
104
+ </groups>
105
+ </deliverytime>
106
+ </sections>
107
+ </config>
app/code/local/Magecheckout/DeliveryTime/sql/magecheckout_deliverytime_setup/mysql4-install-0.1.0.php ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /** @var $installer Mage_Core_Model_Resource_Setup */
4
+ $installer = $this;
5
+
6
+ $installer->startSetup();
7
+
8
+ /**
9
+ * create deliverytime table
10
+ */
11
+ $installer->run("
12
+
13
+ DROP TABLE IF EXISTS {$installer->getTable('magecheckout_deliverytime')};
14
+ CREATE TABLE {$installer->getTable('magecheckout_deliverytime')} (
15
+ `deliverytime_id` int(11) unsigned NOT NULL auto_increment,
16
+ `delivery_date` varchar(255) NOT NULL default '',
17
+ `time_start` varchar(255) NOT NULL default '',
18
+ `time_end` varchar(255) NOT NULL default '',
19
+ `order_id` smallint(6) NOT NULL default '0',
20
+ PRIMARY KEY (`deliverytime_id`)
21
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
22
+
23
+ ");
24
+
25
+ $installer->endSetup();
26
+
app/design/adminhtml/default/default/layout/magecheckout/deliverytime.xml ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <adminhtml_sales_order_view>
4
+ <reference name="gift_options">
5
+ <action method="setTemplate">
6
+ <template>magecheckout/deliverytime/totals/order/view/delivery.phtml</template>
7
+ </action>
8
+ </reference>
9
+ </adminhtml_sales_order_view>
10
+ </layout>
app/design/adminhtml/default/default/template/magecheckout/deliverytime/totals/order/view/delivery.phtml ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $orderId = Mage::app()->getRequest()->getParam('order_id');
3
+ $delivery = Mage::getModel('deliverytime/deliverytime')->load($orderId, 'order_id');
4
+ ?>
5
+ <?php if ($delivery->getId()): ?>
6
+ <div class="entry-edit">
7
+ <div class="entry-edit-head">
8
+ <h4 class="icon-head head-shipping-method"><?php echo Mage::helper('deliverytime')->__('Delivery Time') ?></h4>
9
+ </div>
10
+ <div class="fieldset">
11
+ <table cellspacing="0" class="form-list">
12
+ <tbody>
13
+ <tr>
14
+ <td class="label"><label><?php echo Mage::helper('deliverytime')->__('Date:') ?></label></td>
15
+ <td class="value"><strong><?php echo $delivery->getDeliveryDate() ?></strong></td>
16
+ </tr>
17
+ <tr>
18
+ <td class="label"><label><?php echo Mage::helper('deliverytime')->__('Time Range:') ?></label></td>
19
+ <td class="value"><strong><?php echo $delivery->getTimeStart() . ' - ' . $delivery->getTimeEnd(); ?></strong></td>
20
+ </tr>
21
+ </tbody>
22
+ </table>
23
+ </div>
24
+ </div>
25
+ <?php endif; ?>
26
+
app/design/frontend/base/default/layout/magecheckout/deliverytime.xml ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+
3
+ <layout version="0.1.0">
4
+ <default>
5
+ <reference name="head">
6
+ <action method="addJs">
7
+ <script>magecheckout/deliverytime/jquery-ui-1.10.4.custom.min.js</script>
8
+ </action>
9
+ <!--<action method="addJs">-->
10
+ <!--<script>magecheckout/deliverytime/jquery-1.10.2.js</script>-->
11
+ <!--</action>-->
12
+ <action method="addCss">
13
+ <stylesheet>css/magecheckout/deliverytime/jquery-ui-1.10.4.custom.min.css</stylesheet>
14
+ </action>
15
+ </reference>
16
+ </default>
17
+ <!--=======/Intergrate Shipping======-->
18
+ <checkout_onepage_shippingmethod>
19
+ <block type="deliverytime/checkout_container" output="toHtml" name="checkout.shipping.container"
20
+ template="magecheckout/deliverytime/shipping/container.phtml">
21
+ <block type="deliverytime/deliverytime" name="deliverytime"
22
+ template="magecheckout/deliverytime/deliverytime.phtml"/>
23
+ </block>
24
+ </checkout_onepage_shippingmethod>
25
+
26
+ <!--=======/Intergrate OSC======-->
27
+ <deliverytime_osc>
28
+ <reference name="one.step.checkout.container.form.shipping.method.available.extra">
29
+ <block type="deliverytime/checkout_container"
30
+ name="checkout.shipping.container"
31
+ template="magecheckout/deliverytime/shipping/container.phtml"
32
+ as='checkout.shipping.container'>
33
+ <block type="deliverytime/deliverytime" name="deliverytime"
34
+ template="magecheckout/deliverytime/deliverytime.phtml"/>
35
+ </block>
36
+ </reference>
37
+ </deliverytime_osc>
38
+
39
+ <!--=============-->
40
+ <sales_order_print>
41
+ <reference name="sales.order.print">
42
+ <action method="setTemplate">
43
+ <template>magecheckout/deliverytime/order/print.phtml</template>
44
+ </action>
45
+ </reference>
46
+ </sales_order_print>
47
+ <sales_email_order_items>
48
+ <reference name="items">
49
+ <action method="setTemplate">
50
+ <template>magecheckout/deliverytime/order/email.phtml</template>
51
+ </action>
52
+ </reference>
53
+ </sales_email_order_items>
54
+ <sales_order_view>
55
+ <reference name="sales.order.info">
56
+ <action method="setTemplate">
57
+ <template>magecheckout/deliverytime/order/view.phtml</template>
58
+ </action>
59
+ </reference>
60
+ </sales_order_view>
61
+ </layout>
app/design/frontend/base/default/template/magecheckout/deliverytime/deliverytime.phtml ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $date = '';
3
+ if ($data = $this->getSessionData()) {
4
+ $date = $data['date'];
5
+ $timeRange = $data['range'];
6
+ }
7
+ ?>
8
+ <input value="<?php echo $date ?>" class="input-text" id="date-picker" name="date-picker" style="margin-bottom: 15px" readonly/>
9
+ <p><?php echo Mage::helper('deliverytime')->__('Choose the suitable delivery date'); ?></p>
10
+ <?php if ($this->getRange()): ?>
11
+
12
+ <select name="time-range" class="time-range">
13
+ <?php
14
+ $range = $this->getRange();
15
+ foreach ($range as $key => $value):?>
16
+ <?php if ($value['start'] && $value['end']): ?>
17
+ <option value="<?php echo $key; ?>"><?php echo $value['start'] . '-' . $value['end'] ?></option>
18
+ <?php endif; ?>
19
+ <?php endforeach; ?>
20
+ </select>
21
+ <?php endif; ?>
22
+ <script>
23
+ //set defalut value
24
+ $j('.time-range option[value="<?php echo (isset($timeRange) && $timeRange)?$timeRange:''?>"]').attr("selected", true);
25
+
26
+ var weeksday = [<?php echo $this->getWeekDays()?>];
27
+ var specifyday = <?php echo $this->getJsSpecifyDays()?>;
28
+ var dateToday = new Date();
29
+ $j("#date-picker").datepicker({
30
+ dateFormat: '<?php echo $this->getJsDateFormat();?>',
31
+ beforeShowDay: function (date) {
32
+ var day = date.getDay();
33
+ var datetime = $j.datepicker.formatDate('<?php echo $this->getShortJsDateFormat()?>', date);
34
+ return [($j.inArray(day, weeksday) == -1 && $j.inArray(datetime, specifyday) == -1)]
35
+ },
36
+ minDate: dateToday,
37
+ showOn: "button",
38
+ buttonImage: '<?php echo $this->getSkinUrl('css/magecheckout/deliverytime/images/calendar.png') ?>',
39
+ buttonImageOnly: true,
40
+ buttonText: '<?php echo Mage::helper('deliverytime')->__('Choose the delivery date')?>'
41
+ });
42
+ //trigger click calendar img to show datepicker
43
+ $j('#date-picker').click(function () {
44
+ $j('.ui-datepicker-trigger').trigger("click");
45
+ });
46
+
47
+
48
+ <?php if ($this->getRouteName() === 'securedcheckout'): ?>
49
+ //saveData
50
+ $j('#date-picker').change(function () {
51
+ var date = $j('#date-picker').val();
52
+ var range = $j('.time-range').val();
53
+ $j.post('<?php echo Mage::getBaseUrl().'/deliverytime/index/saveData'?>', {date: '' + date, range: '' + range});
54
+ });
55
+ $j('.time-range').change(function () {
56
+ var date = $j('#date-picker').val();
57
+ var range = $j('.time-range').val();
58
+ $j.post('<?php echo Mage::getBaseUrl().'/deliverytime/index/saveData'?>', {date: '' + date, range: '' + range});
59
+ });
60
+ <?php endif; ?>
61
+ </script>
62
+
63
+
64
+ <style>
65
+ img.ui-datepicker-trigger {
66
+ cursor: pointer;
67
+ display: inline;
68
+ position: relative;
69
+ top: 5px;
70
+ left: 8px;
71
+ }
72
+
73
+ #date-picker {
74
+ cursor: pointer;
75
+ height: 30px !important;
76
+ min-height: 0px !important;
77
+ }
78
+
79
+ #checkout-step-shipping_method .input-text.hasDatepicker {
80
+ width: 45%;
81
+ max-width: 150px;
82
+ padding: 5px 5px;
83
+ }
84
+
85
+ #checkout-step-shipping_method select.time-range {
86
+ max-width: 150px;
87
+ padding: 5px 0;
88
+ }
89
+
90
+ /*OSC Integrated*/
91
+ #one-step-checkout-shipping-method .input-text.hasDatepicker {
92
+ width: 93%;
93
+ }
94
+
95
+ #one-step-checkout-shipping-method select.time-range {
96
+ max-width: 100%;
97
+ padding: 5px 0;
98
+ }
99
+
100
+ #date-picker:hover {
101
+ border: 1px solid #3399cc;
102
+ outline-offset: -2px;
103
+ outline: -webkit-focus-ring-color auto 5px;
104
+ }
105
+
106
+
107
+
108
+
109
+ </style>
110
+
app/design/frontend/base/default/template/magecheckout/deliverytime/order/email.phtml ADDED
@@ -0,0 +1,84 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $_order = $this->getLayout()->getBlock('items')->getOrder(); ?>
2
+ <?php if ($_order): ?>
3
+ <?php
4
+ $delivery = Mage::getModel('deliverytime/deliverytime')->load($_order->getId(), 'order_id');
5
+ if ($delivery->getId()):
6
+ ?>
7
+ <h2><?php echo $this->__('Delivery Time') ?></h2>
8
+ <table cellspacing="0" class="form-list">
9
+ <tbody>
10
+ <tr>
11
+ <td class="label"><label><?php echo Mage::helper('deliverytime')->__('Date:') ?></label></td>
12
+ <td class="value"><strong><?php echo $delivery->getDeliveryDate() ?></strong></td>
13
+ </tr>
14
+ <tr>
15
+ <td class="label"><label><?php echo Mage::helper('deliverytime')->__('Time Range:') ?></label></td>
16
+ <td class="value"><strong><?php echo $delivery->getTimeStart() . ' - ' . $delivery->getTimeEnd(); ?></strong></td>
17
+ </tr>
18
+ </tbody>
19
+ </table>
20
+ <?php endif; ?>
21
+ <table cellspacing="0" cellpadding="0" border="0" width="650" style="border:1px solid #EAEAEA;">
22
+ <thead>
23
+ <tr>
24
+ <th align="left" bgcolor="#EAEAEA"
25
+ style="font-size:13px; padding:3px 9px"><?php echo $this->__('Item') ?></th>
26
+ <th align="left" bgcolor="#EAEAEA"
27
+ style="font-size:13px; padding:3px 9px"><?php echo $this->__('Sku') ?></th>
28
+ <th align="center" bgcolor="#EAEAEA"
29
+ style="font-size:13px; padding:3px 9px"><?php echo $this->__('Qty') ?></th>
30
+ <th align="right" bgcolor="#EAEAEA"
31
+ style="font-size:13px; padding:3px 9px"><?php echo $this->__('Subtotal') ?></th>
32
+ </tr>
33
+ </thead>
34
+
35
+ <?php $i = 0;
36
+ foreach ($_order->getAllItems() as $_item): ?>
37
+ <?php if ($_item->getParentItem()) continue; else $i++; ?>
38
+ <tbody<?php echo $i % 2 ? ' bgcolor="#F6F6F6"' : '' ?>>
39
+ <?php echo $this->getItemHtml($_item) ?>
40
+ </tbody>
41
+ <?php endforeach; ?>
42
+
43
+ <tbody>
44
+ <?php echo $this->getChildHtml('order_totals') ?>
45
+ </tbody>
46
+ </table>
47
+ <?php if ($this->helper('giftmessage/message')->isMessagesAvailable('order', $_order, $_order->getStore()) && $_order->getGiftMessageId()): ?>
48
+ <?php $_giftMessage = $this->helper('giftmessage/message')->getGiftMessage($_order->getGiftMessageId()); ?>
49
+ <?php if ($_giftMessage): ?>
50
+ <br/>
51
+ <table cellspacing="0" cellpadding="0" border="0" width="100%" style="border:1px solid #EAEAEA;">
52
+ <thead>
53
+ <tr>
54
+ <th align="left" bgcolor="#EAEAEA" style="font-size:13px; padding:3px 9px">
55
+ <strong><?php echo $this->__('Gift Message for this Order') ?></strong></th>
56
+ </tr>
57
+ </thead>
58
+
59
+ <tbody>
60
+
61
+ <tr>
62
+ <td colspan="4" align="left" style="padding:3px 9px">
63
+ <strong><?php echo $this->__('From:'); ?></strong> <?php echo $this->escapeHtml($_giftMessage->getSender()) ?>
64
+ <br/><strong><?php echo $this->__('To:'); ?></strong> <?php echo $this->escapeHtml($_giftMessage->getRecipient()) ?>
65
+ <br/><strong><?php echo $this->__('Message:'); ?></strong><br/> <?php echo $this->escapeHtml($_giftMessage->getMessage()) ?>
66
+ </td>
67
+ </tr>
68
+ </tbody>
69
+ </table>
70
+ <?php endif; ?>
71
+ <?php endif; ?>
72
+ <?php $_history = $_order->getVisibleStatusHistory() ?>
73
+ <?php if (count($_history)): ?>
74
+ <div class="order-additional order-comments">
75
+ <h4 class="sub-title"><?php echo $this->__('Order Comment(s)') ?></h4>
76
+ <dl class="order-about">
77
+ <?php foreach ($_history as $_historyItem): ?>
78
+ <dt><?php echo $this->formatDate($_historyItem->getCreatedAtStoreDate(), 'medium', true) ?></dt>
79
+ <dd><?php echo $this->escapeHtml($_historyItem->getComment()) ?></dd>
80
+ <?php endforeach; ?>
81
+ </dl>
82
+ </div>
83
+ <?php endif; ?>
84
+ <?php endif; ?>
app/design/frontend/base/default/template/magecheckout/deliverytime/order/print.phtml ADDED
@@ -0,0 +1,93 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ <?php $_order = $this->getOrder() ?>
3
+ <h1><?php echo $this->__('Order #%s', $_order->getRealOrderId()) ?></h1>
4
+ <p class="order-date"><?php echo $this->__('Order Date: %s', $this->formatDate($_order->getCreatedAtStoreDate(), 'long')) ?></p>
5
+ <div class="col2-set">
6
+ <?php if (!$_order->getIsVirtual()): ?>
7
+ <div class="col-1">
8
+ <h2><?php echo $this->__('Shipping Address') ?></h2>
9
+ <address><?php echo $_order->getShippingAddress()->format('html') ?></address>
10
+ </div>
11
+ <div class="col-2">
12
+ <?php else: ?>
13
+ <div class="col-1">
14
+ <?php endif; ?>
15
+ <h2><?php echo $this->__('Billing Address') ?></h2>
16
+ <address><?php echo $_order->getBillingAddress()->format('html') ?></address>
17
+ </div>
18
+ <?php if (!$_order->getIsVirtual()): ?>
19
+ </div>
20
+ <div class="col2-set">
21
+ <div class="col-1">
22
+ <h2><?php echo $this->__('Shipping Method') ?></h2>
23
+ <?php echo $this->escapeHtml($_order->getShippingDescription()) ?>
24
+ </div>
25
+
26
+ <?php endif; ?>
27
+ <div class="col-2">
28
+ <h2><?php echo $this->__('Payment Method') ?></h2>
29
+ <?php echo $this->getPaymentInfoHtml() ?>
30
+ </div>
31
+ </div>
32
+ <?php if (!$_order->getIsVirtual()):
33
+
34
+ $orderId = $_order->getId();
35
+ $delivery = Mage::getModel('deliverytime/deliverytime')->load($orderId, 'order_id');
36
+ if ($delivery) {
37
+ ?>
38
+
39
+ <div class="col2-set">
40
+ <div class="col-1">
41
+ <h2><?php echo $this->__('Delivery Time') ?></h2>
42
+ <table cellspacing="0" class="form-list">
43
+ <tbody>
44
+ <tr>
45
+ <td class="label"><label><?php echo Mage::helper('deliverytime')->__('Date:') ?></label></td>
46
+ <td class="value"><strong><?php echo $delivery->getDeliveryDate() ?></strong></td>
47
+ </tr>
48
+ <tr>
49
+ <td class="label"><label><?php echo Mage::helper('deliverytime')->__('Time Range:') ?></label></td>
50
+ <td class="value"><strong><?php echo $delivery->getTimeStart() . ' - ' . $delivery->getTimeEnd(); ?></strong></td>
51
+ </tr>
52
+ </tbody>
53
+ </table>
54
+ </div>
55
+ </div>
56
+ <?php }endif; ?>
57
+
58
+
59
+ <h2><?php echo $this->__('Items Ordered') ?></h2>
60
+ <table class="data-table" id="my-orders-table">
61
+ <col/>
62
+ <col width="1"/>
63
+ <col width="1"/>
64
+ <col width="1"/>
65
+ <col width="1"/>
66
+ <thead>
67
+ <tr>
68
+ <th><?php echo $this->__('Product Name') ?></th>
69
+ <th><?php echo $this->__('SKU') ?></th>
70
+ <th class="a-right"><?php echo $this->__('Price') ?></th>
71
+ <th class="a-center"><?php echo $this->__('Qty') ?></th>
72
+ <th class="a-right"><?php echo $this->__('Subtotal') ?></th>
73
+ </tr>
74
+ </thead>
75
+ <tfoot>
76
+ <?php echo $this->getChildHtml('order_totals') ?>
77
+ </tfoot>
78
+ <?php ?>
79
+ <?php $_items = $_order->getItemsCollection(); ?>
80
+ <?php $_count = $_items->count(); ?>
81
+ <?php foreach ($_items as $_item): ?>
82
+ <?php if ($_item->getParentItem()) continue; ?>
83
+ <tbody>
84
+ <?php echo $this->getItemHtml($_item) ?>
85
+ </tbody>
86
+ <?php endforeach; ?>
87
+ </table>
88
+ <script
89
+ type="text/javascript">decorateTable('my-orders-table', {
90
+ 'tbody': ['odd', 'even'],
91
+ 'tbody tr': ['first', 'last']
92
+ })</script>
93
+ <script type="text/javascript">window.print();</script>
app/design/frontend/base/default/template/magecheckout/deliverytime/order/view.phtml ADDED
@@ -0,0 +1,98 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ <?php /** @var $this Mage_Sales_Block_Order_Info */ ?>
3
+ <?php $_order = $this->getOrder() ?>
4
+ <?php echo $this->getMessagesBlock()->toHtml() ?>
5
+ <div class="page-title title-buttons">
6
+ <h1><?php echo $this->__('Order #%s - %s', $_order->getRealOrderId(), $_order->getStatusLabel()) ?></h1>
7
+ <?php echo $this->getChildHtml('buttons') ?>
8
+ </div>
9
+ <?php echo $this->getStatusHistoryRssUrl($_order) ?>
10
+ <dl class="order-info">
11
+ <dt><?php echo $this->__('About This Order:') ?></dt>
12
+ <dd>
13
+ <?php $_links = $this->getLinks(); ?>
14
+ <ul id="order-info-tabs">
15
+ <?php foreach ($_links as $_link): ?>
16
+ <?php if ($_link->getUrl()): ?>
17
+ <li><a href="<?php echo $_link->getUrl() ?>"><?php echo $_link->getLabel() ?></a></li>
18
+ <?php else: ?>
19
+ <li class="current"><?php echo $_link->getLabel() ?></li>
20
+ <?php endif; ?>
21
+ <?php endforeach; ?>
22
+ </ul>
23
+ <script type="text/javascript">decorateGeneric($('order-info-tabs').select('LI'), ['first', 'last']);</script>
24
+ </dd>
25
+ </dl>
26
+ <p class="order-date"><?php echo $this->__('Order Date: %s', $this->formatDate($_order->getCreatedAtStoreDate(), 'long')) ?></p>
27
+ <?php if (!$_order->getIsVirtual()): ?>
28
+ <div class="col2-set order-info-box">
29
+ <div class="col-1">
30
+ <div class="box">
31
+ <div class="box-title">
32
+ <h2><?php echo $this->__('Shipping Address') ?></h2>
33
+ </div>
34
+ <div class="box-content">
35
+ <address><?php echo $_order->getShippingAddress()->format('html') ?></address>
36
+ </div>
37
+ </div>
38
+ </div>
39
+ <div class="col-2">
40
+ <div class="box">
41
+ <div class="box-title">
42
+ <h2><?php echo $this->__('Shipping Method') ?></h2>
43
+ </div>
44
+ <div class="box-content">
45
+ <?php if ($_order->getShippingDescription()): ?>
46
+ <?php echo $this->escapeHtml($_order->getShippingDescription()) ?>
47
+ <?php else: ?>
48
+ <p><?php echo $this->helper('sales')->__('No shipping information available'); ?></p>
49
+ <?php endif; ?>
50
+ </div>
51
+ </div>
52
+ </div>
53
+ </div>
54
+ <div class="col2-set order-info-box">
55
+ <div class="col-1">
56
+ <div class="box">
57
+ <div class="box-title">
58
+ <h2><?php echo $this->__('Delivery time') ?></h2>
59
+ </div>
60
+ <div class="box-content">
61
+ <?php
62
+ $orderId = $_order->getId();
63
+ $delivery = Mage::getModel('deliverytime/deliverytime')->load($orderId, 'order_id');
64
+ if ($delivery->getId()) {
65
+ ?>
66
+ <b><?php echo Mage::helper('deliverytime')->__('Date:') ?></b>
67
+ <span><?php echo $delivery->getDeliveryDate() ?></span><br/>
68
+ <b><?php echo Mage::helper('deliverytime')->__('Time Range:') ?></b>
69
+ <span><?php echo $delivery->getTimeStart() . ' - ' . $delivery->getTimeEnd(); ?></span>
70
+ <?php } ?>
71
+ </div>
72
+ </div>
73
+ </div>
74
+
75
+ </div>
76
+ <?php endif; ?>
77
+ <div class="col2-set order-info-box">
78
+ <div class="col-1">
79
+ <div class="box">
80
+ <div class="box-title">
81
+ <h2><?php echo $this->__('Billing Address') ?></h2>
82
+ </div>
83
+ <div class="box-content">
84
+ <address><?php echo $_order->getBillingAddress()->format('html') ?></address>
85
+ </div>
86
+ </div>
87
+ </div>
88
+ <div class="col-2">
89
+ <div class="box box-payment">
90
+ <div class="box-title">
91
+ <h2><?php echo $this->__('Payment Method') ?></h2>
92
+ </div>
93
+ <div class="box-content">
94
+ <?php echo $this->getPaymentInfoHtml() ?>
95
+ </div>
96
+ </div>
97
+ </div>
98
+ </div>
app/design/frontend/base/default/template/magecheckout/deliverytime/shipping/container.phtml ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <div class="input-box delivery-time" style="margin: 20px 0px">
2
+ <div>
3
+ <fieldset id="deliverydate">
4
+ <?php echo $this->getChildHtml(); ?>
5
+ </fieldset>
6
+ </div>
7
+ </div>
8
+ <?php if ($this->getPosition() == Magecheckout_DeliveryTime_Model_Deliverytime::BEFORE_SHIPPING): ?>
9
+ <script>
10
+ $j(".delivery-time").insertBefore($j('#checkout-step-shipping_method dl.sp-methods'));
11
+
12
+ if ($j('#one-step-checkout-shipping-method dl.sp-methods'))
13
+ $j(".delivery-time").insertBefore($j('#one-step-checkout-shipping-method dl.sp-methods'));
14
+ </script>
15
+ <?php endif ?>
app/etc/modules/Magecheckout_DeliveryTime.xml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <Magecheckout_DeliveryTime>
5
+ <active>true</active>
6
+ <codePool>local</codePool>
7
+ </Magecheckout_DeliveryTime>
8
+ </modules>
9
+ </config>
package.xml ADDED
@@ -0,0 +1,2 @@
 
 
1
+ <?xml version="1.0"?>
2
+ <package><name>deliverytime_mc</name><version>1.0.0</version><stability>stable</stability><license>GNU</license><channel>community</channel><extends></extends><summary>Magecheckout Checkout Delivery time</summary><description>Magecheckout Checkout Delivery time</description><notes>Magecheckout Checkout Delivery time</notes><authors><author><name>Magecheckout</name><user>Magecheckout</user><email>magecheckoutcom@gmail.com</email></author></authors><date>2015-11-05</date><time>0:14:05</time><compatible></compatible><dependencies><required><php><min>5.2.0</min><max>7.0.0</max></php></required></dependencies><contents><target name="mage"><dir name="app"><dir name="design"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir name="magecheckout"><file name="deliverytime.xml" hash="0e646307e1d7a4e03daf541171b6f893"/></dir></dir><dir name="template"><dir name="magecheckout"><dir name="deliverytime"><file name="deliverytime.phtml" hash="9bdcd87c53596671616fa421f81946eb"/><dir name="order"><file name="email.phtml" hash="9c017e2353d40233ece01a5c1ca40ac9"/><file name="print.phtml" hash="39f2f7a623be80cb4ec1300d5339b430"/><file name="view.phtml" hash="ea364c6db3eaf1a658744861f38c62ab"/></dir><dir name="shipping"><file name="container.phtml" hash="3a495a22d0f5e9ee3be2aaa8cea1769c"/></dir></dir></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><dir name="magecheckout"><file name="deliverytime.xml" hash="e124eac41ad174eaa04f45fe3196c0bb"/></dir></dir><dir name="template"><dir name="magecheckout"><dir name="deliverytime"><dir name="totals"><dir name="order"><dir name="view"><file name="delivery.phtml" hash="0455514d94b7b95af9676e708fb632df"/></dir></dir></dir></dir></dir></dir></dir></dir></dir></dir><dir name="etc"><dir name="modules"><file name="Magecheckout_DeliveryTime.xml" hash="645483a8344a56fd27e5d57c7d32b5b9"/></dir></dir><dir name="code"><dir name="local"><dir name="Magecheckout"><dir name="DeliveryTime"><dir name="Model"><file name="Deliverytime.php" hash="645eb6d242910eca8775bd9a4efd700b"/><file name="Observer.php" hash="251d4c0137059c51badb422dfb175593"/><dir name="Mysql4"><file name="Deliverytime.php" hash="97350a02c41d741687696acbe5e73e0e"/><dir name="Deliverytime"><file name="Collection.php" hash="1ef3d8753f34e59abd7894618b30a772"/></dir></dir><dir name="System"><dir name="Config"><dir name="Source"><dir name="General"><file name="Format.php" hash="8bc3af792c297e0c31cd0b20dfc95d78"/><file name="Position.php" hash="e30bf064986de25e09f57dbc97a48bfb"/></dir></dir></dir></dir></dir><dir name="sql"><dir name="magecheckout_deliverytime_setup"><file name="mysql4-install-0.1.0.php" hash="cd6512ee03ecc9ebdfbbacda51af9f3b"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="487504bf577db11962c7a3a52660aa2b"/><file name="config.xml" hash="602d560df85f67be16431dede4228a44"/><file name="system.xml" hash="f27a9b54a53f1dee6187c2b8d3a09924"/></dir><dir name="Helper"><file name="Data.php" hash="665b3fe974b12df4882b17428834bc37"/></dir><dir name="Block"><file name="Deliverytime.php" hash="781d78447e0e2e35adfd3d79289b533a"/><dir name="Adminhtml"><dir name="Totals"><dir name="Order"><dir name="View"><file name="Delivery.php" hash="51c0b2d0d1730994e7a65df8893e4f64"/></dir></dir></dir><dir name="System"><dir name="Config"><dir name="Source"><dir name="Time"><file name="Range.php" hash="ab1c4bd20ba7ce3ed0e195940b07170b"/></dir></dir></dir></dir></dir><dir name="Checkout"><file name="Container.php" hash="84bbbf6abebe1a16ae3a92c69d932bc3"/></dir></dir><dir name="controllers"><file name="IndexController.php" hash="fd77c131c84fb9a8430f61ef99e81c38"/></dir></dir></dir></dir></dir></dir><dir name="skin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><dir name="magecheckout"><dir name="deliverytime"><dir name="images"><file name="calendar.png" hash="03acb7c034ac83fd1c7e8b4c21c2033a"/></dir></dir></dir></dir></dir></dir></dir></dir></target></contents></package>
skin/frontend/base/default/css/magecheckout/deliverytime/images/calendar.png ADDED
Binary file