order_delivery_date - Version 0.1.0

Version Notes

- Customizable checkout process to display delivery date.
- Backend configuration to manage extension

Download this release

Release Info

Developer Magento Core Team
Extension order_delivery_date
Version 0.1.0
Comparing to
See all releases


Version 0.1.0

Files changed (39) hide show
  1. app/code/local/Bc/Deliverydate/Block/Adminhtml/Deliverydate.php +12 -0
  2. app/code/local/Bc/Deliverydate/Block/Adminhtml/Deliverydate/Edit.php +45 -0
  3. app/code/local/Bc/Deliverydate/Block/Adminhtml/Deliverydate/Edit/Form.php +19 -0
  4. app/code/local/Bc/Deliverydate/Block/Adminhtml/Deliverydate/Edit/Tab/Form.php +58 -0
  5. app/code/local/Bc/Deliverydate/Block/Adminhtml/Deliverydate/Edit/Tabs.php +24 -0
  6. app/code/local/Bc/Deliverydate/Block/Adminhtml/Deliverydate/Grid.php +116 -0
  7. app/code/local/Bc/Deliverydate/Block/Deliverydate.php +21 -0
  8. app/code/local/Bc/Deliverydate/Block/Email/Info.php +6 -0
  9. app/code/local/Bc/Deliverydate/Block/Order/Info.php +135 -0
  10. app/code/local/Bc/Deliverydate/Helper/Data.php +60 -0
  11. app/code/local/Bc/Deliverydate/Model/Config/Dateformat.php +58 -0
  12. app/code/local/Bc/Deliverydate/Model/Config/Dayoff.php +80 -0
  13. app/code/local/Bc/Deliverydate/Model/Config/Option.php +52 -0
  14. app/code/local/Bc/Deliverydate/Model/Config/Timeformat.php +50 -0
  15. app/code/local/Bc/Deliverydate/Model/Deliverydate.php +20 -0
  16. app/code/local/Bc/Deliverydate/Model/Mysql4/Deliverydate.php +10 -0
  17. app/code/local/Bc/Deliverydate/Model/Mysql4/Deliverydate/Collection.php +10 -0
  18. app/code/local/Bc/Deliverydate/Model/Observer.php +28 -0
  19. app/code/local/Bc/Deliverydate/Model/Status.php +15 -0
  20. app/code/local/Bc/Deliverydate/controllers/Adminhtml/DeliverydateController.php +214 -0
  21. app/code/local/Bc/Deliverydate/controllers/IndexController.php +47 -0
  22. app/code/local/Bc/Deliverydate/etc/config.xml +177 -0
  23. app/code/local/Bc/Deliverydate/etc/config_bkp_19022013.xml +176 -0
  24. app/code/local/Bc/Deliverydate/etc/system.xml +91 -0
  25. app/code/local/Bc/Deliverydate/etc/system_bkp_19022013.xml +81 -0
  26. app/code/local/Bc/Deliverydate/sql/deliverydate_setup/mysql4-install-0.1.0.php +27 -0
  27. app/design/adminhtml/default/default/layout/deliverydate.xml +15 -0
  28. app/design/adminhtml/default/default/template/deliverydate/info.phtml +161 -0
  29. app/design/frontend/default/default/layout/deliverydate.xml +42 -0
  30. app/design/frontend/default/default/template/deliverydate/agreements.phtml +68 -0
  31. app/design/frontend/default/default/template/deliverydate/deliverydate.phtml +264 -0
  32. app/design/frontend/default/default/template/deliverydate/email/info.phtml +17 -0
  33. app/design/frontend/default/default/template/deliverydate/js/calendar.phtml +72 -0
  34. app/design/frontend/default/default/template/deliverydate/order/info.phtml +124 -0
  35. app/design/frontend/default/default/template/deliverydate/review/info.phtml +77 -0
  36. app/design/frontend/default/default/template/deliverydate/shipping_method/available.phtml +107 -0
  37. app/etc/modules/Bc_Deliverydate.xml +17 -0
  38. package.xml +23 -0
  39. skin/frontend/base/default/images/ico_reset.png +0 -0
app/code/local/Bc/Deliverydate/Block/Adminhtml/Deliverydate.php ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Bc_Deliverydate_Block_Adminhtml_Deliverydate extends Mage_Adminhtml_Block_Widget_Grid_Container
3
+ {
4
+ public function __construct()
5
+ {
6
+ $this->_controller = 'adminhtml_deliverydate';
7
+ $this->_blockGroup = 'deliverydate';
8
+ $this->_headerText = Mage::helper('deliverydate')->__('Item Manager');
9
+ $this->_addButtonLabel = Mage::helper('deliverydate')->__('Add Item');
10
+ parent::__construct();
11
+ }
12
+ }
app/code/local/Bc/Deliverydate/Block/Adminhtml/Deliverydate/Edit.php ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Bc_Deliverydate_Block_Adminhtml_Deliverydate_Edit extends Mage_Adminhtml_Block_Widget_Form_Container
4
+ {
5
+ public function __construct()
6
+ {
7
+ parent::__construct();
8
+
9
+ $this->_objectId = 'id';
10
+ $this->_blockGroup = 'deliverydate';
11
+ $this->_controller = 'adminhtml_deliverydate';
12
+
13
+ $this->_updateButton('save', 'label', Mage::helper('deliverydate')->__('Save Item'));
14
+ $this->_updateButton('delete', 'label', Mage::helper('deliverydate')->__('Delete Item'));
15
+
16
+ $this->_addButton('saveandcontinue', array(
17
+ 'label' => Mage::helper('adminhtml')->__('Save And Continue Edit'),
18
+ 'onclick' => 'saveAndContinueEdit()',
19
+ 'class' => 'save',
20
+ ), -100);
21
+
22
+ $this->_formScripts[] = "
23
+ function toggleEditor() {
24
+ if (tinyMCE.getInstanceById('deliverydate_content') == null) {
25
+ tinyMCE.execCommand('mceAddControl', false, 'deliverydate_content');
26
+ } else {
27
+ tinyMCE.execCommand('mceRemoveControl', false, 'deliverydate_content');
28
+ }
29
+ }
30
+
31
+ function saveAndContinueEdit(){
32
+ editForm.submit($('edit_form').action+'back/edit/');
33
+ }
34
+ ";
35
+ }
36
+
37
+ public function getHeaderText()
38
+ {
39
+ if( Mage::registry('deliverydate_data') && Mage::registry('deliverydate_data')->getId() ) {
40
+ return Mage::helper('deliverydate')->__("Edit Item '%s'", $this->htmlEscape(Mage::registry('deliverydate_data')->getTitle()));
41
+ } else {
42
+ return Mage::helper('deliverydate')->__('Add Item');
43
+ }
44
+ }
45
+ }
app/code/local/Bc/Deliverydate/Block/Adminhtml/Deliverydate/Edit/Form.php ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Bc_Deliverydate_Block_Adminhtml_Deliverydate_Edit_Form extends Mage_Adminhtml_Block_Widget_Form
4
+ {
5
+ protected function _prepareForm()
6
+ {
7
+ $form = new Varien_Data_Form(array(
8
+ 'id' => 'edit_form',
9
+ 'action' => $this->getUrl('*/*/save', array('id' => $this->getRequest()->getParam('id'))),
10
+ 'method' => 'post',
11
+ 'enctype' => 'multipart/form-data'
12
+ )
13
+ );
14
+
15
+ $form->setUseContainer(true);
16
+ $this->setForm($form);
17
+ return parent::_prepareForm();
18
+ }
19
+ }
app/code/local/Bc/Deliverydate/Block/Adminhtml/Deliverydate/Edit/Tab/Form.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Bc_Deliverydate_Block_Adminhtml_Deliverydate_Edit_Tab_Form extends Mage_Adminhtml_Block_Widget_Form
4
+ {
5
+ protected function _prepareForm()
6
+ {
7
+ $form = new Varien_Data_Form();
8
+ $this->setForm($form);
9
+ $fieldset = $form->addFieldset('deliverydate_form', array('legend'=>Mage::helper('deliverydate')->__('Item information')));
10
+
11
+ $fieldset->addField('title', 'text', array(
12
+ 'label' => Mage::helper('deliverydate')->__('Title'),
13
+ 'class' => 'required-entry',
14
+ 'required' => true,
15
+ 'name' => 'title',
16
+ ));
17
+
18
+ $fieldset->addField('filename', 'file', array(
19
+ 'label' => Mage::helper('deliverydate')->__('File'),
20
+ 'required' => false,
21
+ 'name' => 'filename',
22
+ ));
23
+
24
+ $fieldset->addField('status', 'select', array(
25
+ 'label' => Mage::helper('deliverydate')->__('Status'),
26
+ 'name' => 'status',
27
+ 'values' => array(
28
+ array(
29
+ 'value' => 1,
30
+ 'label' => Mage::helper('deliverydate')->__('Enabled'),
31
+ ),
32
+
33
+ array(
34
+ 'value' => 2,
35
+ 'label' => Mage::helper('deliverydate')->__('Disabled'),
36
+ ),
37
+ ),
38
+ ));
39
+
40
+ $fieldset->addField('content', 'editor', array(
41
+ 'name' => 'content',
42
+ 'label' => Mage::helper('deliverydate')->__('Content'),
43
+ 'title' => Mage::helper('deliverydate')->__('Content'),
44
+ 'style' => 'width:700px; height:500px;',
45
+ 'wysiwyg' => false,
46
+ 'required' => true,
47
+ ));
48
+
49
+ if ( Mage::getSingleton('adminhtml/session')->getDeliverydateData() )
50
+ {
51
+ $form->setValues(Mage::getSingleton('adminhtml/session')->getDeliverydateData());
52
+ Mage::getSingleton('adminhtml/session')->setDeliverydateData(null);
53
+ } elseif ( Mage::registry('deliverydate_data') ) {
54
+ $form->setValues(Mage::registry('deliverydate_data')->getData());
55
+ }
56
+ return parent::_prepareForm();
57
+ }
58
+ }
app/code/local/Bc/Deliverydate/Block/Adminhtml/Deliverydate/Edit/Tabs.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Bc_Deliverydate_Block_Adminhtml_Deliverydate_Edit_Tabs extends Mage_Adminhtml_Block_Widget_Tabs
4
+ {
5
+
6
+ public function __construct()
7
+ {
8
+ parent::__construct();
9
+ $this->setId('deliverydate_tabs');
10
+ $this->setDestElementId('edit_form');
11
+ $this->setTitle(Mage::helper('deliverydate')->__('Item Information'));
12
+ }
13
+
14
+ protected function _beforeToHtml()
15
+ {
16
+ $this->addTab('form_section', array(
17
+ 'label' => Mage::helper('deliverydate')->__('Item Information'),
18
+ 'title' => Mage::helper('deliverydate')->__('Item Information'),
19
+ 'content' => $this->getLayout()->createBlock('deliverydate/adminhtml_deliverydate_edit_tab_form')->toHtml(),
20
+ ));
21
+
22
+ return parent::_beforeToHtml();
23
+ }
24
+ }
app/code/local/Bc/Deliverydate/Block/Adminhtml/Deliverydate/Grid.php ADDED
@@ -0,0 +1,116 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Bc_Deliverydate_Block_Adminhtml_Deliverydate_Grid extends Mage_Adminhtml_Block_Widget_Grid
4
+ {
5
+ public function __construct()
6
+ {
7
+ parent::__construct();
8
+ $this->setId('deliverydateGrid');
9
+ $this->setDefaultSort('deliverydate_id');
10
+ $this->setDefaultDir('ASC');
11
+ $this->setSaveParametersInSession(true);
12
+ }
13
+
14
+ protected function _prepareCollection()
15
+ {
16
+ $collection = Mage::getModel('deliverydate/deliverydate')->getCollection();
17
+ $this->setCollection($collection);
18
+ return parent::_prepareCollection();
19
+ }
20
+
21
+ protected function _prepareColumns()
22
+ {
23
+ $this->addColumn('deliverydate_id', array(
24
+ 'header' => Mage::helper('deliverydate')->__('ID'),
25
+ 'align' =>'right',
26
+ 'width' => '50px',
27
+ 'index' => 'deliverydate_id',
28
+ ));
29
+
30
+ $this->addColumn('title', array(
31
+ 'header' => Mage::helper('deliverydate')->__('Title'),
32
+ 'align' =>'left',
33
+ 'index' => 'title',
34
+ ));
35
+
36
+ /*
37
+ $this->addColumn('content', array(
38
+ 'header' => Mage::helper('deliverydate')->__('Item Content'),
39
+ 'width' => '150px',
40
+ 'index' => 'content',
41
+ ));
42
+ */
43
+
44
+ $this->addColumn('status', array(
45
+ 'header' => Mage::helper('deliverydate')->__('Status'),
46
+ 'align' => 'left',
47
+ 'width' => '80px',
48
+ 'index' => 'status',
49
+ 'type' => 'options',
50
+ 'options' => array(
51
+ 1 => 'Enabled',
52
+ 2 => 'Disabled',
53
+ ),
54
+ ));
55
+
56
+ $this->addColumn('action',
57
+ array(
58
+ 'header' => Mage::helper('deliverydate')->__('Action'),
59
+ 'width' => '100',
60
+ 'type' => 'action',
61
+ 'getter' => 'getId',
62
+ 'actions' => array(
63
+ array(
64
+ 'caption' => Mage::helper('deliverydate')->__('Edit'),
65
+ 'url' => array('base'=> '*/*/edit'),
66
+ 'field' => 'id'
67
+ )
68
+ ),
69
+ 'filter' => false,
70
+ 'sortable' => false,
71
+ 'index' => 'stores',
72
+ 'is_system' => true,
73
+ ));
74
+
75
+ $this->addExportType('*/*/exportCsv', Mage::helper('deliverydate')->__('CSV'));
76
+ $this->addExportType('*/*/exportXml', Mage::helper('deliverydate')->__('XML'));
77
+
78
+ return parent::_prepareColumns();
79
+ }
80
+
81
+ protected function _prepareMassaction()
82
+ {
83
+ $this->setMassactionIdField('deliverydate_id');
84
+ $this->getMassactionBlock()->setFormFieldName('deliverydate');
85
+
86
+ $this->getMassactionBlock()->addItem('delete', array(
87
+ 'label' => Mage::helper('deliverydate')->__('Delete'),
88
+ 'url' => $this->getUrl('*/*/massDelete'),
89
+ 'confirm' => Mage::helper('deliverydate')->__('Are you sure?')
90
+ ));
91
+
92
+ $statuses = Mage::getSingleton('deliverydate/status')->getOptionArray();
93
+
94
+ array_unshift($statuses, array('label'=>'', 'value'=>''));
95
+ $this->getMassactionBlock()->addItem('status', array(
96
+ 'label'=> Mage::helper('deliverydate')->__('Change status'),
97
+ 'url' => $this->getUrl('*/*/massStatus', array('_current'=>true)),
98
+ 'additional' => array(
99
+ 'visibility' => array(
100
+ 'name' => 'status',
101
+ 'type' => 'select',
102
+ 'class' => 'required-entry',
103
+ 'label' => Mage::helper('deliverydate')->__('Status'),
104
+ 'values' => $statuses
105
+ )
106
+ )
107
+ ));
108
+ return $this;
109
+ }
110
+
111
+ public function getRowUrl($row)
112
+ {
113
+ return $this->getUrl('*/*/edit', array('id' => $row->getId()));
114
+ }
115
+
116
+ }
app/code/local/Bc/Deliverydate/Block/Deliverydate.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Bc_Deliverydate_Block_Deliverydate extends Mage_Core_Block_Template
3
+ {
4
+ public function _prepareLayout()
5
+ {
6
+ return parent::_prepareLayout();
7
+ }
8
+
9
+ public function getDeliverydate()
10
+ {
11
+ if (!$this->hasData('deliverydate')) {
12
+ $this->setData('deliverydate', Mage::registry('deliverydate'));
13
+ }
14
+ return $this->getData('deliverydate');
15
+
16
+ }
17
+ public function getDateFormat()
18
+ {
19
+ return Mage::app()->getLocale()->getDateStrFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT) . ' ' . Mage::app()->getLocale()->getTimeStrFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT);
20
+ }
21
+ }
app/code/local/Bc/Deliverydate/Block/Email/Info.php ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
1
+ <?php
2
+ class Bc_Deliverydate_Block_Email_Info extends Mage_Sales_Block_Items_Abstract
3
+ {
4
+
5
+ }
6
+ ?>
app/code/local/Bc/Deliverydate/Block/Order/Info.php ADDED
@@ -0,0 +1,135 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_Sales
23
+ * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+
28
+ /**
29
+ * Invoice view comments form
30
+ *
31
+ * @category Mage
32
+ * @package Mage_Sales
33
+ * @author Magento Core Team <core@magentocommerce.com>
34
+ */
35
+ class Bc_Deliverydate_Block_Order_Info extends Mage_Core_Block_Template
36
+ {
37
+ protected $_links = array();
38
+
39
+ protected function _construct()
40
+ {
41
+ parent::_construct();
42
+ if (Mage::getStoreConfig('deliverydate/deliverydate_general/enabled')){
43
+ $this->setTemplate('deliverydate/order/info.phtml');
44
+ }else{
45
+ $this->setTemplate('sales/order/info.phtml');
46
+ }
47
+ }
48
+
49
+ protected function _prepareLayout()
50
+ {
51
+ if ($headBlock = $this->getLayout()->getBlock('head')) {
52
+ $headBlock->setTitle($this->__('Order # %s', $this->getOrder()->getRealOrderId()));
53
+ }
54
+ $this->setChild(
55
+ 'payment_info',
56
+ $this->helper('payment')->getInfoBlock($this->getOrder()->getPayment())
57
+ );
58
+ }
59
+
60
+ public function getPaymentInfoHtml()
61
+ {
62
+ return $this->getChildHtml('payment_info');
63
+ }
64
+
65
+ /**
66
+ * Retrieve current order model instance
67
+ *
68
+ * @return Mage_Sales_Model_Order
69
+ */
70
+ public function getOrder()
71
+ {
72
+ return Mage::registry('current_order');
73
+ }
74
+
75
+ public function addLink($name, $path, $label)
76
+ {
77
+ $this->_links[$name] = new Varien_Object(array(
78
+ 'name' => $name,
79
+ 'label' => $label,
80
+ 'url' => empty($path) ? '' : Mage::getUrl($path, array('order_id' => $this->getOrder()->getId()))
81
+ ));
82
+ return $this;
83
+ }
84
+
85
+ public function getLinks()
86
+ {
87
+ $this->checkLinks();
88
+ return $this->_links;
89
+ }
90
+
91
+ private function checkLinks()
92
+ {
93
+ $order = $this->getOrder();
94
+ if (!$order->hasInvoices()) {
95
+ unset($this->_links['invoice']);
96
+ }
97
+ if (!$order->hasShipments()) {
98
+ unset($this->_links['shipment']);
99
+ }
100
+ if (!$order->hasCreditmemos()) {
101
+ unset($this->_links['creditmemo']);
102
+ }
103
+ }
104
+
105
+ /**
106
+ * Get url for reorder action
107
+ *
108
+ * @deprecated after 1.6.0.0, logic moved to new block
109
+ * @param Mage_Sales_Order $order
110
+ * @return string
111
+ */
112
+ public function getReorderUrl($order)
113
+ {
114
+ if (!Mage::getSingleton('customer/session')->isLoggedIn()) {
115
+ return $this->getUrl('sales/guest/reorder', array('order_id' => $order->getId()));
116
+ }
117
+ return $this->getUrl('sales/order/reorder', array('order_id' => $order->getId()));
118
+ }
119
+
120
+ /**
121
+ * Get url for printing order
122
+ *
123
+ * @deprecated after 1.6.0.0, logic moved to new block
124
+ * @param Mage_Sales_Order $order
125
+ * @return string
126
+ */
127
+ public function getPrintUrl($order)
128
+ {
129
+ if (!Mage::getSingleton('customer/session')->isLoggedIn()) {
130
+ return $this->getUrl('sales/guest/print', array('order_id' => $order->getId()));
131
+ }
132
+ return $this->getUrl('sales/order/print', array('order_id' => $order->getId()));
133
+ }
134
+
135
+ }
app/code/local/Bc/Deliverydate/Helper/Data.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Bc_Deliverydate_Helper_Data extends Mage_Core_Helper_Abstract
4
+ {
5
+ public function getFormatedDeliveryDate($date = null)
6
+ {
7
+ //if null or 0-0-0 00:00:00 return no date string
8
+ if(empty($date) ||$date == null || $date == '0000-00-00 00:00:00'){
9
+ return Mage::helper('deliverydate')->__("No Delivery Date Specified.");
10
+ }
11
+
12
+ //Format Date
13
+ $formatedDate = Mage::helper('core')->formatDate($date, 'medium');
14
+ //TODO: check that date is valid before passing it back
15
+
16
+ return $formatedDate;
17
+ }
18
+
19
+ public function getFormatedDeliveryDateToSave($date = null)
20
+ {
21
+ if(empty($date) ||$date == null || $date == '0000-00-00 00:00:00'){
22
+ return null;
23
+ }
24
+
25
+ $timestamp = null;
26
+ try{
27
+ //TODO: add Better Date Validation
28
+ $timestamp = strtotime($date);
29
+ $dateArray = explode("-", $date);
30
+ if(count($dateArray) != 3){
31
+ //invalid date
32
+ return null;
33
+ }
34
+ //die($timestamp."<<");
35
+ //$formatedDate = date('Y-m-d H:i:s', strtotime($timestamp));
36
+ //$formatedDate = date('Y-m-d H:i:s', mktime(0, 0, 0, $dateArray[0], $dateArray[1], $dateArray[2]));
37
+ $formatedDate = date('Y-m-d H:i:s',strtotime($date));
38
+ } catch(Exception $e){
39
+ //TODO: email error
40
+ //return null if not converted ok
41
+ return null;
42
+ }
43
+
44
+ return $formatedDate;
45
+ }
46
+ public function saveShippingArrivalDate($observer){
47
+ $order = $observer->getEvent()->getOrder();
48
+ if (Mage::getStoreConfig('deliverydate/deliverydate_general/on_which_page')==2){
49
+ $desiredArrivalDate = Mage::helper('deliverydate')->getFormatedDeliveryDateToSave(Mage::app()->getRequest()->getParam('shipping_arrival_date'));
50
+ $order->setShippingArrivalComments(Mage::app()->getRequest()->getParam('shipping_arrival_comments'));
51
+ $order->setShippingArrivalDate($desiredArrivalDate);
52
+ }else{
53
+ $cart = Mage::getModel('checkout/cart')->getQuote()->getData();
54
+ $desiredArrivalDate = Mage::helper('deliverydate')->getFormatedDeliveryDateToSave($cart['shipping_arrival_date']);
55
+ $shipping_arrival_comments = $cart['shipping_arrival_comments'];
56
+ $order->setShippingArrivalComments($shipping_arrival_comments);
57
+ $order->setShippingArrivalDate($desiredArrivalDate);
58
+ }
59
+ }
60
+ }
app/code/local/Bc/Deliverydate/Model/Config/Dateformat.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_Customer
23
+ * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Customer sharing config model
29
+ *
30
+ * @category Mage
31
+ * @package Mage_Customer
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class Bc_Deliverydate_Model_Config_Dateformat extends Mage_Core_Model_Config_Data
35
+ {
36
+
37
+ /**
38
+ * Get possible sharing configuration options
39
+ *
40
+ * @return array
41
+ */
42
+ public function toOptionArray()
43
+ {
44
+ return array(
45
+ 'd/M/Y' => Mage::helper('deliverydate')->__('d/M/Y'),
46
+ 'M/d/y' => Mage::helper('deliverydate')->__('M/d/y'),
47
+ 'd-M-Y' => Mage::helper('deliverydate')->__('d-M-Y'),
48
+ 'M-d-y' => Mage::helper('deliverydate')->__('M-d-y'),
49
+ 'm.d.y' => Mage::helper('deliverydate')->__('m.d.y'),
50
+ 'd.M.Y' => Mage::helper('deliverydate')->__('d.M.Y'),
51
+ 'M.d.y' => Mage::helper('deliverydate')->__('M.d.y'),
52
+ 'F j ,Y'=> Mage::helper('deliverydate')->__('F j ,Y'),
53
+ 'D M j' => Mage::helper('deliverydate')->__('D M j'),
54
+ 'Y-m-d' => Mage::helper('deliverydate')->__('Y-m-d')
55
+ );
56
+ }
57
+
58
+ }
app/code/local/Bc/Deliverydate/Model/Config/Dayoff.php ADDED
@@ -0,0 +1,80 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_Customer
23
+ * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Customer sharing config model
29
+ *
30
+ * @category Mage
31
+ * @package Mage_Customer
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class Bc_Deliverydate_Model_Config_Dayoff extends Mage_Core_Model_Config_Data
35
+ {
36
+
37
+ /**
38
+ * Get possible sharing configuration options
39
+ *
40
+ * @return array
41
+ */
42
+ public function toOptionArray()
43
+ {
44
+ $test_array[7] = array(
45
+ 'value' => '',
46
+ 'label' => Mage::helper('deliverydate')->__('No Day'),
47
+ );
48
+ $test_array[0] = array(
49
+ 'value' => 0,
50
+ 'label' => Mage::helper('deliverydate')->__('Sunday'),
51
+ );
52
+ $test_array[1] = array(
53
+ 'value' => 1,
54
+ 'label' => Mage::helper('deliverydate')->__('Monday'),
55
+ );
56
+ $test_array[2] = array(
57
+ 'value' => 2,
58
+ 'label' => Mage::helper('deliverydate')->__('Tuesday'),
59
+ );
60
+ $test_array[3] = array(
61
+ 'value' => 3,
62
+ 'label' => Mage::helper('deliverydate')->__('Wedenesday'),
63
+ );
64
+ $test_array[4] = array(
65
+ 'value' => 4,
66
+ 'label' => Mage::helper('deliverydate')->__('Thursday'),
67
+ );
68
+ $test_array[5] = array(
69
+ 'value' => 5,
70
+ 'label' => Mage::helper('deliverydate')->__('Friday'),
71
+ );
72
+ $test_array[6] = array(
73
+ 'value' => 6,
74
+ 'label' => Mage::helper('deliverydate')->__('Saturday'),
75
+ );
76
+
77
+ return $test_array;
78
+ }
79
+
80
+ }
app/code/local/Bc/Deliverydate/Model/Config/Option.php ADDED
@@ -0,0 +1,52 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_Customer
23
+ * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Customer sharing config model
29
+ *
30
+ * @category Mage
31
+ * @package Mage_Customer
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class Bc_Deliverydate_Model_Config_Option extends Mage_Core_Model_Config_Data
35
+ {
36
+ const TYPE_SHIPPING_PAGE = 1;
37
+ const TYPE_REVIEW_PAGE = 2;
38
+
39
+ /**
40
+ * Get possible sharing configuration options
41
+ *
42
+ * @return array
43
+ */
44
+ public function toOptionArray()
45
+ {
46
+ return array(
47
+ self::TYPE_SHIPPING_PAGE => Mage::helper('deliverydate')->__('Shipping Method'),
48
+ self::TYPE_REVIEW_PAGE => Mage::helper('deliverydate')->__('Review Page'),
49
+ );
50
+ }
51
+
52
+ }
app/code/local/Bc/Deliverydate/Model/Config/Timeformat.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Open Software License (OSL 3.0)
8
+ * that is bundled with this package in the file LICENSE.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/osl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category Mage
22
+ * @package Mage_Customer
23
+ * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
25
+ */
26
+
27
+ /**
28
+ * Customer sharing config model
29
+ *
30
+ * @category Mage
31
+ * @package Mage_Customer
32
+ * @author Magento Core Team <core@magentocommerce.com>
33
+ */
34
+ class Bc_Deliverydate_Model_Config_Timeformat extends Mage_Core_Model_Config_Data
35
+ {
36
+
37
+ /**
38
+ * Get possible sharing configuration options
39
+ *
40
+ * @return array
41
+ */
42
+ public function toOptionArray()
43
+ {
44
+ return array(
45
+ 'g:i a' => Mage::helper('deliverydate')->__('g:i a'),
46
+ 'H:i:s' => Mage::helper('deliverydate')->__('H:i:s')
47
+ );
48
+ }
49
+
50
+ }
app/code/local/Bc/Deliverydate/Model/Deliverydate.php ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Bc_Deliverydate_Model_Deliverydate extends Mage_Core_Model_Abstract
4
+ {
5
+ const TYPE_SHIPPING_METHOD = 1;
6
+ const TYPE_REVIEW_PAGE = 2;
7
+ public function _construct()
8
+ {
9
+ parent::_construct();
10
+ $this->_init('deliverydate/deliverydate');
11
+ }
12
+
13
+ public function toOptionArray()
14
+ {
15
+ return array(
16
+ self::TYPE_SHIPPING_METHOD => Mage::helper('adminhtml')->__('Shipping Method'),
17
+ self::TYPE_REVIEW_PAGE => Mage::helper('adminhtml')->__('Order Review Page')
18
+ );
19
+ }
20
+ }
app/code/local/Bc/Deliverydate/Model/Mysql4/Deliverydate.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Bc_Deliverydate_Model_Mysql4_Deliverydate extends Mage_Core_Model_Mysql4_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ // Note that the deliverydate_id refers to the key field in your database table.
8
+ $this->_init('deliverydate/deliverydate', 'deliverydate_id');
9
+ }
10
+ }
app/code/local/Bc/Deliverydate/Model/Mysql4/Deliverydate/Collection.php ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Bc_Deliverydate_Model_Mysql4_Deliverydate_Collection extends Mage_Core_Model_Mysql4_Collection_Abstract
4
+ {
5
+ public function _construct()
6
+ {
7
+ parent::_construct();
8
+ $this->_init('deliverydate/deliverydate');
9
+ }
10
+ }
app/code/local/Bc/Deliverydate/Model/Observer.php ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * CustomSearch Observer
4
+ *
5
+ * @category Exxex
6
+ * @package Essex_Customermod
7
+ * @author Sharpdotinc.com
8
+ */
9
+ class Bc_Deliverydate_Model_Observer
10
+ {
11
+
12
+ public function checkout_controller_onepage_save_shipping_method($observer)
13
+ {
14
+ if (Mage::getStoreConfig('deliverydate/deliverydate_general/on_which_page')==1){
15
+ $request = $observer->getEvent()->getRequest();
16
+ $quote = $observer->getEvent()->getQuote();
17
+
18
+ $desiredArrivalDate = Mage::helper('deliverydate')->getFormatedDeliveryDateToSave($request->getPost('shipping_arrival_date', ''));
19
+ $quote->setShippingArrivalDate($desiredArrivalDate);
20
+ $quote->setShippingArrivalComments($request->getPost('shipping_arrival_comments'));
21
+ $quote->save();
22
+ }
23
+
24
+ return $this;
25
+ }
26
+
27
+
28
+ }
app/code/local/Bc/Deliverydate/Model/Status.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Bc_Deliverydate_Model_Status extends Varien_Object
4
+ {
5
+ const STATUS_ENABLED = 1;
6
+ const STATUS_DISABLED = 2;
7
+
8
+ static public function getOptionArray()
9
+ {
10
+ return array(
11
+ self::STATUS_ENABLED => Mage::helper('deliverydate')->__('Enabled'),
12
+ self::STATUS_DISABLED => Mage::helper('deliverydate')->__('Disabled')
13
+ );
14
+ }
15
+ }
app/code/local/Bc/Deliverydate/controllers/Adminhtml/DeliverydateController.php ADDED
@@ -0,0 +1,214 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Bc_Deliverydate_Adminhtml_DeliverydateController extends Mage_Adminhtml_Controller_action
4
+ {
5
+
6
+ protected function _initAction() {
7
+ $this->loadLayout()
8
+ ->_setActiveMenu('deliverydate/items')
9
+ ->_addBreadcrumb(Mage::helper('adminhtml')->__('Items Manager'), Mage::helper('adminhtml')->__('Item Manager'));
10
+
11
+ return $this;
12
+ }
13
+
14
+ public function indexAction() {
15
+ $this->_initAction()
16
+ ->renderLayout();
17
+ }
18
+
19
+ public function editAction() {
20
+ $id = $this->getRequest()->getParam('id');
21
+ $model = Mage::getModel('deliverydate/deliverydate')->load($id);
22
+
23
+ if ($model->getId() || $id == 0) {
24
+ $data = Mage::getSingleton('adminhtml/session')->getFormData(true);
25
+ if (!empty($data)) {
26
+ $model->setData($data);
27
+ }
28
+
29
+ Mage::register('deliverydate_data', $model);
30
+
31
+ $this->loadLayout();
32
+ $this->_setActiveMenu('deliverydate/items');
33
+
34
+ $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item Manager'), Mage::helper('adminhtml')->__('Item Manager'));
35
+ $this->_addBreadcrumb(Mage::helper('adminhtml')->__('Item News'), Mage::helper('adminhtml')->__('Item News'));
36
+
37
+ $this->getLayout()->getBlock('head')->setCanLoadExtJs(true);
38
+
39
+ $this->_addContent($this->getLayout()->createBlock('deliverydate/adminhtml_deliverydate_edit'))
40
+ ->_addLeft($this->getLayout()->createBlock('deliverydate/adminhtml_deliverydate_edit_tabs'));
41
+
42
+ $this->renderLayout();
43
+ } else {
44
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('deliverydate')->__('Item does not exist'));
45
+ $this->_redirect('*/*/');
46
+ }
47
+ }
48
+
49
+ public function newAction() {
50
+ $this->_forward('edit');
51
+ }
52
+
53
+ public function saveAction() {
54
+ if ($data = $this->getRequest()->getPost()) {
55
+
56
+ if(isset($_FILES['filename']['name']) && $_FILES['filename']['name'] != '') {
57
+ try {
58
+ /* Starting upload */
59
+ $uploader = new Varien_File_Uploader('filename');
60
+
61
+ // Any extention would work
62
+ $uploader->setAllowedExtensions(array('jpg','jpeg','gif','png'));
63
+ $uploader->setAllowRenameFiles(false);
64
+
65
+ // Set the file upload mode
66
+ // false -> get the file directly in the specified folder
67
+ // true -> get the file in the product like folders
68
+ // (file.jpg will go in something like /media/f/i/file.jpg)
69
+ $uploader->setFilesDispersion(false);
70
+
71
+ // We set media as the upload dir
72
+ $path = Mage::getBaseDir('media') . DS ;
73
+ $uploader->save($path, $_FILES['filename']['name'] );
74
+
75
+ } catch (Exception $e) {
76
+
77
+ }
78
+
79
+ //this way the name is saved in DB
80
+ $data['filename'] = $_FILES['filename']['name'];
81
+ }
82
+
83
+
84
+ $model = Mage::getModel('deliverydate/deliverydate');
85
+ $model->setData($data)
86
+ ->setId($this->getRequest()->getParam('id'));
87
+
88
+ try {
89
+ if ($model->getCreatedTime == NULL || $model->getUpdateTime() == NULL) {
90
+ $model->setCreatedTime(now())
91
+ ->setUpdateTime(now());
92
+ } else {
93
+ $model->setUpdateTime(now());
94
+ }
95
+
96
+ $model->save();
97
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('deliverydate')->__('Item was successfully saved'));
98
+ Mage::getSingleton('adminhtml/session')->setFormData(false);
99
+
100
+ if ($this->getRequest()->getParam('back')) {
101
+ $this->_redirect('*/*/edit', array('id' => $model->getId()));
102
+ return;
103
+ }
104
+ $this->_redirect('*/*/');
105
+ return;
106
+ } catch (Exception $e) {
107
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
108
+ Mage::getSingleton('adminhtml/session')->setFormData($data);
109
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
110
+ return;
111
+ }
112
+ }
113
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('deliverydate')->__('Unable to find item to save'));
114
+ $this->_redirect('*/*/');
115
+ }
116
+
117
+ public function deleteAction() {
118
+ if( $this->getRequest()->getParam('id') > 0 ) {
119
+ try {
120
+ $model = Mage::getModel('deliverydate/deliverydate');
121
+
122
+ $model->setId($this->getRequest()->getParam('id'))
123
+ ->delete();
124
+
125
+ Mage::getSingleton('adminhtml/session')->addSuccess(Mage::helper('adminhtml')->__('Item was successfully deleted'));
126
+ $this->_redirect('*/*/');
127
+ } catch (Exception $e) {
128
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
129
+ $this->_redirect('*/*/edit', array('id' => $this->getRequest()->getParam('id')));
130
+ }
131
+ }
132
+ $this->_redirect('*/*/');
133
+ }
134
+
135
+ public function massDeleteAction() {
136
+ $deliverydateIds = $this->getRequest()->getParam('deliverydate');
137
+ if(!is_array($deliverydateIds)) {
138
+ Mage::getSingleton('adminhtml/session')->addError(Mage::helper('adminhtml')->__('Please select item(s)'));
139
+ } else {
140
+ try {
141
+ foreach ($deliverydateIds as $deliverydateId) {
142
+ $deliverydate = Mage::getModel('deliverydate/deliverydate')->load($deliverydateId);
143
+ $deliverydate->delete();
144
+ }
145
+ Mage::getSingleton('adminhtml/session')->addSuccess(
146
+ Mage::helper('adminhtml')->__(
147
+ 'Total of %d record(s) were successfully deleted', count($deliverydateIds)
148
+ )
149
+ );
150
+ } catch (Exception $e) {
151
+ Mage::getSingleton('adminhtml/session')->addError($e->getMessage());
152
+ }
153
+ }
154
+ $this->_redirect('*/*/index');
155
+ }
156
+
157
+ public function massStatusAction()
158
+ {
159
+ $deliverydateIds = $this->getRequest()->getParam('deliverydate');
160
+ if(!is_array($deliverydateIds)) {
161
+ Mage::getSingleton('adminhtml/session')->addError($this->__('Please select item(s)'));
162
+ } else {
163
+ try {
164
+ foreach ($deliverydateIds as $deliverydateId) {
165
+ $deliverydate = Mage::getSingleton('deliverydate/deliverydate')
166
+ ->load($deliverydateId)
167
+ ->setStatus($this->getRequest()->getParam('status'))
168
+ ->setIsMassupdate(true)
169
+ ->save();
170
+ }
171
+ $this->_getSession()->addSuccess(
172
+ $this->__('Total of %d record(s) were successfully updated', count($deliverydateIds))
173
+ );
174
+ } catch (Exception $e) {
175
+ $this->_getSession()->addError($e->getMessage());
176
+ }
177
+ }
178
+ $this->_redirect('*/*/index');
179
+ }
180
+
181
+ public function exportCsvAction()
182
+ {
183
+ $fileName = 'deliverydate.csv';
184
+ $content = $this->getLayout()->createBlock('deliverydate/adminhtml_deliverydate_grid')
185
+ ->getCsv();
186
+
187
+ $this->_sendUploadResponse($fileName, $content);
188
+ }
189
+
190
+ public function exportXmlAction()
191
+ {
192
+ $fileName = 'deliverydate.xml';
193
+ $content = $this->getLayout()->createBlock('deliverydate/adminhtml_deliverydate_grid')
194
+ ->getXml();
195
+
196
+ $this->_sendUploadResponse($fileName, $content);
197
+ }
198
+
199
+ protected function _sendUploadResponse($fileName, $content, $contentType='application/octet-stream')
200
+ {
201
+ $response = $this->getResponse();
202
+ $response->setHeader('HTTP/1.1 200 OK','');
203
+ $response->setHeader('Pragma', 'public', true);
204
+ $response->setHeader('Cache-Control', 'must-revalidate, post-check=0, pre-check=0', true);
205
+ $response->setHeader('Content-Disposition', 'attachment; filename='.$fileName);
206
+ $response->setHeader('Last-Modified', date('r'));
207
+ $response->setHeader('Accept-Ranges', 'bytes');
208
+ $response->setHeader('Content-Length', strlen($content));
209
+ $response->setHeader('Content-type', $contentType);
210
+ $response->setBody($content);
211
+ $response->sendResponse();
212
+ die;
213
+ }
214
+ }
app/code/local/Bc/Deliverydate/controllers/IndexController.php ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class Bc_Deliverydate_IndexController extends Mage_Core_Controller_Front_Action
3
+ {
4
+ public function indexAction()
5
+ {
6
+
7
+ /*
8
+ * Load an object by id
9
+ * Request looking like:
10
+ * http://site.com/deliverydate?id=15
11
+ * or
12
+ * http://site.com/deliverydate/id/15
13
+ */
14
+ /*
15
+ $deliverydate_id = $this->getRequest()->getParam('id');
16
+
17
+ if($deliverydate_id != null && $deliverydate_id != '') {
18
+ $deliverydate = Mage::getModel('deliverydate/deliverydate')->load($deliverydate_id)->getData();
19
+ } else {
20
+ $deliverydate = null;
21
+ }
22
+ */
23
+
24
+ /*
25
+ * If no param we load a the last created item
26
+ */
27
+ /*
28
+ if($deliverydate == null) {
29
+ $resource = Mage::getSingleton('core/resource');
30
+ $read= $resource->getConnection('core_read');
31
+ $deliverydateTable = $resource->getTableName('deliverydate');
32
+
33
+ $select = $read->select()
34
+ ->from($deliverydateTable,array('deliverydate_id','title','content','status'))
35
+ ->where('status',1)
36
+ ->order('created_time DESC') ;
37
+
38
+ $deliverydate = $read->fetchRow($select);
39
+ }
40
+ Mage::register('deliverydate', $deliverydate);
41
+ */
42
+
43
+
44
+ $this->loadLayout();
45
+ $this->renderLayout();
46
+ }
47
+ }
app/code/local/Bc/Deliverydate/etc/config.xml ADDED
@@ -0,0 +1,177 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * @category Bc
5
+ * @package Bc_Deliverydate
6
+ * @author ModuleCreator
7
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
8
+ */
9
+ -->
10
+ <config>
11
+ <modules>
12
+ <Bc_Deliverydate>
13
+ <version>0.1.0</version>
14
+ </Bc_Deliverydate>
15
+ </modules>
16
+ <frontend>
17
+ <routers>
18
+ <deliverydate>
19
+ <use>standard</use>
20
+ <args>
21
+ <module>Bc_Deliverydate</module>
22
+ <frontName>deliverydate</frontName>
23
+ </args>
24
+ </deliverydate>
25
+ </routers>
26
+ <layout>
27
+ <updates>
28
+ <deliverydate>
29
+ <file>deliverydate.xml</file>
30
+ </deliverydate>
31
+ </updates>
32
+ </layout>
33
+
34
+ <events>
35
+ <checkout_controller_onepage_save_shipping_method>
36
+ <observers>
37
+ <deliverydate_observer>
38
+ <type>singleton</type>
39
+ <class>deliverydate/observer</class>
40
+ <method>checkout_controller_onepage_save_shipping_method</method>
41
+ </deliverydate_observer>
42
+ </observers>
43
+ </checkout_controller_onepage_save_shipping_method>
44
+ <sales_order_save_before>
45
+ <observers>
46
+ <order_set_shippingarrivaldate>
47
+ <type>model</type>
48
+ <class>Bc_Deliverydate_Helper_Data</class>
49
+ <method>saveShippingArrivalDate</method>
50
+ </order_set_shippingarrivaldate>
51
+ </observers>
52
+ </sales_order_save_before>
53
+ </events>
54
+ </frontend>
55
+ <admin>
56
+ <routers>
57
+ <deliverydate>
58
+ <use>admin</use>
59
+ <args>
60
+ <module>Bc_Deliverydate</module>
61
+ <frontName>deliverydate</frontName>
62
+ </args>
63
+ </deliverydate>
64
+ </routers>
65
+ </admin>
66
+ <adminhtml>
67
+ <!--<menu>
68
+ <deliverydate module="deliverydate">
69
+ <title>Deliverydate</title>
70
+ <sort_order>71</sort_order>
71
+ <children>
72
+ <items module="deliverydate">
73
+ <title>Manage Items</title>
74
+ <sort_order>0</sort_order>
75
+ <action>deliverydate/adminhtml_deliverydate</action>
76
+ </items>
77
+ </children>
78
+ </deliverydate>
79
+ </menu>-->
80
+ <acl>
81
+ <resources>
82
+ <all>
83
+ <title>Allow Everything</title>
84
+ </all>
85
+ <admin>
86
+ <children>
87
+ <Bc_Deliverydate>
88
+ <title>Deliverydate Module</title>
89
+ <sort_order>10</sort_order>
90
+ </Bc_Deliverydate>
91
+ <system>
92
+ <children>
93
+ <config>
94
+ <children>
95
+ <deliverydate>
96
+ <title>Delivery Date</title>
97
+ </deliverydate>
98
+ </children>
99
+ </config>
100
+ </children>
101
+ </system>
102
+ </children>
103
+ </admin>
104
+ </resources>
105
+ </acl>
106
+ <layout>
107
+ <updates>
108
+ <deliverydate>
109
+ <file>deliverydate.xml</file>
110
+ </deliverydate>
111
+ </updates>
112
+ </layout>
113
+ </adminhtml>
114
+ <global>
115
+ <models>
116
+ <deliverydate>
117
+ <class>Bc_Deliverydate_Model</class>
118
+ <resourceModel>deliverydate_mysql4</resourceModel>
119
+ </deliverydate>
120
+ <deliverydate_mysql4>
121
+ <class>Bc_Deliverydate_Model_Mysql4</class>
122
+ <entities>
123
+ <deliverydate>
124
+ <table>deliverydate</table>
125
+ </deliverydate>
126
+ </entities>
127
+ </deliverydate_mysql4>
128
+ </models>
129
+ <resources>
130
+ <deliverydate_setup>
131
+ <setup>
132
+ <module>Bc_Deliverydate</module>
133
+ </setup>
134
+ <connection>
135
+ <use>core_setup</use>
136
+ </connection>
137
+ </deliverydate_setup>
138
+ <deliverydate_write>
139
+ <connection>
140
+ <use>core_write</use>
141
+ </connection>
142
+ </deliverydate_write>
143
+ <deliverydate_read>
144
+ <connection>
145
+ <use>core_read</use>
146
+ </connection>
147
+ </deliverydate_read>
148
+ </resources>
149
+ <blocks>
150
+ <deliverydate>
151
+ <class>Bc_Deliverydate_Block</class>
152
+ </deliverydate>
153
+ <sales>
154
+ <rewrite>
155
+ <order_info>Bc_Deliverydate_Block_Order_Info</order_info>
156
+ </rewrite>
157
+ </sales>
158
+ </blocks>
159
+ <helpers>
160
+ <deliverydate>
161
+ <class>Bc_Deliverydate_Helper</class>
162
+ </deliverydate>
163
+ </helpers>
164
+ <default>
165
+ <deliverydate>
166
+ <deliverydate_general>
167
+ <enabled>0</enabled>
168
+ <on_which_page>1</on_which_page>
169
+ <deliverydate_html>Please choose your preferrable future delivery time for current #order.</deliverydate_html>
170
+ <deliverydate_format>d/M/Y</deliverydate_format>
171
+ <deliverytime_format>g:i a</deliverytime_format>
172
+ <deliverydate_dayoff></deliverydate_dayoff>
173
+ </deliverydate_general>
174
+ </deliverydate>
175
+ </default>
176
+ </global>
177
+ </config>
app/code/local/Bc/Deliverydate/etc/config_bkp_19022013.xml ADDED
@@ -0,0 +1,176 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * @category Bc
5
+ * @package Bc_Deliverydate
6
+ * @author ModuleCreator
7
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
8
+ */
9
+ -->
10
+ <config>
11
+ <modules>
12
+ <Bc_Deliverydate>
13
+ <version>0.1.0</version>
14
+ </Bc_Deliverydate>
15
+ </modules>
16
+ <frontend>
17
+ <routers>
18
+ <deliverydate>
19
+ <use>standard</use>
20
+ <args>
21
+ <module>Bc_Deliverydate</module>
22
+ <frontName>deliverydate</frontName>
23
+ </args>
24
+ </deliverydate>
25
+ </routers>
26
+ <layout>
27
+ <updates>
28
+ <deliverydate>
29
+ <file>deliverydate.xml</file>
30
+ </deliverydate>
31
+ </updates>
32
+ </layout>
33
+
34
+ <events>
35
+ <checkout_controller_onepage_save_shipping_method>
36
+ <observers>
37
+ <deliverydate_observer>
38
+ <type>singleton</type>
39
+ <class>deliverydate/observer</class>
40
+ <method>checkout_controller_onepage_save_shipping_method</method>
41
+ </deliverydate_observer>
42
+ </observers>
43
+ </checkout_controller_onepage_save_shipping_method>
44
+ <sales_order_save_before>
45
+ <observers>
46
+ <order_set_shippingarrivaldate>
47
+ <type>model</type>
48
+ <class>Bc_Deliverydate_Helper_Data</class>
49
+ <method>saveShippingArrivalDate</method>
50
+ </order_set_shippingarrivaldate>
51
+ </observers>
52
+ </sales_order_save_before>
53
+ </events>
54
+ </frontend>
55
+ <admin>
56
+ <routers>
57
+ <deliverydate>
58
+ <use>admin</use>
59
+ <args>
60
+ <module>Bc_Deliverydate</module>
61
+ <frontName>deliverydate</frontName>
62
+ </args>
63
+ </deliverydate>
64
+ </routers>
65
+ </admin>
66
+ <adminhtml>
67
+ <!--<menu>
68
+ <deliverydate module="deliverydate">
69
+ <title>Deliverydate</title>
70
+ <sort_order>71</sort_order>
71
+ <children>
72
+ <items module="deliverydate">
73
+ <title>Manage Items</title>
74
+ <sort_order>0</sort_order>
75
+ <action>deliverydate/adminhtml_deliverydate</action>
76
+ </items>
77
+ </children>
78
+ </deliverydate>
79
+ </menu>-->
80
+ <acl>
81
+ <resources>
82
+ <all>
83
+ <title>Allow Everything</title>
84
+ </all>
85
+ <admin>
86
+ <children>
87
+ <Bc_Deliverydate>
88
+ <title>Deliverydate Module</title>
89
+ <sort_order>10</sort_order>
90
+ </Bc_Deliverydate>
91
+ <system>
92
+ <children>
93
+ <config>
94
+ <children>
95
+ <deliverydate>
96
+ <title>Delivery Date</title>
97
+ </deliverydate>
98
+ </children>
99
+ </config>
100
+ </children>
101
+ </system>
102
+ </children>
103
+ </admin>
104
+ </resources>
105
+ </acl>
106
+ <layout>
107
+ <updates>
108
+ <deliverydate>
109
+ <file>deliverydate.xml</file>
110
+ </deliverydate>
111
+ </updates>
112
+ </layout>
113
+ </adminhtml>
114
+ <global>
115
+ <models>
116
+ <deliverydate>
117
+ <class>Bc_Deliverydate_Model</class>
118
+ <resourceModel>deliverydate_mysql4</resourceModel>
119
+ </deliverydate>
120
+ <deliverydate_mysql4>
121
+ <class>Bc_Deliverydate_Model_Mysql4</class>
122
+ <entities>
123
+ <deliverydate>
124
+ <table>deliverydate</table>
125
+ </deliverydate>
126
+ </entities>
127
+ </deliverydate_mysql4>
128
+ </models>
129
+ <resources>
130
+ <deliverydate_setup>
131
+ <setup>
132
+ <module>Bc_Deliverydate</module>
133
+ </setup>
134
+ <connection>
135
+ <use>core_setup</use>
136
+ </connection>
137
+ </deliverydate_setup>
138
+ <deliverydate_write>
139
+ <connection>
140
+ <use>core_write</use>
141
+ </connection>
142
+ </deliverydate_write>
143
+ <deliverydate_read>
144
+ <connection>
145
+ <use>core_read</use>
146
+ </connection>
147
+ </deliverydate_read>
148
+ </resources>
149
+ <blocks>
150
+ <deliverydate>
151
+ <class>Bc_Deliverydate_Block</class>
152
+ </deliverydate>
153
+ <sales>
154
+ <rewrite>
155
+ <order_info>Bc_Deliverydate_Block_Order_Info</order_info>
156
+ </rewrite>
157
+ </sales>
158
+ </blocks>
159
+ <helpers>
160
+ <deliverydate>
161
+ <class>Bc_Deliverydate_Helper</class>
162
+ </deliverydate>
163
+ </helpers>
164
+ <default>
165
+ <deliverydate>
166
+ <deliverydate_general>
167
+ <enabled>0</enabled>
168
+ <on_which_page>1</on_which_page>
169
+ <deliverydate_html>Please choose your preferrable future delivery time for current #order.</deliverydate_html>
170
+ <deliverydate_format>d/M/Y</deliverydate_format>
171
+ <deliverydate_dayoff></deliverydate_dayoff>
172
+ </deliverydate_general>
173
+ </deliverydate>
174
+ </default>
175
+ </global>
176
+ </config>
app/code/local/Bc/Deliverydate/etc/system.xml ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <tabs>
4
+ <deliverydate translate="label" module="deliverydate">
5
+ <label>Biztech Extensions</label>
6
+ <sort_order>400</sort_order>
7
+ </deliverydate>
8
+ </tabs>
9
+ <sections>
10
+ <deliverydate translate="label" module="deliverydate">
11
+ <class>separator-top</class>
12
+ <label>Delivery Date</label>
13
+ <tab>deliverydate</tab>
14
+ <sort_order>130</sort_order>
15
+ <show_in_default>1</show_in_default>
16
+ <show_in_website>1</show_in_website>
17
+ <show_in_store>1</show_in_store>
18
+ <groups>
19
+ <deliverydate_general translate="label">
20
+ <label>General</label>
21
+ <frontend_type>text</frontend_type>
22
+ <sort_order>10</sort_order>
23
+ <show_in_default>1</show_in_default>
24
+ <show_in_website>1</show_in_website>
25
+ <show_in_store>1</show_in_store>
26
+ <fields>
27
+ <enabled translate="label">
28
+ <label>Enabled</label>
29
+ <frontend_type>select</frontend_type>
30
+ <source_model>adminhtml/system_config_source_yesno</source_model>
31
+ <sort_order>1</sort_order>
32
+ <show_in_default>1</show_in_default>
33
+ <show_in_website>1</show_in_website>
34
+ <show_in_store>1</show_in_store>
35
+ <comment>Select Yes to enable this feature.</comment>
36
+ </enabled>
37
+ <on_which_page translate="label">
38
+ <label>Display At</label>
39
+ <frontend_type>select</frontend_type>
40
+ <source_model>Bc_Deliverydate_Model_Config_Option</source_model>
41
+ <sort_order>2</sort_order>
42
+ <show_in_default>1</show_in_default>
43
+ <show_in_website>1</show_in_website>
44
+ <show_in_store>1</show_in_store>
45
+ <comment>Choose at which step delivery date should be captured.</comment>
46
+ </on_which_page>
47
+ <deliverydate_html translate="label">
48
+ <label>Design HTML</label>
49
+ <frontend_type>textarea</frontend_type>
50
+ <sort_order>3</sort_order>
51
+ <show_in_default>1</show_in_default>
52
+ <show_in_website>1</show_in_website>
53
+ <show_in_store>1</show_in_store>
54
+ <comment></comment>
55
+ </deliverydate_html>
56
+ <deliverydate_format>
57
+ <label>Date Format</label>
58
+ <frontend_type>select</frontend_type>
59
+ <source_model>Bc_Deliverydate_Model_Config_Dateformat</source_model>
60
+ <sort_order>4</sort_order>
61
+ <show_in_default>1</show_in_default>
62
+ <show_in_website>1</show_in_website>
63
+ <show_in_store>1</show_in_store>
64
+ <comment>Choose date format in which date will be displayed in frontend and admin panel.</comment>
65
+ </deliverydate_format>
66
+ <deliverytime_format>
67
+ <label>Time Format</label>
68
+ <frontend_type>select</frontend_type>
69
+ <source_model>Bc_Deliverydate_Model_Config_Timeformat</source_model>
70
+ <sort_order>4</sort_order>
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>Choose time format in which time will be displayed in frontend and admin panel.</comment>
75
+ </deliverytime_format>
76
+ <deliverydate_dayoff>
77
+ <label>Day Off</label>
78
+ <frontend_type>multiselect</frontend_type>
79
+ <source_model>Bc_Deliverydate_Model_Config_Dayoff</source_model>
80
+ <sort_order>5</sort_order>
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>Choose days on which shipping will not be available.</comment>
85
+ </deliverydate_dayoff>
86
+ </fields>
87
+ </deliverydate_general>
88
+ </groups>
89
+ </deliverydate>
90
+ </sections>
91
+ </config>
app/code/local/Bc/Deliverydate/etc/system_bkp_19022013.xml ADDED
@@ -0,0 +1,81 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <tabs>
4
+ <deliverydate translate="label" module="deliverydate">
5
+ <label>Biztech Extensions</label>
6
+ <sort_order>400</sort_order>
7
+ </deliverydate>
8
+ </tabs>
9
+ <sections>
10
+ <deliverydate translate="label" module="deliverydate">
11
+ <class>separator-top</class>
12
+ <label>Delivery Date</label>
13
+ <tab>deliverydate</tab>
14
+ <sort_order>130</sort_order>
15
+ <show_in_default>1</show_in_default>
16
+ <show_in_website>1</show_in_website>
17
+ <show_in_store>1</show_in_store>
18
+ <groups>
19
+ <deliverydate_general translate="label">
20
+ <label>General</label>
21
+ <frontend_type>text</frontend_type>
22
+ <sort_order>10</sort_order>
23
+ <show_in_default>1</show_in_default>
24
+ <show_in_website>1</show_in_website>
25
+ <show_in_store>1</show_in_store>
26
+ <fields>
27
+ <enabled translate="label">
28
+ <label>Enabled</label>
29
+ <frontend_type>select</frontend_type>
30
+ <source_model>adminhtml/system_config_source_yesno</source_model>
31
+ <sort_order>1</sort_order>
32
+ <show_in_default>1</show_in_default>
33
+ <show_in_website>1</show_in_website>
34
+ <show_in_store>1</show_in_store>
35
+ <comment>Select Yes to enable this feature.</comment>
36
+ </enabled>
37
+ <on_which_page translate="label">
38
+ <label>Display At</label>
39
+ <frontend_type>select</frontend_type>
40
+ <source_model>Bc_Deliverydate_Model_Config_Option</source_model>
41
+ <sort_order>2</sort_order>
42
+ <show_in_default>1</show_in_default>
43
+ <show_in_website>1</show_in_website>
44
+ <show_in_store>1</show_in_store>
45
+ <comment>Choose at which step delivery date should be captured.</comment>
46
+ </on_which_page>
47
+ <deliverydate_html translate="label">
48
+ <label>Design HTML</label>
49
+ <frontend_type>textarea</frontend_type>
50
+ <sort_order>3</sort_order>
51
+ <show_in_default>1</show_in_default>
52
+ <show_in_website>1</show_in_website>
53
+ <show_in_store>1</show_in_store>
54
+ <comment></comment>
55
+ </deliverydate_html>
56
+ <deliverydate_format>
57
+ <label>Date Format</label>
58
+ <frontend_type>select</frontend_type>
59
+ <source_model>Bc_Deliverydate_Model_Config_Format</source_model>
60
+ <sort_order>4</sort_order>
61
+ <show_in_default>1</show_in_default>
62
+ <show_in_website>1</show_in_website>
63
+ <show_in_store>1</show_in_store>
64
+ <comment>Choose date format in which date will be displayed in frontend and admin panel.</comment>
65
+ </deliverydate_format>
66
+ <deliverydate_dayoff>
67
+ <label>Day Off</label>
68
+ <frontend_type>multiselect</frontend_type>
69
+ <source_model>Bc_Deliverydate_Model_Config_Dayoff</source_model>
70
+ <sort_order>5</sort_order>
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>Choose days on which shipping will not be available.</comment>
75
+ </deliverydate_dayoff>
76
+ </fields>
77
+ </deliverydate_general>
78
+ </groups>
79
+ </deliverydate>
80
+ </sections>
81
+ </config>
app/code/local/Bc/Deliverydate/sql/deliverydate_setup/mysql4-install-0.1.0.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $installer = $this;
3
+
4
+ $installer->startSetup();
5
+
6
+ $installer->run("
7
+
8
+ -- DROP TABLE IF EXISTS {$this->getTable('deliverydate')};
9
+ CREATE TABLE {$this->getTable('deliverydate')} (
10
+ `deliverydate_id` int(11) unsigned NOT NULL auto_increment,
11
+ `title` varchar(255) NOT NULL default '',
12
+ `filename` varchar(255) NOT NULL default '',
13
+ `content` text NOT NULL default '',
14
+ `status` smallint(6) NOT NULL default '0',
15
+ `created_time` datetime NULL,
16
+ `update_time` datetime NULL,
17
+ PRIMARY KEY (`deliverydate_id`)
18
+ ) ENGINE=InnoDB DEFAULT CHARSET=utf8;
19
+
20
+ ");
21
+
22
+ $this->_conn->addColumn($this->getTable('sales_flat_quote'), 'shipping_arrival_date', 'datetime');
23
+ $this->_conn->addColumn($this->getTable('sales_flat_quote'), 'shipping_arrival_comments', 'text');
24
+ $this->_conn->addColumn($this->getTable('sales_flat_order'), 'shipping_arrival_date', 'datetime');
25
+ $this->_conn->addColumn($this->getTable('sales_flat_order'), 'shipping_arrival_comments', 'text');
26
+
27
+ $installer->endSetup();
app/design/adminhtml/default/default/layout/deliverydate.xml ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <deliverydate_adminhtml_deliverydate_index>
4
+ <reference name="content">
5
+ <block type="deliverydate/adminhtml_deliverydate" name="deliverydate" />
6
+ </reference>
7
+ </deliverydate_adminhtml_deliverydate_index>
8
+ <adminhtml_sales_order_view>
9
+ <reference name="order_tab_info">
10
+ <action method="setTemplate" ifconfig="deliverydate/deliverydate_general/enabled">
11
+ <template>deliverydate/info.phtml</template>
12
+ </action>
13
+ </reference>
14
+ </adminhtml_sales_order_view>
15
+ </layout>
app/design/adminhtml/default/default/template/deliverydate/info.phtml ADDED
@@ -0,0 +1,161 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category design
22
+ * @package default_default
23
+ * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <?php /** @var $this Mage_Adminhtml_Block_Sales_Order_View_Tab_Info */ ?>
28
+ <?php $_order = $this->getOrder() ?>
29
+ <div>
30
+ <div id="order-messages">
31
+ <?php echo $this->getChildHtml('order_messages') ?>
32
+ </div>
33
+ <?php echo $this->getChildHtml('order_info') ?>
34
+ <input type="hidden" name="order_id" value="<?php echo $_order->getId() ?>"/>
35
+ <?php if ($_order->getIsVirtual()): ?>
36
+ <div class="box-right">
37
+ <?php else: ?>
38
+ <div class="box-left">
39
+ <?php endif; ?>
40
+ <!--Payment Method-->
41
+ <div class="entry-edit">
42
+ <div class="entry-edit-head">
43
+ <h4 class="icon-head head-payment-method"><?php echo Mage::helper('sales')->__('Payment Information') ?></h4>
44
+ </div>
45
+ <fieldset>
46
+ <?php echo $this->getPaymentHtml() ?>
47
+ <div><?php echo Mage::helper('sales')->__('Order was placed using %s', $_order->getOrderCurrencyCode()) ?></div>
48
+ </fieldset>
49
+ </div>
50
+ </div>
51
+ <?php if (!$_order->getIsVirtual()): ?>
52
+ <div class="box-right">
53
+ <!--Shipping Method-->
54
+ <div class="entry-edit">
55
+ <div class="entry-edit-head">
56
+ <h4 class="icon-head head-shipping-method"><?php echo Mage::helper('sales')->__('Shipping &amp; Handling Information') ?></h4>
57
+ </div>
58
+ <fieldset>
59
+ <?php if ($_order->getTracksCollection()->count()) : ?>
60
+ <a href="#" id="linkId" onclick="popWin('<?php echo $this->helper('shipping')->getTrackingPopupUrlBySalesModel($_order) ?>','trackorder','width=800,height=600,resizable=yes,scrollbars=yes')" title="<?php echo $this->__('Track Order') ?>"><?php echo $this->__('Track Order') ?></a>
61
+ <br/>
62
+ <?php endif; ?>
63
+ <?php if ($_order->getShippingDescription()): ?>
64
+ <strong><?php echo $this->escapeHtml($_order->getShippingDescription()) ?></strong>
65
+
66
+ <?php if ($this->helper('tax')->displayShippingPriceIncludingTax()): ?>
67
+ <?php $_excl = $this->displayShippingPriceInclTax($_order); ?>
68
+ <?php else: ?>
69
+ <?php $_excl = $this->displayPriceAttribute('shipping_amount', false, ' '); ?>
70
+ <?php endif; ?>
71
+ <?php $_incl = $this->displayShippingPriceInclTax($_order); ?>
72
+
73
+ <?php echo $_excl; ?>
74
+ <?php if ($this->helper('tax')->displayShippingBothPrices() && $_incl != $_excl): ?>
75
+ (<?php echo $this->__('Incl. Tax'); ?> <?php echo $_incl; ?>)
76
+ <?php endif; ?>
77
+ <?php else: ?>
78
+ <?php echo $this->helper('sales')->__('No shipping information available'); ?>
79
+ <?php endif; ?>
80
+ </fieldset>
81
+ </div>
82
+ </div>
83
+ <?php endif; ?>
84
+
85
+ <div class="clear"></div>
86
+ <div class="entry-edit">
87
+ <div class="entry-edit-head">
88
+ <h4 class="icon-head head-products"><?php echo Mage::helper('sales')->__('Delivery Date Information') ?></h4>
89
+ </div>
90
+ </div>
91
+ <div class="grid np">
92
+ <fieldset>
93
+ <?php
94
+ $date_format = Mage::getStoreConfig('deliverydate/deliverydate_general/deliverydate_format');
95
+ $time_format = Mage::getStoreConfig('deliverydate/deliverydate_general/deliverytime_format');
96
+ if ($date_format=='')
97
+ $date_format='d/M/Y';
98
+ if($time_format=='')
99
+ $date_format.=" ,g:i a";
100
+ else
101
+ $date_format.=" ".$time_format;
102
+ if ($_order->getShippingArrivalDate()!='')
103
+ echo "<strong>Shipping Arrival Date :- </strong>".$currentDate = date ($date_format,strtotime($_order->getShippingArrivalDate()));
104
+ else
105
+ echo "<strong>Shipping Arrival Date :- </strong> N/A";
106
+ if ($_order->getShippingArrivalComments()!='')
107
+ echo "<br/>".$_order->getShippingArrivalComments();
108
+ ?>
109
+ </fieldset>
110
+ </div>
111
+ <?php echo $this->getGiftOptionsHtml() ?>
112
+ <div class="clear"></div>
113
+ <div class="entry-edit">
114
+ <div class="entry-edit-head">
115
+ <h4 class="icon-head head-products"><?php echo Mage::helper('sales')->__('Items Ordered') ?></h4>
116
+ </div>
117
+ </div>
118
+ <?php echo $this->getItemsHtml() ?>
119
+ <div class="clear"></div>
120
+
121
+ <div class="box-left">
122
+ <div class="entry-edit">
123
+ <div class="entry-edit-head">
124
+ <h4><?php echo Mage::helper('sales')->__('Comments History') ?></h4>
125
+ </div>
126
+ <fieldset><?php echo $this->getChildHtml('order_history') ?></fieldset>
127
+ </div>
128
+ </div>
129
+ <div class="box-right entry-edit">
130
+ <div class="entry-edit-head"><h4><?php echo Mage::helper('sales')->__('Order Totals') ?></h4></div>
131
+ <div class="order-totals"><?php echo $this->getChildHtml('order_totals') ?></div>
132
+ </div>
133
+ <div class="clear"></div>
134
+ </div>
135
+
136
+ <?php echo $this->getChildHtml('popup_window');?>
137
+ <script type="text/javascript">
138
+ //<![CDATA[
139
+ /**
140
+ * Retrieve gift options tooltip content
141
+ */
142
+ function getGiftOptionsTooltipContent(itemId) {
143
+ var contentLines = [];
144
+ var headerLine = null;
145
+ var contentLine = null;
146
+
147
+ $$('#gift_options_data_' + itemId + ' .gift-options-tooltip-content').each(function (element) {
148
+ if (element.down(0)) {
149
+ headerLine = element.down(0).innerHTML;
150
+ contentLine = element.down(0).next().innerHTML;
151
+ if (contentLine.length > 30) {
152
+ contentLine = contentLine.slice(0,30) + '...';
153
+ }
154
+ contentLines.push(headerLine + ' ' + contentLine);
155
+ }
156
+ });
157
+ return contentLines.join('<br/>');
158
+ }
159
+ giftOptionsTooltip.setTooltipContentLoaderFunction(getGiftOptionsTooltipContent);
160
+ //]]>
161
+ </script>
app/design/frontend/default/default/layout/deliverydate.xml ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <layout version="0.1.0">
3
+ <default>
4
+ </default>
5
+ <deliverydate_index_index>
6
+ <reference name="content">
7
+ <block type="deliverydate/deliverydate" name="deliverydate" template="deliverydate/deliverydate.phtml" />
8
+ </reference>
9
+ </deliverydate_index_index>
10
+
11
+ <checkout_onepage_index>
12
+ <reference name="head">
13
+ <action method="addItem"><type>js_css</type><name>calendar/calendar-win2k-1.css</name><params/><!--<if/><condition>can_load_calendar_js</condition>--></action>
14
+ <action method="addItem"><type>js</type><name>calendar/calendar.js</name><!--<params/><if/><condition>can_load_calendar_js</condition>--></action>
15
+ <action method="addItem"><type>js</type><name>calendar/calendar-setup.js</name><!--<params/><if/><condition>can_load_calendar_js</condition>--></action>
16
+ </reference>
17
+ </checkout_onepage_index>
18
+
19
+
20
+ <checkout_onepage_shippingmethod>
21
+ <reference name="root">
22
+ <block type="core/html_calendar" name="head.calendar" as="calendar" output="toHtml" template="deliverydate/js/calendar.phtml"/>
23
+ <action method="setTemplate" ifconfig="deliverydate/deliverydate_general/enabled">
24
+ <template>deliverydate/shipping_method/available.phtml</template>
25
+ </action>
26
+ </reference>
27
+ </checkout_onepage_shippingmethod>
28
+
29
+ <checkout_onepage_review>
30
+ <reference name="root">
31
+ <action method="setTemplate" ifconfig="deliverydate/deliverydate_general/enabled"><template>deliverydate/review/info.phtml</template></action>
32
+ <block type="checkout/agreements" name="checkout.onepage.agreements" as="agreements">
33
+ <action method="setTemplate" ifconfig="deliverydate/deliverydate_general/enabled">
34
+ <template>deliverydate/agreements.phtml</template>
35
+ </action>
36
+ </block>
37
+ </reference>
38
+ </checkout_onepage_review>
39
+ <deliverydate_email_information>
40
+ <block type="deliverydate/email_info" name="deliverydate_email_info" template="deliverydate/email/info.phtml"/>
41
+ </deliverydate_email_information>
42
+ </layout>
app/design/frontend/default/default/template/deliverydate/agreements.phtml ADDED
@@ -0,0 +1,68 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category design
22
+ * @package base_default
23
+ * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <?php
28
+ /**
29
+ * @see Mage_Checkout_Block_Agreements
30
+ */
31
+ ?>
32
+ <style type="text/css">
33
+ .arrival-info ul{ border:none !important; padding:0 !important; margin:0 !important;}
34
+ .arrival-info li{ margin-bottom:10px; text-align:left; }
35
+ .arrival-info label{ font-weight:bold; color:#666666;}
36
+ </style>
37
+ <form action="" id="checkout-agreements" onsubmit="return false;">
38
+ <div class="buttons-set arrival-info">
39
+ <?php
40
+ if (Mage::getStoreConfig('deliverydate/deliverydate_general/on_which_page')==2){
41
+ echo $this->getLayout()->createBlock('core/html_calendar')->setTemplate('deliverydate/js/calendar.phtml')->toHtml() ;
42
+ echo $this->getLayout()->createBlock('deliverydate/deliverydate')->setTemplate('deliverydate/deliverydate.phtml')->toHtml();
43
+ }
44
+ ?>
45
+ </div>
46
+
47
+ <?php if (!$this->getAgreements()) return; ?>
48
+
49
+ <ol class="checkout-agreements">
50
+ <?php foreach ($this->getAgreements() as $_a): ?>
51
+ <li>
52
+ <div class="agreement-content"<?php echo ($_a->getContentHeight() ? ' style="height:' . $_a->getContentHeight() . '"' : '')?>>
53
+ <?php if ($_a->getIsHtml()):?>
54
+ <?php echo $_a->getContent() ?>
55
+ <?php else:?>
56
+ <?php echo nl2br($this->htmlEscape($_a->getContent())) ?>
57
+ <?php endif; ?>
58
+ </div>
59
+ <p class="agree">
60
+ <input type="checkbox" id="agreement-<?php echo $_a->getId()?>" name="agreement[<?php echo $_a->getId()?>]" value="1" title="<?php echo $this->htmlEscape($_a->getCheckboxText()) ?>" class="checkbox" /><label for="agreement-<?php echo $_a->getId()?>"><?php echo $_a->getIsHtml() ? $_a->getCheckboxText() : $this->htmlEscape($_a->getCheckboxText()) ?></label>
61
+ </p>
62
+ </li>
63
+ <?php endforeach ?>
64
+ </ol>
65
+ </form>
66
+ <script type="text/javascript">
67
+
68
+ </script>
app/design/frontend/default/default/template/deliverydate/deliverydate.phtml ADDED
@@ -0,0 +1,264 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $dayoff = Mage::getStoreConfig('deliverydate/deliverydate_general/deliverydate_dayoff');
3
+ ?>
4
+ <dd>
5
+ <script type="text/javascript">
6
+ //<![CDATA[
7
+ /*Calendar.setup({
8
+ inputField: "shipping_arrival_date",
9
+ ifFormat: "%m/%e/%Y",
10
+ showsTime: false,
11
+ button: "shipping_arrival_date_trig",
12
+ align: "Bl",
13
+ singleClick : true ,
14
+ disableFunc: function(date) {
15
+ return date.getMonth() === 1; // Sunday is 0, Monday is 1, and so on
16
+ }
17
+ });*/
18
+
19
+ Calendar.prototype._init = function (firstDayOfWeek, date) {
20
+ var today = new CalendarDateObject(),
21
+ TY = today.getFullYear(),
22
+ TM = today.getMonth(),
23
+ TD = today.getDate();
24
+ this.table.style.visibility = "hidden";
25
+ var year = date.getFullYear();
26
+ if (year < this.minYear) {
27
+ year = this.minYear;
28
+ date.setFullYear(year);
29
+ } else if (year > this.maxYear) {
30
+ year = this.maxYear;
31
+ date.setFullYear(year);
32
+ }
33
+ this.firstDayOfWeek = firstDayOfWeek;
34
+ this.date = new CalendarDateObject(date);
35
+ var month = date.getMonth();
36
+ var mday = date.getDate();
37
+ var no_days = date.getMonthDays();
38
+ /* Added By B.C. on date 18/02/2013 */
39
+ var check_flag = false;
40
+ /* END */
41
+
42
+ // calendar voodoo for computing the first day that would actually be
43
+ // displayed in the calendar, even if it's from the previous month.
44
+ // WARNING: this is magic. ;-)
45
+ date.setDate(1);
46
+ var day1 = (date.getDay() - this.firstDayOfWeek) % 7;
47
+ if (day1 < 0)
48
+ day1 += 7;
49
+ date.setDate(-day1);
50
+ date.setDate(date.getDate() + 1);
51
+
52
+ var row = this.tbody.firstChild;
53
+ var MN = Calendar._SMN[month];
54
+ var ar_days = this.ar_days = new Array();
55
+ var weekend = Calendar._TT["WEEKEND"];
56
+ var dates = this.multiple ? (this.datesCells = {}) : null;
57
+ for (var i = 0; i < 6; ++i, row = row.nextSibling) {
58
+ var cell = row.firstChild;
59
+ if (this.weekNumbers) {
60
+ cell.className = "day wn";
61
+ cell.innerHTML = date.getWeekNumber();
62
+ cell = cell.nextSibling;
63
+ }
64
+ row.className = "daysrow";
65
+ var hasdays = false, iday, dpos = ar_days[i] = [];
66
+ for (var j = 0; j < 7; ++j, cell = cell.nextSibling, date.setDate(iday + 1)) {
67
+ iday = date.getDate();
68
+ var wday = date.getDay();
69
+ cell.className = "day";
70
+ cell.pos = i << 4 | j;
71
+ dpos[j] = cell;
72
+ var current_month = (date.getMonth() == month);
73
+ if (!current_month) {
74
+ if (this.showsOtherMonths) {
75
+ cell.className += " othermonth";
76
+ cell.otherMonth = true;
77
+ } else {
78
+ cell.className = "emptycell";
79
+ cell.innerHTML = "&nbsp;";
80
+ cell.disabled = true;
81
+ continue;
82
+ }
83
+ } else {
84
+ cell.otherMonth = false;
85
+ hasdays = true;
86
+ }
87
+ cell.disabled = false;
88
+ cell.innerHTML = this.getDateText ? this.getDateText(date, iday) : iday;
89
+ if (dates)
90
+ dates[date.print("%Y%m%d")] = cell;
91
+ if (this.getDateStatus) {
92
+ var status = this.getDateStatus(date, year, month, iday);
93
+ if (this.getDateToolTip) {
94
+ var toolTip = this.getDateToolTip(date, year, month, iday);
95
+ if (toolTip)
96
+ cell.title = toolTip;
97
+ }
98
+ if (status === true) {
99
+ cell.className += " disabled";
100
+ cell.disabled = true;
101
+ } else {
102
+ if (/disabled/i.test(status))
103
+ cell.disabled = true;
104
+ cell.className += " " + status;
105
+ }
106
+ }
107
+ if (!cell.disabled) {
108
+ cell.caldate = new CalendarDateObject(date);
109
+ cell.ttip = "_";
110
+ if (!this.multiple && current_month
111
+ && iday == mday && this.hiliteToday) {
112
+ cell.className += " selected";
113
+ this.currentDateEl = cell;
114
+ }
115
+ if (date.getFullYear() == TY &&
116
+ date.getMonth() == TM &&
117
+ iday == TD) {
118
+ cell.className += " today";
119
+ cell.ttip += Calendar._TT["PART_TODAY"];
120
+ }
121
+ if (weekend.indexOf(wday.toString()) != -1)
122
+ cell.className += cell.otherMonth ? " oweekend" : " weekend";
123
+ if (check_flag){
124
+ cell.className += " selected";
125
+ this.currentDateEl = cell;
126
+ check_flag=false;
127
+ }
128
+ }else{
129
+ /* Added By B.C. on date 18/02/2013 */
130
+ if (!this.multiple && current_month
131
+ && iday == mday && this.hiliteToday) {
132
+ check_flag=true;
133
+ }
134
+
135
+ /* END */
136
+ }
137
+ }
138
+ if (!(hasdays || this.showsOtherMonths))
139
+ row.className = "emptyrow";
140
+ }
141
+ this.title.innerHTML = Calendar._MN[month] + ", " + year;
142
+ this.onSetTime();
143
+ this.table.style.visibility = "visible";
144
+ this._initMultipleDates();
145
+ // PROFILE
146
+ // this.tooltips.innerHTML = "Generated in " + ((new CalendarDateObject()) - today) + " ms";
147
+ };
148
+
149
+ var dayoff = '<?php echo $dayoff; ?>';
150
+ var test_flag = false;
151
+ Calendar.setup({
152
+ inputField: "shipping_arrival_date",
153
+ ifFormat: "%Y-%mm-%ee %H:%M:%S",
154
+ showsTime: true,
155
+ button: "shipping_arrival_date_trig",
156
+ align: "Bl",
157
+ singleClick :true,
158
+ onSelect :function()
159
+ {
160
+ //var y = calendar.date.getFullYear();
161
+ currentTime1 = new Date();
162
+ var m = parseInt(currentTime1.getMonth())+parseInt(1);
163
+ var y=currentTime1.getFullYear();
164
+ var d = currentTime1.getDate();
165
+
166
+
167
+
168
+ currentTime = new Date(calendar.date.getTime());
169
+ var d1=currentTime.getDate();
170
+ var m1=parseInt(currentTime.getMonth())+parseInt(1);
171
+ var y1=currentTime.getFullYear();
172
+ var h1 = currentTime.getHours();
173
+ var min1= currentTime.getMinutes();
174
+
175
+
176
+ if (calendar.dateClicked)
177
+ {
178
+ if(d1 < d && m1==m && y1==y)
179
+ {
180
+ alert("You can not select previous date.")
181
+ document.getElementById('shipping_arrival_date_display').value="";
182
+ document.getElementById('shipping_arrival_date').value="";
183
+ calendar.hide();
184
+ }
185
+ else
186
+ {
187
+ document.getElementById('shipping_arrival_date_display').value=y1+"-"+m1+"-"+d1+" "+h1+":"+min1;
188
+ document.getElementById('shipping_arrival_date').value=y1+"-"+m1+"-"+d1+" "+h1+":"+min1;
189
+ calendar.hide();
190
+ }
191
+ }
192
+ else
193
+ {
194
+ calendar.show();
195
+ }
196
+ },
197
+ disableFunc : function(date)
198
+ {
199
+ var y = calendar.date.getFullYear();
200
+ var m = calendar.date.getMonth();
201
+ var d = calendar.date.getDate();
202
+
203
+ var day_off_array = dayoff.split(",") ;
204
+
205
+ currentTime = new Date();
206
+ var d1=currentTime.getDate();
207
+ var m1=currentTime.getMonth();
208
+ var y1=currentTime.getFullYear();
209
+ var counter = 1;
210
+ for (var i=0; i<day_off_array.length;i++){
211
+ if (day_off_array[i]>=0 && day_off_array[i]!=''){
212
+ if (date.getDay()==day_off_array[i]){
213
+ if (date.getDate()==currentTime.getDate()){
214
+ test_flag=true;
215
+ }
216
+ return true;
217
+ }
218
+ }
219
+ }
220
+
221
+ if(y < y1)
222
+ {
223
+ return true;
224
+ }
225
+ else if(m1 > m && y==y1)
226
+ {
227
+ return true;
228
+ }
229
+ }
230
+ });
231
+
232
+ function shippingArrivalDateOnChange(el)
233
+ {
234
+ var displayDate = $('shipping_arrival_date_display');
235
+ var date = $('shipping_arrival_date').getValue();
236
+ displayDate.setValue(date);
237
+ }
238
+
239
+ function resetArrivalDate()
240
+ {
241
+ //clear both fields
242
+
243
+ }
244
+ //MRD added disable field to only allow calendar input
245
+ //TODO: need to enable field when form is submitted
246
+ Form.Element.disable('shipping_arrival_date_display');
247
+ Event.observe($('link_reset'),'click',function(){
248
+ $('shipping_arrival_date').setValue('');
249
+ $('shipping_arrival_date_display').setValue('');
250
+ });
251
+ //]]>
252
+ </script>
253
+ <ul style="border-top: 1px solid #D1D1D1; margin-top: 12px; padding-top: 10px;">
254
+ <li>
255
+ <label for="page_date-end">Delivery Date:</label>
256
+ <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>
257
+ <input name="shipping_arrival_date" id="shipping_arrival_date" value="" onChange="shippingArrivalDateOnChange(this); return false;" title="date" type="hidden">
258
+ </li>
259
+ <li>
260
+ <label for="shipping_arrival_comments">Delivery Comments:</label><br/>
261
+ <textarea cols="65" rows="8" name="shipping_arrival_comments" id="shipping_arrival_comments"></textarea></li>
262
+ <li> <i><?php echo Mage::getStoreConfig('deliverydate/deliverydate_general/deliverydate_html'); ?></i>
263
+ </li>
264
+ </dd>
app/design/frontend/default/default/template/deliverydate/email/info.phtml ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php $_order = $this->getOrder() ?>
2
+ <?php
3
+ $date_format = Mage::getStoreConfig('deliverydate/deliverydate_general/deliverydate_format');
4
+ $time_format = Mage::getStoreConfig('deliverydate/deliverydate_general/deliverytime_format');
5
+ if ($date_format=='')
6
+ $date_format='d/M/Y';
7
+ if($time_format=='')
8
+ $date_format.=" ,g:i a";
9
+ else
10
+ $date_format.=" ".$time_format;
11
+ if ($_order->getShippingArrivalDate()!='')
12
+ echo "<strong>Shipping Arrival Date :- </strong>".$currentDate = date ($date_format,strtotime($_order->getShippingArrivalDate()));
13
+ else
14
+ echo "<strong>Shipping Arrival Date :- </strong> N/A";
15
+ if ($_order->getShippingArrivalComments()!='')
16
+ echo "<br/>".$_order->getShippingArrivalComments();
17
+ ?>
app/design/frontend/default/default/template/deliverydate/js/calendar.phtml ADDED
@@ -0,0 +1,72 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // no notice of license for now
3
+ ?>
4
+
5
+ <?php
6
+ /**
7
+ * Calendar localization script. Should be put into page header.
8
+ *
9
+ * @see Mage_Core_Block_Html_Calendar
10
+ */
11
+ ?>
12
+
13
+ <script type="text/javascript">
14
+ //<![CDATA[
15
+ enUS = <?php echo $enUS?>; // en_US locale reference
16
+ Calendar._DN = <?php echo $days['wide']?>; // full day names
17
+ Calendar._SDN = <?php echo $days['abbreviated']?>; // short day names
18
+ Calendar._FD = <?php echo $firstDay?>; // First day of the week. "0" means display Sunday first, "1" means display Monday first, etc.
19
+ Calendar._MN = <?php echo $months['wide']?>; // full month names
20
+ Calendar._SMN = <?php echo $months['abbreviated']?>; // short month names
21
+ Calendar._am = <?php echo $am ?>; // am/pm
22
+ Calendar._pm = <?php echo $pm ?>;
23
+
24
+ // tooltips
25
+ Calendar._TT = {};
26
+ Calendar._TT["INFO"] = "<?php echo $this->__('About the calendar');?>";
27
+
28
+ Calendar._TT["ABOUT"] =
29
+ "<?php echo $this->__('DHTML Date/Time Selector')?>\n" +
30
+ "(c) dynarch.com 2002-2005 / Author: Mihai Bazon\n" +
31
+ "<?php echo $this->__('For latest version visit: %s', 'http://www.dynarch.com/projects/calendar/')?>\n" +
32
+ "<?php echo $this->__('Distributed under GNU LGPL. See %s for details.', 'http://gnu.org/licenses/lgpl.html')?>" +
33
+ "\n\n" +
34
+ "<?php echo $this->__('Date selection:')?>\n" +
35
+ "<?php echo $this->__('- Use the %s, %s buttons to select year', '\\xab', '\xbb')?>\n" +
36
+ "<?php echo $this->__('- Use the %s buttons to select month', '" + String.fromCharCode(0x2039) + ", " + String.fromCharCode(0x203a) + "')?>\n" +
37
+ "<?php echo $this->__('- Hold mouse button on any of the above buttons for faster selection.')?>";
38
+ Calendar._TT["ABOUT_TIME"] = "\n\n" +
39
+ "<?php echo $this->__('Time selection:')?>\n" +
40
+ "<?php echo $this->__('- Click on any of the time parts to increase it')?>\n" +
41
+ "<?php echo $this->__('- or Shift-click to decrease it')?>\n" +
42
+ "<?php echo $this->__('- or click and drag for faster selection.')?>";
43
+
44
+ Calendar._TT["PREV_YEAR"] = "<?php echo $this->__('Prev. year (hold for menu)');?>";
45
+ Calendar._TT["PREV_MONTH"] = "<?php echo $this->__('Prev. month (hold for menu)');?>";
46
+ Calendar._TT["GO_TODAY"] = "<?php echo $this->__('Go Today');?>";
47
+ Calendar._TT["NEXT_MONTH"] = "<?php echo $this->__('Next month (hold for menu)');?>";
48
+ Calendar._TT["NEXT_YEAR"] = "<?php echo $this->__('Next year (hold for menu)');?>";
49
+ Calendar._TT["SEL_DATE"] = "<?php echo $this->__('Select date');?>";
50
+ Calendar._TT["DRAG_TO_MOVE"] = "<?php echo $this->__('Drag to move');?>";
51
+ Calendar._TT["PART_TODAY"] = ' (' + <?php echo $today ?> + ')';
52
+
53
+ // the following is to inform that "%s" is to be the first day of week
54
+ Calendar._TT["DAY_FIRST"] = "<?php echo $this->__('Display %s first', '%s');?>";
55
+
56
+ // This may be locale-dependent. It specifies the week-end days, as an array
57
+ // of comma-separated numbers. The numbers are from 0 to 6: 0 means Sunday, 1
58
+ // means Monday, etc.
59
+ Calendar._TT["WEEKEND"] = <?php echo $weekendDays?>;
60
+
61
+ Calendar._TT["CLOSE"] = "<?php echo $this->__('Close');?>";
62
+ Calendar._TT["TODAY"] = <?php echo $today ?>;
63
+ Calendar._TT["TIME_PART"] = "<?php echo $this->__('(Shift-)Click or drag to change value');?>";
64
+
65
+ // date formats
66
+ Calendar._TT["DEF_DATE_FORMAT"] = <?php echo $defaultFormat?>;
67
+ Calendar._TT["TT_DATE_FORMAT"] = <?php echo $toolTipFormat?>;
68
+
69
+ Calendar._TT["WK"] = <?php echo $week ?>;
70
+ Calendar._TT["TIME"] = "<?php echo $this->__('Time:');?>";
71
+ //]]>
72
+ </script>
app/design/frontend/default/default/template/deliverydate/order/info.phtml ADDED
@@ -0,0 +1,124 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category design
22
+ * @package base_default
23
+ * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <?php /** @var $this Mage_Sales_Block_Order_Info */ ?>
28
+ <?php $_order = $this->getOrder() ?>
29
+ <?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
30
+ <div class="page-title title-buttons">
31
+ <h1><?php echo $this->__('Order #%s - %s', $_order->getRealOrderId(), $_order->getStatusLabel()) ?></h1>
32
+ <?php echo $this->getChildHtml('buttons') ?>
33
+ </div>
34
+ <?php echo $this->getStatusHistoryRssUrl($_order) ?>
35
+ <dl class="order-info">
36
+ <dt><?php echo $this->__('About This Order:') ?></dt>
37
+ <dd>
38
+ <?php $_links = $this->getLinks(); ?>
39
+ <ul id="order-info-tabs">
40
+ <?php foreach ($_links as $_link): ?>
41
+ <?php if($_link->getUrl()): ?>
42
+ <li><a href="<?php echo $_link->getUrl() ?>"><?php echo $_link->getLabel() ?></a></li>
43
+ <?php else: ?>
44
+ <li class="current"><?php echo $_link->getLabel() ?></li>
45
+ <?php endif; ?>
46
+ <?php endforeach; ?>
47
+ </ul>
48
+ <script type="text/javascript">decorateGeneric($('order-info-tabs').select('LI'),['first','last']);</script>
49
+ </dd>
50
+ </dl>
51
+ <p class="order-date"><?php echo $this->__('Order Date: %s', $this->formatDate($_order->getCreatedAtStoreDate(), 'long')) ?></p>
52
+ <?php if (!$_order->getIsVirtual()): ?>
53
+ <div class="col2-set order-info-box">
54
+ <div class="col-1">
55
+ <div class="box">
56
+ <div class="box-title">
57
+ <h2><?php echo $this->__('Shipping Address') ?></h2>
58
+ </div>
59
+ <div class="box-content">
60
+ <address><?php echo $_order->getShippingAddress()->format('html') ?></address>
61
+ </div>
62
+ </div>
63
+ </div>
64
+ <div class="col-2">
65
+ <div class="box">
66
+ <div class="box-title">
67
+ <h2><?php echo $this->__('Shipping Method') ?></h2>
68
+ </div>
69
+ <div class="box-content">
70
+ <?php
71
+ if ($_order->getShippingDescription()): ?>
72
+ <?php echo $this->escapeHtml($_order->getShippingDescription()); ?>
73
+ <br/>
74
+ <?php
75
+ $shipping_arrival_date = $_order->getShippingArrivalDate();
76
+
77
+ $date_format = Mage::getStoreConfig('deliverydate/deliverydate_general/deliverydate_format');
78
+ $time_format = Mage::getStoreConfig('deliverydate/deliverydate_general/deliverytime_format');
79
+ if ($date_format=='')
80
+ $date_format='d/M/Y';
81
+ if($time_format=='')
82
+ $date_format.=" ,g:i a";
83
+ else
84
+ $date_format.=" ".$time_format;
85
+ if ($shipping_arrival_date!='')
86
+ echo "Shipping Arrival Date :- ".$currentDate = date ($date_format,strtotime($shipping_arrival_date));
87
+ else
88
+ echo "Shipping Arrival Date :- N/A";
89
+ ?>
90
+ <br/>
91
+ <?php
92
+ if ($_order->getShippingArrivalComments()!='')
93
+ echo $_order->getShippingArrivalComments();
94
+ ?>
95
+ <?php else: ?>
96
+ <p><?php echo $this->helper('sales')->__('No shipping information available'); ?></p>
97
+ <?php endif; ?>
98
+ </div>
99
+ </div>
100
+ </div>
101
+ </div>
102
+ <?php endif; ?>
103
+ <div class="col2-set order-info-box">
104
+ <div class="col-1">
105
+ <div class="box">
106
+ <div class="box-title">
107
+ <h2><?php echo $this->__('Billing Address') ?></h2>
108
+ </div>
109
+ <div class="box-content">
110
+ <address><?php echo $_order->getBillingAddress()->format('html') ?></address>
111
+ </div>
112
+ </div>
113
+ </div>
114
+ <div class="col-2">
115
+ <div class="box box-payment">
116
+ <div class="box-title">
117
+ <h2><?php echo $this->__('Payment Method') ?></h2>
118
+ </div>
119
+ <div class="box-content">
120
+ <?php echo $this->getPaymentInfoHtml() ?>
121
+ </div>
122
+ </div>
123
+ </div>
124
+ </div>
app/design/frontend/default/default/template/deliverydate/review/info.phtml ADDED
@@ -0,0 +1,77 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category design
22
+ * @package base_default
23
+ * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <?php echo $this->getChildHtml('items_before'); ?>
28
+ <div id="checkout-review-table-wrapper">
29
+ <table class="data-table" id="checkout-review-table">
30
+ <?php if ($this->helper('tax')->displayCartBothPrices()): $colspan = $rowspan = 2; else: $colspan = $rowspan = 1; endif; ?>
31
+ <col />
32
+ <col width="1" />
33
+ <col width="1" />
34
+ <col width="1" />
35
+ <?php if ($this->helper('tax')->displayCartBothPrices()): ?>
36
+ <col width="1" />
37
+ <col width="1" />
38
+ <?php endif; ?>
39
+ <thead>
40
+ <tr>
41
+ <th rowspan="<?php echo $rowspan ?>"><?php echo $this->__('Product Name') ?></th>
42
+ <th colspan="<?php echo $colspan ?>" class="a-center"><?php echo $this->__('Price') ?></th>
43
+ <th rowspan="<?php echo $rowspan ?>" class="a-center"><?php echo $this->__('Qty') ?></th>
44
+ <th colspan="<?php echo $colspan ?>" class="a-center"><?php echo $this->__('Subtotal') ?></th>
45
+ </tr>
46
+ <?php if ($this->helper('tax')->displayCartBothPrices()): ?>
47
+ <tr>
48
+ <th class="a-right"><?php echo $this->helper('tax')->getIncExcTaxLabel(false) ?></th>
49
+ <th><?php echo $this->helper('tax')->getIncExcTaxLabel(true) ?></th>
50
+ <th class="a-right"><?php echo $this->helper('tax')->getIncExcTaxLabel(false) ?></th>
51
+ <th><?php echo $this->helper('tax')->getIncExcTaxLabel(true) ?></th>
52
+ </tr>
53
+ <?php endif; ?>
54
+ </thead>
55
+ <?php echo $this->getChildHtml('totals'); ?>
56
+ <tbody>
57
+ <?php foreach($this->getItems() as $_item): ?>
58
+ <?php echo $this->getItemHtml($_item)?>
59
+ <?php endforeach ?>
60
+ </tbody>
61
+ </table>
62
+ </div>
63
+ <?php echo $this->getChildHtml('items_after'); ?>
64
+ <script type="text/javascript">
65
+ //<![CDATA[
66
+ decorateTable('checkout-review-table');
67
+ truncateOptions();
68
+ //]]>
69
+ </script>
70
+ <div id="checkout-review-submit">
71
+ <?php echo $this->getChildHtml('agreements') ?>
72
+ <script type="text/javascript">
73
+ //<![CDATA[
74
+ review = new Review('<?php echo $this->getUrl('checkout/onepage/saveOrder') ?>', '<?php echo $this->getUrl('checkout/onepage/success') ?>', $('checkout-agreements'));
75
+ //]]>
76
+ </script>
77
+ </div>
app/design/frontend/default/default/template/deliverydate/shipping_method/available.phtml ADDED
@@ -0,0 +1,107 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magento
4
+ *
5
+ * NOTICE OF LICENSE
6
+ *
7
+ * This source file is subject to the Academic Free License (AFL 3.0)
8
+ * that is bundled with this package in the file LICENSE_AFL.txt.
9
+ * It is also available through the world-wide-web at this URL:
10
+ * http://opensource.org/licenses/afl-3.0.php
11
+ * If you did not receive a copy of the license and are unable to
12
+ * obtain it through the world-wide-web, please send an email
13
+ * to license@magentocommerce.com so we can send you a copy immediately.
14
+ *
15
+ * DISCLAIMER
16
+ *
17
+ * Do not edit or add to this file if you wish to upgrade Magento to newer
18
+ * versions in the future. If you wish to customize Magento for your
19
+ * needs please refer to http://www.magentocommerce.com for more information.
20
+ *
21
+ * @category design
22
+ * @package base_default
23
+ * @copyright Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
24
+ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
25
+ */
26
+ ?>
27
+ <?php /** @var $this Mage_Checkout_Block_Onepage_Shipping_Method_Available */ ?>
28
+ <?php $_shippingRateGroups = $this->getShippingRates(); ?>
29
+ <?php if (!$_shippingRateGroups): ?>
30
+ <p><?php echo $this->__('Sorry, no quotes are available for this order at this time.') ?></p>
31
+ <?php else: ?>
32
+
33
+ <dl class="sp-methods">
34
+ <?php $shippingCodePrice = array(); ?>
35
+ <?php $_sole = count($_shippingRateGroups) == 1; foreach ($_shippingRateGroups as $code => $_rates): ?>
36
+ <dt><?php echo $this->escapeHtml($this->getCarrierName($code)) ?></dt>
37
+ <dd>
38
+ <ul>
39
+ <?php $_sole = $_sole && count($_rates) == 1; foreach ($_rates as $_rate): ?>
40
+ <?php $shippingCodePrice[] = "'".$_rate->getCode()."':".(float)$_rate->getPrice(); ?>
41
+ <li>
42
+ <?php if ($_rate->getErrorMessage()): ?>
43
+ <ul class="messages"><li class="error-msg"><ul><li><?php echo $this->escapeHtml($_rate->getErrorMessage()) ?></li></ul></li></ul>
44
+ <?php else: ?>
45
+ <?php if ($_sole) : ?>
46
+ <span class="no-display"><input name="shipping_method" type="radio" value="<?php echo $_rate->getCode() ?>" id="s_method_<?php echo $_rate->getCode() ?>" checked="checked" /></span>
47
+ <?php else: ?>
48
+ <input name="shipping_method" type="radio" value="<?php echo $_rate->getCode() ?>" id="s_method_<?php echo $_rate->getCode() ?>"<?php if($_rate->getCode()===$this->getAddressShippingMethod()) echo ' checked="checked"' ?> class="radio"/>
49
+
50
+ <?php if ($_rate->getCode() === $this->getAddressShippingMethod()): ?>
51
+ <script type="text/javascript">
52
+ //<![CDATA[
53
+ lastPrice = <?php echo (float)$_rate->getPrice(); ?>;
54
+ //]]>
55
+ </script>
56
+ <?php endif; ?>
57
+
58
+ <?php endif; ?>
59
+ <label for="s_method_<?php echo $_rate->getCode() ?>"><?php echo $this->escapeHtml($_rate->getMethodTitle()) ?>
60
+ <?php $_excl = $this->getShippingPrice($_rate->getPrice(), $this->helper('tax')->displayShippingPriceIncludingTax()); ?>
61
+ <?php $_incl = $this->getShippingPrice($_rate->getPrice(), true); ?>
62
+ <?php echo $_excl; ?>
63
+ <?php if ($this->helper('tax')->displayShippingBothPrices() && $_incl != $_excl): ?>
64
+ (<?php echo $this->__('Incl. Tax'); ?> <?php echo $_incl; ?>)
65
+ <?php endif; ?>
66
+ </label>
67
+ <?php endif ?>
68
+ </li>
69
+ <?php endforeach; ?>
70
+ </ul>
71
+ </dd>
72
+ <?php endforeach; ?>
73
+ <?php
74
+ if (Mage::getStoreConfig('deliverydate/deliverydate_general/on_which_page')==1){
75
+ echo $this->getLayout()->createBlock('deliverydate/deliverydate')->setTemplate('deliverydate/deliverydate.phtml')->toHtml();
76
+ }
77
+ ?>
78
+ </dl>
79
+ <script type="text/javascript">
80
+ //<![CDATA[
81
+ <?php if (!empty($shippingCodePrice)): ?>
82
+ var shippingCodePrice = {<?php echo implode(',',$shippingCodePrice); ?>};
83
+ <?php endif; ?>
84
+
85
+ $$('input[type="radio"][name="shipping_method"]').each(function(el){
86
+ Event.observe(el, 'click', function(){
87
+ if (el.checked == true) {
88
+ var getShippingCode = el.getValue();
89
+ <?php if (!empty($shippingCodePrice)): ?>
90
+ var newPrice = shippingCodePrice[getShippingCode];
91
+ if (!lastPrice) {
92
+ lastPrice = newPrice;
93
+ quoteBaseGrandTotal += newPrice;
94
+ }
95
+ if (newPrice != lastPrice) {
96
+ quoteBaseGrandTotal += (newPrice-lastPrice);
97
+ lastPrice = newPrice;
98
+ }
99
+ <?php endif; ?>
100
+ checkQuoteBaseGrandTotal = quoteBaseGrandTotal;
101
+ return false;
102
+ }
103
+ });
104
+ });
105
+ //]]>
106
+ </script>
107
+ <?php endif; ?>
app/etc/modules/Bc_Deliverydate.xml ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * @category Bc
5
+ * @package Bc_Deliverydate
6
+ * @author ModuleCreator
7
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
8
+ */
9
+ -->
10
+ <config>
11
+ <modules>
12
+ <Bc_Deliverydate>
13
+ <active>true</active>
14
+ <codePool>local</codePool>
15
+ </Bc_Deliverydate>
16
+ </modules>
17
+ </config>
package.xml ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>order_delivery_date</name>
4
+ <version>0.1.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Delivery date extension will allow customer to choose preferable delivery date for order.</summary>
10
+ <description>Delivery date extension will allow customer to choose preferable delivery date for order.
11
+
12
+ Extension provide advance configuration for admin to decide where to capture delivery date from user either from shipping method step or review step in checkout process.
13
+
14
+ Our extension will override files to display delivery date with order information so that admin dont requires to manually change any files.</description>
15
+ <notes>- Customizable checkout process to display delivery date.
16
+ - Backend configuration to manage extension</notes>
17
+ <authors><author><name>Biztech</name><user>auto-converted</user><email>sales@biztechconsultancy.com</email></author></authors>
18
+ <date>2013-02-19</date>
19
+ <time>13:15:32</time>
20
+ <contents><target name="magedesign"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="layout"><file name="deliverydate.xml" hash="5b131094e37144fbf5afcba8175e12a2"/></dir><dir name="template"><dir name="deliverydate"><file name="info.phtml" hash="384509460cd6670ed7c166ede12963f8"/></dir></dir></dir></dir></dir><dir name="frontend"><dir name="default"><dir name="default"><dir name="layout"><file name="deliverydate.xml" hash="782935656933efd6e8708824d9275474"/></dir><dir name="template"><dir name="deliverydate"><dir name="email"><file name="info.phtml" hash="6fdbc376e648bd328a9167dd08c8cc5b"/></dir><dir name="js"><file name="calendar.phtml" hash="0cf736ac3f11475c3b20ce008791ce30"/></dir><dir name="order"><file name="info.phtml" hash="03a790d8ec056ae0446afc78247e410d"/></dir><dir name="review"><file name="info.phtml" hash="b6008255d3308678c0658605f4a37539"/></dir><dir name="shipping_method"><file name="available.phtml" hash="0d7ab3fd3d976cc90ddba322d3c8737e"/></dir><file name="agreements.phtml" hash="77bcb19c1bb923f91a7780520b30e55f"/><file name="deliverydate.phtml" hash="cb61e2e8f65104212bc5a62b2c0634ac"/></dir></dir></dir></dir></dir></target><target name="magelocal"><dir name="Bc"><dir name="Deliverydate"><dir name="Block"><dir name="Adminhtml"><dir name="Deliverydate"><dir name="Edit"><dir name="Tab"><file name="Form.php" hash="eb392c359eafe55fa4af49726e38d25d"/></dir><file name="Form.php" hash="14a5ef75f43be68f966b4233d1a71707"/><file name="Tabs.php" hash="4dae864023de48414f5c5de48961dbb2"/></dir><file name="Edit.php" hash="b990ba5c1f8bc9c9e8796f4b0fe45ab2"/><file name="Grid.php" hash="1033c40acfc04c6d9b2827f3b1664fef"/></dir><file name="Deliverydate.php" hash="da2c1c11742280cbdad8a6789d8e710f"/></dir><dir name="Email"><file name="Info.php" hash="77175f966ef7fe9414bfbb1592f651ff"/></dir><dir name="Order"><file name="Info.php" hash="73d4b23927c7531e489eb6a806934b44"/></dir><file name="Deliverydate.php" hash="2e5ea173382e8fd75165b8bee4cfb409"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="DeliverydateController.php" hash="a33ab0d29a473dbc421aef1df67d301f"/></dir><file name="IndexController.php" hash="4066dfbe772492393bf98a127af7bc2d"/></dir><dir name="etc"><file name="config.xml" hash="539d33a6e16d04de9ce02192a6330778"/><file name="config_bkp_19022013.xml" hash="0cef544ff62bb770f6ac5da176ed9a97"/><file name="system.xml" hash="adf832b092bdafb35a59d5b71e7601d2"/><file name="system_bkp_19022013.xml" hash="0376ca3cdb73f6811092199bc1f1b744"/></dir><dir name="Helper"><file name="Data.php" hash="bb3d59cf71fcc5664410fff1acd82d17"/></dir><dir name="Model"><dir name="Config"><file name="Dateformat.php" hash="722f44d3c607a2e0f172f8b2721405fe"/><file name="Dayoff.php" hash="be7e72edca44e8cee607972cde0e1565"/><file name="Option.php" hash="45780922eac613f1a6a03ced8af080ec"/><file name="Timeformat.php" hash="19b1013107a87923bdc2b962dae844ec"/></dir><dir name="Mysql4"><dir name="Deliverydate"><file name="Collection.php" hash="38e5fa717318b2fc9d18eca3db6b0e8b"/></dir><file name="Deliverydate.php" hash="5dee427cc09c3659a76a32a6ec13cade"/></dir><file name="Deliverydate.php" hash="d6d63e0c5db21a706ec7353b307f8a95"/><file name="Observer.php" hash="b0c184174b87e49131e6d672eb18178c"/><file name="Status.php" hash="334c9b7669e215314b32e9cbcff89354"/></dir><dir name="sql"><dir name="deliverydate_setup"><file name="mysql4-install-0.1.0.php" hash="d03f13d84464f407844bee55dc930d60"/></dir></dir></dir></dir></target><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="images"><file name="ico_reset.png" hash="b5f3195305024564e387bc15ebadcc7c"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Bc_Deliverydate.xml" hash="eab1058099910cdf137d2e38ee73c392"/></dir></target></contents>
21
+ <compatible/>
22
+ <dependencies/>
23
+ </package>
skin/frontend/base/default/images/ico_reset.png ADDED
Binary file