Magmodules_Fadello - Version 1.0.0

Version Notes

Fadello

Download this release

Release Info

Developer Magmodules
Extension Magmodules_Fadello
Version 1.0.0
Comparing to
See all releases


Version 1.0.0

Files changed (27) hide show
  1. app/code/community/Magmodules/Fadello/Block/Adminhtml/Config/Form/Field/Availability.php +70 -0
  2. app/code/community/Magmodules/Fadello/Block/Adminhtml/Config/Form/Field/Shipping.php +58 -0
  3. app/code/community/Magmodules/Fadello/Block/Adminhtml/Config/Form/Renderer/Select.php +206 -0
  4. app/code/community/Magmodules/Fadello/Block/Adminhtml/Renderer/Shipment.php +54 -0
  5. app/code/community/Magmodules/Fadello/Block/Adminhtml/System/Config/Form/Field/Heading.php +32 -0
  6. app/code/community/Magmodules/Fadello/Block/Adminhtml/System/Config/Form/Field/Note.php +32 -0
  7. app/code/community/Magmodules/Fadello/Block/Adminhtml/System/Config/Form/Field/Version.php +29 -0
  8. app/code/community/Magmodules/Fadello/Helper/Data.php +104 -0
  9. app/code/community/Magmodules/Fadello/Model/Adminhtml/System/Config/Backend/Design/Availability.php +59 -0
  10. app/code/community/Magmodules/Fadello/Model/Adminhtml/System/Config/Backend/Design/Shipping.php +60 -0
  11. app/code/community/Magmodules/Fadello/Model/Adminhtml/System/Config/Source/Days.php +37 -0
  12. app/code/community/Magmodules/Fadello/Model/Api.php +341 -0
  13. app/code/community/Magmodules/Fadello/Model/Carrier/ShippingMethod.php +85 -0
  14. app/code/community/Magmodules/Fadello/Model/Observer.php +57 -0
  15. app/code/community/Magmodules/Fadello/controllers/Adminhtml/FadelloController.php +111 -0
  16. app/code/community/Magmodules/Fadello/etc/adminhtml.xml +43 -0
  17. app/code/community/Magmodules/Fadello/etc/config.xml +120 -0
  18. app/code/community/Magmodules/Fadello/etc/system.xml +414 -0
  19. app/code/community/Magmodules/Fadello/sql/fadello_setup/mysql4-install-0.9.0.php +66 -0
  20. app/etc/modules/Magmodules_Fadello.xml +30 -0
  21. app/locale/en_US/Magmodules_Fadello.csv +45 -0
  22. app/locale/nl_NL/Magmodules_Fadello.csv +53 -0
  23. package.xml +18 -0
  24. skin/adminhtml/default/default/images/fadello/close.png +0 -0
  25. skin/adminhtml/default/default/images/fadello/export.png +0 -0
  26. skin/adminhtml/default/default/images/fadello/pdf.png +0 -0
  27. skin/adminhtml/default/default/images/fadello/ship.png +0 -0
app/code/community/Magmodules/Fadello/Block/Adminhtml/Config/Form/Field/Availability.php ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magmodules.eu - http://www.magmodules.eu
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 info@magmodules.eu so we can send you a copy immediately.
14
+ *
15
+ * @category Magmodules
16
+ * @package Magmodules_Fadello
17
+ * @author Magmodules <info@magmodules.eu)
18
+ * @copyright Copyright (c) 2016 (http://www.magmodules.eu)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+
22
+ class Magmodules_Fadello_Block_Adminhtml_Config_Form_Field_Availability extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract {
23
+
24
+ protected $_renders = array();
25
+
26
+ public function __construct()
27
+ {
28
+ $layout = Mage::app()->getFrontController()->getAction()->getLayout();
29
+ $renderer_days = $layout->createBlock('fadello/adminhtml_config_form_renderer_select', '', array('is_render_to_js_template' => true));
30
+ $renderer_days->setOptions(Mage::getModel('fadello/adminhtml_system_config_source_days')->toOptionArray());
31
+
32
+ $this->addColumn('day', array(
33
+ 'label' => Mage::helper('fadello')->__('Day'),
34
+ 'style' => 'width:100px',
35
+ 'renderer' => $renderer_days
36
+ ));
37
+
38
+ $this->addColumn('from', array(
39
+ 'label' => Mage::helper('fadello')->__('From'),
40
+ 'style' => 'width:40px',
41
+ ));
42
+
43
+ $this->addColumn('to', array(
44
+ 'label' => Mage::helper('fadello')->__('To'),
45
+ 'style' => 'width:40px',
46
+ ));
47
+
48
+ $this->addColumn('title', array(
49
+ 'label' => Mage::helper('fadello')->__('Title'),
50
+ 'style' => 'width:100px',
51
+ ));
52
+
53
+ $this->_renders['day'] = $renderer_days;
54
+
55
+ $this->_addAfter = false;
56
+ $this->_addButtonLabel = Mage::helper('fadello')->__('Add Option');
57
+ parent::__construct();
58
+ }
59
+
60
+ protected function _prepareArrayRow(Varien_Object $row)
61
+ {
62
+ foreach ($this->_renders as $key => $render){
63
+ $row->setData(
64
+ 'option_extra_attr_' . $render->calcOptionHash($row->getData($key)),
65
+ 'selected="selected"'
66
+ );
67
+ }
68
+ }
69
+
70
+ }
app/code/community/Magmodules/Fadello/Block/Adminhtml/Config/Form/Field/Shipping.php ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magmodules.eu - http://www.magmodules.eu
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 info@magmodules.eu so we can send you a copy immediately.
14
+ *
15
+ * @category Magmodules
16
+ * @package Magmodules_Fadello
17
+ * @author Magmodules <info@magmodules.eu)
18
+ * @copyright Copyright (c) 2016 (http://www.magmodules.eu)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+
22
+ class Magmodules_Fadello_Block_Adminhtml_Config_Form_Field_Shipping extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract {
23
+
24
+ protected $_renders = array();
25
+
26
+ public function __construct()
27
+ {
28
+ $this->addColumn('from', array(
29
+ 'label' => Mage::helper('fadello')->__('From Price'),
30
+ 'style' => 'width:50px',
31
+ ));
32
+
33
+ $this->addColumn('to', array(
34
+ 'label' => Mage::helper('fadello')->__('To Price'),
35
+ 'style' => 'width:50px',
36
+ ));
37
+
38
+ $this->addColumn('cost', array(
39
+ 'label' => Mage::helper('fadello')->__('Cost'),
40
+ 'style' => 'width:50px',
41
+ ));
42
+
43
+ $this->_addAfter = false;
44
+ $this->_addButtonLabel = Mage::helper('fadello')->__('Add Option');
45
+ parent::__construct();
46
+ }
47
+
48
+ protected function _prepareArrayRow(Varien_Object $row)
49
+ {
50
+ foreach ($this->_renders as $key => $render){
51
+ $row->setData(
52
+ 'option_extra_attr_' . $render->calcOptionHash($row->getData($key)),
53
+ 'selected="selected"'
54
+ );
55
+ }
56
+ }
57
+
58
+ }
app/code/community/Magmodules/Fadello/Block/Adminhtml/Config/Form/Renderer/Select.php ADDED
@@ -0,0 +1,206 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magmodules.eu - http://www.magmodules.eu
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 info@magmodules.eu so we can send you a copy immediately.
14
+ *
15
+ * @category Magmodules
16
+ * @package Magmodules_Fadello
17
+ * @author Magmodules <info@magmodules.eu)
18
+ * @copyright Copyright (c) 2016 (http://www.magmodules.eu)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+
22
+ class Magmodules_Fadello_Block_Adminhtml_Config_Form_Renderer_Select extends Mage_Core_Block_Html_Select {
23
+
24
+ /**
25
+ * @param $inputName
26
+ * @return $this
27
+ */
28
+ public function setInputName($inputName)
29
+ {
30
+ $this->setData('inputname', $inputName);
31
+ return $this;
32
+ }
33
+
34
+ /**
35
+ * @return mixed
36
+ */
37
+ public function getInputName()
38
+ {
39
+ return $this->getData('inputname');
40
+ }
41
+
42
+ /**
43
+ * @param $columnName
44
+ * @return $this
45
+ */
46
+ public function setColumnName($columnName)
47
+ {
48
+ $this->setData('columnname', $columnName);
49
+ return $this;
50
+ }
51
+
52
+ /**
53
+ * @return mixed
54
+ */
55
+ public function getColumnName()
56
+ {
57
+ return $this->getData('columnname');
58
+ }
59
+
60
+
61
+ /**
62
+ * @param $column
63
+ * @return $this
64
+ */
65
+ public function setColumn($column)
66
+ {
67
+ $this->setData('column', $column);
68
+ return $this;
69
+ }
70
+
71
+ /**
72
+ * @return mixed
73
+ */
74
+ public function getColumn()
75
+ {
76
+ return $this->getData('column');
77
+ }
78
+
79
+ /**
80
+ * @return string
81
+ */
82
+ public function getExtraParams()
83
+ {
84
+ $column = $this->getColumn();
85
+ if($column && isset($column['style'])){
86
+ return ' style="'.$column['style'].'" ';
87
+ }else{
88
+ return '';
89
+ }
90
+ }
91
+
92
+ /**
93
+ * @return string
94
+ */
95
+ protected function _toHtml()
96
+ {
97
+
98
+ if(!$this->_beforeToHtml()) {
99
+ return '';
100
+ }
101
+
102
+ $html = '<select name="'.$this->getInputName().'" class="'.$this->getClass().'" '.$this->getExtraParams().'>';
103
+
104
+ $values = $this->getValue();
105
+
106
+ if (!is_array($values)){
107
+ if (!is_null($values)) {
108
+ $values = array($values);
109
+ } else {
110
+ $values = array();
111
+ }
112
+ }
113
+
114
+ $isArrayOption = true;
115
+
116
+ foreach($this->getOptions() as $key => $option) {
117
+ if($isArrayOption && is_array($option)) {
118
+ $value = $option['value'];
119
+ $label = $option['label'];
120
+ $params = (!empty($option['params'])) ? $option['params'] : array();
121
+ } else {
122
+ $value = $key;
123
+ $label = $option;
124
+ $isArrayOption = false;
125
+ $params = array();
126
+ }
127
+
128
+ if(is_array($value)) {
129
+ $html.= '<optgroup label="'.$label.'">';
130
+ foreach($value as $keyGroup => $optionGroup) {
131
+ if(!is_array($optionGroup)) {
132
+ $optionGroup = array(
133
+ 'value' => $keyGroup,
134
+ 'label' => $optionGroup
135
+ );
136
+ }
137
+ $html.= $this->_optionToHtml(
138
+ $optionGroup,
139
+ in_array($optionGroup['value'], $values)
140
+ );
141
+ }
142
+ $html.= '</optgroup>';
143
+ } else {
144
+ $html.= $this->_optionToHtml(array(
145
+ 'value' => $value,
146
+ 'label' => $label,
147
+ 'params' => $params
148
+ ),
149
+ in_array($value, $values)
150
+ );
151
+ }
152
+ }
153
+ $html.= '</select>';
154
+ return $html;
155
+ }
156
+
157
+ /**
158
+ * @param array $option
159
+ * @param bool $selected
160
+ * @return string
161
+ */
162
+ protected function _optionToHtml($option, $selected = false)
163
+ {
164
+ $selectedHtml = $selected ? ' selected="selected"' : '';
165
+ if ($this->getIsRenderToJsTemplate() === true) {
166
+ $selectedHtml .= ' #{option_extra_attr_' . self::calcOptionHash($option['value']) . '}';
167
+ }
168
+
169
+ $params = '';
170
+ if (!empty($option['params']) && is_array($option['params'])) {
171
+ foreach ($option['params'] as $key => $value) {
172
+ if (is_array($value)) {
173
+ foreach ($value as $keyMulti => $valueMulti) {
174
+ $params .= sprintf(' %s="%s" ', $keyMulti, $valueMulti);
175
+ }
176
+ } else {
177
+ $params .= sprintf(' %s="%s" ', $key, $value);
178
+ }
179
+ }
180
+ }
181
+
182
+ return sprintf('<option value="%s"%s %s>%s</option>',
183
+ $this->htmlEscape($option['value']),
184
+ $selectedHtml,
185
+ $params,
186
+ $this->htmlEscape($option['label']));
187
+ }
188
+
189
+ /**
190
+ * @return string
191
+ */
192
+ public function getHtml()
193
+ {
194
+ return $this->toHtml();
195
+ }
196
+
197
+ /**
198
+ * @param string $optionValue
199
+ * @return string
200
+ */
201
+ public function calcOptionHash($optionValue)
202
+ {
203
+ return sprintf('%u', crc32($this->getColumnName() . $this->getInputName() . $optionValue));
204
+ }
205
+
206
+ }
app/code/community/Magmodules/Fadello/Block/Adminhtml/Renderer/Shipment.php ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magmodules.eu - http://www.magmodules.eu
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 info@magmodules.eu so we can send you a copy immediately.
14
+ *
15
+ * @category Magmodules
16
+ * @package Magmodules_Fadello
17
+ * @author Magmodules <info@magmodules.eu)
18
+ * @copyright Copyright (c) 2016 (http://www.magmodules.eu)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+
22
+ class Magmodules_Fadello_Block_Adminhtml_Renderer_Shipment extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract {
23
+
24
+ public function render(Varien_Object $row)
25
+ {
26
+ $html = '';
27
+ $orderId = $row->getEntityId();
28
+ $status = $row->getFadelloStatus();
29
+ $show_all_shipments = Mage::getStoreConfig('shipping/fadello/show_all_shipments');
30
+ if(!$show_all_shipments) {
31
+ if($row->getShippingMethod() != 'fadello_fadello') {
32
+ return $html;
33
+ }
34
+ }
35
+ if(!empty($status)) {
36
+ if($status == 'created') {
37
+ $html .= '<a href="' . $this->getUrl('*/fadello/cancelShipment', array('order_id' => $orderId)) . '"><img title="' . $this->__('Cancel this Fadello Shipment') . '" src="' . $this->getSkinUrl('images/fadello/close.png' ) . '"></a>';
38
+ $html .= '&nbsp; ';
39
+ $html .= '<a href="' . $this->getUrl('*/fadello/getPdf', array('order_id' => $orderId)) . '"><img title="' . $this->__('Open PDF') . '" src="' . $this->getSkinUrl('images/fadello/pdf.png') . '"></a>';
40
+ $html .= '&nbsp; ';
41
+ $html .= '<a href="' . $this->getUrl('*/fadello/shipOrder', array('order_id' => $orderId)) . '"><img title="' . $this->__('Ship This Order') . '" src="' . $this->getSkinUrl('images/fadello/export.png') . '"></a>';
42
+ }
43
+ if($status == 'shipped') {
44
+ $html .= '<a href="' . $this->getUrl('*/fadello/cancelShipment', array('order_id' => $orderId, 'magento' => 1)) . '"><img title="' . $this->__('Cancel this Fadello Shipment') . '" src="' . $this->getSkinUrl('images/rule_component_remove.gif') . '"></a>';
45
+ $html .= '&nbsp; ';
46
+ $html .= '<a href="' . $this->getUrl('*/fadello/getPdf', array('order_id' => $orderId)) . '"><img title="' . $this->__('Open PDF') . '" src="' . $this->getSkinUrl('images/fadello/pdf.png') . '"></a>';
47
+ }
48
+ } else {
49
+ $html .= '<a href="' . $this->getUrl('*/fadello/createShipment', array('order_id' => $orderId)) . '"><img title="' . $this->__('Create Shipment') . '" src="' . $this->getSkinUrl('images/fadello/ship.png') . '"></a>';
50
+ }
51
+ return $html;
52
+ }
53
+
54
+ }
app/code/community/Magmodules/Fadello/Block/Adminhtml/System/Config/Form/Field/Heading.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magmodules.eu - http://www.magmodules.eu
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 info@magmodules.eu so we can send you a copy immediately.
14
+ *
15
+ * @category Magmodules
16
+ * @package Magmodules_Fadello
17
+ * @author Magmodules <info@magmodules.eu)
18
+ * @copyright Copyright (c) 2016 (http://www.magmodules.eu)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+
22
+ class Magmodules_Fadello_Block_Adminhtml_System_Config_Form_Field_Heading extends Mage_Adminhtml_Block_Abstract implements Varien_Data_Form_Element_Renderer_Interface {
23
+
24
+ public function render(Varien_Data_Form_Element_Abstract $element)
25
+ {
26
+ $useContainerId = $element->getData('use_container_id');
27
+ return sprintf('<tr class="system-fieldset-sub-head" id="row_%s"><td colspan="5"><h4>%s</h4></td></tr>',
28
+ $element->getHtmlId(), $element->getLabel()
29
+ );
30
+ }
31
+
32
+ }
app/code/community/Magmodules/Fadello/Block/Adminhtml/System/Config/Form/Field/Note.php ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magmodules.eu - http://www.magmodules.eu
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 info@magmodules.eu so we can send you a copy immediately.
14
+ *
15
+ * @category Magmodules
16
+ * @package Magmodules_Fadello
17
+ * @author Magmodules <info@magmodules.eu)
18
+ * @copyright Copyright (c) 2016 (http://www.magmodules.eu)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+
22
+ class Magmodules_Fadello_Block_Adminhtml_System_Config_Form_Field_Note extends Mage_Adminhtml_Block_Abstract implements Varien_Data_Form_Element_Renderer_Interface {
23
+
24
+ public function render(Varien_Data_Form_Element_Abstract $element)
25
+ {
26
+ $useContainerId = $element->getData('use_container_id');
27
+ return sprintf('<tr id="row_%s"><td colspan="5" class="label" style="margin-bottom: 10px;">%s</td></tr>',
28
+ $element->getHtmlId(), $element->getLabel()
29
+ );
30
+ }
31
+
32
+ }
app/code/community/Magmodules/Fadello/Block/Adminhtml/System/Config/Form/Field/Version.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magmodules.eu - http://www.magmodules.eu
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 info@magmodules.eu so we can send you a copy immediately.
14
+ *
15
+ * @category Magmodules
16
+ * @package Magmodules_Fadello
17
+ * @author Magmodules <info@magmodules.eu)
18
+ * @copyright Copyright (c) 2016 (http://www.magmodules.eu)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+
22
+ class Magmodules_Fadello_Block_Adminhtml_System_Config_Form_Field_Version extends Mage_Adminhtml_Block_System_Config_Form_Field {
23
+
24
+ public function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
25
+ {
26
+ return Mage::getConfig()->getNode()->modules->Magmodules_Fadello->version;
27
+ }
28
+
29
+ }
app/code/community/Magmodules/Fadello/Helper/Data.php ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magmodules.eu - http://www.magmodules.eu
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 info@magmodules.eu so we can send you a copy immediately.
14
+ *
15
+ * @category Magmodules
16
+ * @package Magmodules_Fadello
17
+ * @author Magmodules <info@magmodules.eu)
18
+ * @copyright Copyright (c) 2016 (http://www.magmodules.eu)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+
22
+ class Magmodules_Fadello_Helper_Data extends Mage_Core_Helper_Abstract {
23
+
24
+ public function getConfig($storeId = 0, $detailed = 0)
25
+ {
26
+ $api = array();
27
+
28
+ $after_cutoff = Mage::getStoreConfig('shipping/fadello/pu_name', $storeId);
29
+ $cutoff = str_replace(' ', '', Mage::getStoreConfig('shipping/fadello/cutoff_time', $storeId));
30
+ $date = $this->getDate($after_cutoff, $cutoff);
31
+
32
+ $api['api_id'] = Mage::getStoreConfig('shipping/fadello/api_id', $storeId);
33
+ $api['api_token'] = Mage::getStoreConfig('shipping/fadello/api_token', $storeId);
34
+ $api['cutoff_time'] = $cutoff;
35
+ $api['pickup_time'] = str_replace(' ', '', Mage::getStoreConfig('shipping/fadello/pickup_time', $storeId));
36
+ $api['del_time'] = str_replace(' ', '', Mage::getStoreConfig('shipping/fadello/delivery_time', $storeId));
37
+ $api['pu_date'] = $date;
38
+ $api['del_date'] = $date;
39
+ $api['url_params'] = 'apiID=' . $api['api_id'] . '&apitoken=' . $api['api_token'];
40
+ $api['url'] = 'https://api.fadello.nl/desktopmodules/fadello_retailAPI/API/v1/';
41
+ $api['ship_type'] = 'DC';
42
+ $api['label'] = 'PDF';
43
+ if($detailed) {
44
+ $api['pu_name'] = Mage::getStoreConfig('shipping/fadello/pu_name', $storeId);
45
+ $api['pu_street'] = Mage::getStoreConfig('shipping/fadello/pu_street', $storeId);
46
+ $api['pu_homeno'] = Mage::getStoreConfig('shipping/fadello/pu_homeno', $storeId);
47
+ $api['pu_homeno_add'] = Mage::getStoreConfig('shipping/fadello/pu_homeno_add', $storeId);
48
+ $api['pu_postalcode'] = Mage::getStoreConfig('shipping/fadello/pu_postalcode', $storeId);
49
+ $api['pu_city'] = Mage::getStoreConfig('shipping/fadello/pu_city', $storeId);
50
+ $api['pu_country'] = Mage::getStoreConfig('shipping/fadello/pu_country', $storeId);
51
+ $api['pu_phone'] = preg_replace("/[^0-9]/", "", Mage::getStoreConfig('shipping/fadello/pu_phone', $storeId));
52
+ $api['pu_email'] = Mage::getStoreConfig('shipping/fadello/pu_email', $storeId);
53
+ $api['homeno'] = Mage::getStoreConfig('shipping/fadello/seperate_homenumber', $storeId);
54
+ }
55
+ if(!empty($api['api_id']) && !empty($api['api_token'])) {
56
+ return $api;
57
+ }
58
+ }
59
+
60
+ public function isActive()
61
+ {
62
+ $time = date('Hi', Mage::getModel('core/date')->timestamp(time()));
63
+ $day = date('N', Mage::getModel('core/date')->timestamp(time()));
64
+ $availability = @unserialize(Mage::getStoreConfig('carriers/fadello/availability'));
65
+ foreach($availability as $option) {
66
+ if($option['day'] == $day) {
67
+ if(!empty($option['from']) && !empty($option['to'])) {
68
+ $from = str_replace(':', '', $option['from']);
69
+ $to = str_replace(':', '', $option['to']);
70
+ if(($time > $from) && ($time < $to)) {
71
+ return $option;
72
+ }
73
+ }
74
+ }
75
+ }
76
+ return false;
77
+ }
78
+
79
+ public function getDate($after_cutoff = 0, $cutoff)
80
+ {
81
+ $today = Mage::getModel('core/date')->date('d-m-Y');
82
+ $tomorrow = Mage::getModel('core/date')->date("d-m-Y", time() + 86400);
83
+ if($after_cutoff) {
84
+ $time = Mage::getModel('core/date')->date('Hi');
85
+ $cutoff = (str_replace(':', '', $cutoff) + 100);
86
+ if($time > $cutoff) {
87
+ return $tomorrow;
88
+ }
89
+ }
90
+ return $today;
91
+ }
92
+
93
+ public function checkPostcode($postcode)
94
+ {
95
+ $postcode = substr($postcode, 0, 4);
96
+ $non_delivery = array("1791","1792","1793","1794","1795","1796","1797","8881","8882","8883","8884","8885","8891","8892","8893","8894","8895","8896","8897","8899","9161","9162","9163","9164","9166","9988");
97
+ if(!in_array($postcode, $non_delivery)) {
98
+ return true;
99
+ } else {
100
+ return false;
101
+ }
102
+ }
103
+
104
+ }
app/code/community/Magmodules/Fadello/Model/Adminhtml/System/Config/Backend/Design/Availability.php ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magmodules.eu - http://www.magmodules.eu
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 info@magmodules.eu so we can send you a copy immediately.
14
+ *
15
+ * @category Magmodules
16
+ * @package Magmodules_Fadello
17
+ * @author Magmodules <info@magmodules.eu)
18
+ * @copyright Copyright (c) 2016 (http://www.magmodules.eu)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+
22
+ class Magmodules_Fadello_Model_Adminhtml_System_Config_Backend_Design_Availability extends Mage_Adminhtml_Model_System_Config_Backend_Serialized_Array {
23
+
24
+ protected function _beforeSave()
25
+ {
26
+ $value = $this->getValue();
27
+ if(is_array($value)) {
28
+ unset($value['__empty']);
29
+ if(count($value)){
30
+ $value = $this->orderData($value, 'day');
31
+ $keys = array();
32
+ for($i=0; $i < count($value); $i++) {
33
+ $keys[] = 'availability_' . uniqid();
34
+ }
35
+ foreach($value as $key => $field) {
36
+ $from = str_replace('.',':',$field['from']);
37
+ $to = str_replace('.',':',$field['to']);
38
+ if(empty($from)) { $from = '0:00'; }
39
+ if(empty($to)) { $to = '23:59'; }
40
+ if($to == '0:00') { $to = '23:59'; }
41
+ $value[$key]['from'] = $from;
42
+ $value[$key]['to'] = $to;
43
+ $value[$key]['title'] = $field['title'];
44
+ }
45
+ $value = array_combine($keys, array_values($value));
46
+ }
47
+ }
48
+ $this->setValue($value);
49
+ parent::_beforeSave();
50
+ }
51
+
52
+ function orderData($data, $sort)
53
+ {
54
+ $code = "return strnatcmp(\$a['$sort'], \$b['$sort']);";
55
+ usort($data, create_function('$a,$b', $code));
56
+ return $data;
57
+ }
58
+
59
+ }
app/code/community/Magmodules/Fadello/Model/Adminhtml/System/Config/Backend/Design/Shipping.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magmodules.eu - http://www.magmodules.eu
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 info@magmodules.eu so we can send you a copy immediately.
14
+ *
15
+ * @category Magmodules
16
+ * @package Magmodules_Fadello
17
+ * @author Magmodules <info@magmodules.eu)
18
+ * @copyright Copyright (c) 2016 (http://www.magmodules.eu)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+
22
+ class Magmodules_Fadello_Model_Adminhtml_System_Config_Backend_Design_Shipping extends Mage_Adminhtml_Model_System_Config_Backend_Serialized_Array {
23
+
24
+ protected function _beforeSave()
25
+ {
26
+ $value = $this->getValue();
27
+ if(is_array($value)) {
28
+ unset($value['__empty']);
29
+ if(count($value)){
30
+ $value = $this->orderData($value, 'from');
31
+ $keys = array();
32
+ for($i=0; $i < count($value); $i++) {
33
+ $keys[] = 'shipping_' . uniqid();
34
+ }
35
+ foreach($value as $key => $field) {
36
+ $from = str_replace(',','.',$field['from']);
37
+ $to = str_replace(',','.',$field['to']);
38
+ $cost = str_replace(',','.',$field['cost']);
39
+ if(empty($from)) { $from = '0.00'; }
40
+ if(empty($to)) { $to = '100000.00'; }
41
+ if(empty($cost)) { $cost = '0.00'; }
42
+ $value[$key]['from'] = number_format($from, 2, '.', '');
43
+ $value[$key]['to'] = number_format($to, 2, '.', '');
44
+ $value[$key]['cost'] = number_format($cost, 2, '.', '');
45
+ }
46
+ $value = array_combine($keys, array_values($value));
47
+ }
48
+ }
49
+ $this->setValue($value);
50
+ parent::_beforeSave();
51
+ }
52
+
53
+ function orderData($data, $sort)
54
+ {
55
+ $code = "return strnatcmp(\$a['$sort'], \$b['$sort']);";
56
+ usort($data, create_function('$a,$b', $code));
57
+ return $data;
58
+ }
59
+
60
+ }
app/code/community/Magmodules/Fadello/Model/Adminhtml/System/Config/Source/Days.php ADDED
@@ -0,0 +1,37 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magmodules.eu - http://www.magmodules.eu
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 info@magmodules.eu so we can send you a copy immediately.
14
+ *
15
+ * @category Magmodules
16
+ * @package Magmodules_Fadello
17
+ * @author Magmodules <info@magmodules.eu)
18
+ * @copyright Copyright (c) 2016 (http://www.magmodules.eu)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+
22
+ class Magmodules_Fadello_Model_Adminhtml_System_Config_Source_Days {
23
+
24
+ public function toOptionArray()
25
+ {
26
+ $days = array();
27
+ $days[] = array('value'=>'1', 'label'=> Mage::helper('adminhtml')->__('Monday'));
28
+ $days[] = array('value'=>'2', 'label'=> Mage::helper('adminhtml')->__('Tuesday'));
29
+ $days[] = array('value'=>'3', 'label'=> Mage::helper('adminhtml')->__('Wednesday'));
30
+ $days[] = array('value'=>'4', 'label'=> Mage::helper('adminhtml')->__('Thursday'));
31
+ $days[] = array('value'=>'5', 'label'=> Mage::helper('adminhtml')->__('Friday'));
32
+ $days[] = array('value'=>'6', 'label'=> Mage::helper('adminhtml')->__('Saturday'));
33
+ $days[] = array('value'=>'7', 'label'=> Mage::helper('adminhtml')->__('Sunday'));
34
+ return $days;
35
+ }
36
+
37
+ }
app/code/community/Magmodules/Fadello/Model/Api.php ADDED
@@ -0,0 +1,341 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magmodules.eu - http://www.magmodules.eu
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 info@magmodules.eu so we can send you a copy immediately.
14
+ *
15
+ * @category Magmodules
16
+ * @package Magmodules_Fadello
17
+ * @author Magmodules <info@magmodules.eu)
18
+ * @copyright Copyright (c) 2016 (http://www.magmodules.eu)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+
22
+ class Magmodules_Fadello_Model_Api extends Mage_Core_Helper_Abstract {
23
+
24
+ public function createShipment($orderId)
25
+ {
26
+ $result = array();
27
+ $order = Mage::getModel('sales/order')->load($orderId);
28
+ $storeId = $order->getStoreId();
29
+ $config = Mage::helper('fadello')->getConfig($storeId, 1);
30
+
31
+ if(empty($config)) {
32
+ $result['status'] = 'Error';
33
+ $result['error_msg'] = $this->__('Missing API details in Admin');
34
+ return $result;
35
+ }
36
+ if(empty($order)) {
37
+ $result['status'] = 'Error';
38
+ $result['error_msg'] = $this->__('Could not find Order');
39
+ return $result;
40
+ }
41
+
42
+ $post = json_encode($this->getPostOrderArray($config, $order));
43
+
44
+ $request = curl_init();
45
+ $request_url = $config['url'] . 'postOrder?' . $config['url_params'];
46
+ curl_setopt($request, CURLOPT_SSL_VERIFYPEER, false);
47
+ curl_setopt($request, CURLOPT_URL, $request_url);
48
+ curl_setopt($request, CURLOPT_HTTPHEADER, array('Content-Type:application/json'));
49
+ curl_setopt($request, CURLOPT_POST, true);
50
+ curl_setopt($request, CURLOPT_POSTFIELDS, $post);
51
+ curl_setopt($request, CURLOPT_RETURNTRANSFER, true);
52
+ $content = curl_exec($request);
53
+ $api_result = json_decode($content, true);
54
+
55
+ if(!empty($api_result['Status'])) {
56
+ if($api_result['Status'] == 'OK') {
57
+ $trans_id = $api_result['TransID'];
58
+ $deliver_id = $api_result['TransDeliverID'][0]['Deliver1'];
59
+ $barcode = $api_result['TransDeliverID'][0]['Barcode1'];
60
+ $status = 'created';
61
+ $order->setFadelloTransId($trans_id)->setFadelloDeliverId($deliver_id)->setFadelloBarcode($barcode)->setFadelloStatus($status)->save();
62
+ $url = Mage::helper("adminhtml")->getUrl('*/fadello/getPdf', array('order_id' => $orderId));
63
+ $result['status'] = 'Success';
64
+ $result['success_msg'] = $this->__('Fadello shipment created for order, %s', '<a href="' . $url . '">Download PDF</a>');
65
+ return $result;
66
+ } else {
67
+ $result['status'] = $api_result['Status'];
68
+ $result['error_msg'] = 'Fadello API: ' . $api_result['Message'];
69
+ return $result;
70
+ }
71
+ } else {
72
+ $result['status'] = 'Error';
73
+ $result['error_msg'] = $this->__('General error in API call');
74
+ return $result;
75
+ }
76
+ }
77
+
78
+ public function cancelShipment($orderId, $magento = 0)
79
+ {
80
+ $result = array();
81
+ $order = Mage::getModel('sales/order')->load($orderId);
82
+ $storeId = $order->getStoreId();
83
+ $config = Mage::helper('fadello')->getConfig($storeId, 0);
84
+
85
+ if(empty($config)) {
86
+ $result['status'] = 'Error';
87
+ $result['error_msg'] = $this->__('Missing API details in Admin');
88
+ return $result;
89
+ }
90
+ if(empty($order)) {
91
+ $result['status'] = 'Error';
92
+ $result['error_msg'] = $this->__('Could not find Order');
93
+ return $result;
94
+ }
95
+
96
+ $trans_id = $order->getFadelloTransId();
97
+ if(empty($trans_id)) {
98
+ $result['status'] = 'Error';
99
+ $result['error_msg'] = $this->__('TransID Missing');
100
+ return $result;
101
+ }
102
+
103
+ $request = curl_init();
104
+ $request_url = $config['url'] . 'cancelOrder?' . $config['url_params'] . '&transID=' . $trans_id;
105
+ curl_setopt($request, CURLOPT_SSL_VERIFYPEER, false);
106
+ curl_setopt($request, CURLOPT_URL, $request_url);
107
+ curl_setopt($request, CURLOPT_RETURNTRANSFER, true);
108
+ $content = curl_exec($request);
109
+ $api_result = json_decode($content, true);
110
+
111
+ if(!empty($api_result['Status'])) {
112
+ if($api_result['Status'] == 'OK') {
113
+ if(!empty($api_result['ErrorCode'])) {
114
+ $result['status'] = 'Error';
115
+ $result['error_msg'] = 'Fadello API: ' . $api_result['Message'];
116
+ return $result;
117
+ } else {
118
+ $order->setFadelloTransId('')->setFadelloDeliverId('')->setFadelloBarcode('')->setFadelloStatus('');
119
+ if($magento == 1) {
120
+ $shipments = $order->getShipmentsCollection();
121
+ foreach($shipments as $shipment) {
122
+ $shipment->delete();
123
+ }
124
+ $items = $order->getAllVisibleItems();
125
+ foreach($items as $i){
126
+ $i->setQtyShipped(0);
127
+ $i->save();
128
+ }
129
+ $order->setData('state', 'processing')->setStatus('processing');
130
+ }
131
+ $order->save();
132
+ $result['status'] = 'Success';
133
+ $result['success_msg'] = $api_result['Message'];
134
+ return $result;
135
+ }
136
+ } else {
137
+ $result['status'] = $api_result['Status'];
138
+ $result['error_msg'] = $api_result['Message'];
139
+ return $result;
140
+ }
141
+ } else {
142
+ $result['status'] = 'Error';
143
+ $result['error_msg'] = $this->__('General error in API call');
144
+ return $result;
145
+ }
146
+ }
147
+
148
+ public function getPdf($orderId)
149
+ {
150
+ $order = Mage::getModel('sales/order')->load($orderId);
151
+ $storeId = $order->getStoreId();
152
+ $config = Mage::helper('fadello')->getConfig($storeId, 0);
153
+ $result = array();
154
+
155
+ if(empty($config)) {
156
+ $result['status'] = 'Error';
157
+ $result['error_msg'] = $this->__('Missing API details in Admin');
158
+ return $result;
159
+ }
160
+ if(empty($order)) {
161
+ $result['status'] = 'Error';
162
+ $result['error_msg'] = $this->__('Could not find Order');
163
+ return $result;
164
+ }
165
+
166
+ $trans_id = $order->getFadelloTransId();
167
+ $trans_deliver_id = $order->getFadelloDeliverId();
168
+ if(empty($trans_id) || empty($trans_deliver_id)) {
169
+ $result['status'] = 'Error';
170
+ $result['error_msg'] = $this->__('Trans Data Missing');
171
+ return $result;
172
+ }
173
+
174
+ $request = curl_init();
175
+ $request_url = $config['url'] . 'getLabel?' . $config['url_params'] . '&transID=' . $trans_id . '&transDeliverID=' . $trans_deliver_id . '&Lformat=' . $config['label'];
176
+ curl_setopt($request, CURLOPT_SSL_VERIFYPEER, false);
177
+ curl_setopt($request, CURLOPT_URL, $request_url);
178
+ curl_setopt($request, CURLOPT_RETURNTRANSFER, true);
179
+ $content = curl_exec($request);
180
+ $api_result = json_decode($content, true);
181
+
182
+ if(!empty($api_result['Status'])) {
183
+ if($api_result['Status'] == 'OK') {
184
+ $label_url = $api_result['Labelurl'];
185
+ $result['status'] = 'Success';
186
+ $result['increment_id'] = $order->getIncrementId();
187
+ $result['label_url'] = $label_url;
188
+ $result['file_name'] = 'Fadello-' . $order->getIncrementId() . '.pdf';
189
+ return $result;
190
+ } else {
191
+ $result['status'] = $api_result['Status'];
192
+ $result['error_msg'] = $api_result['Message'];
193
+ return $result;
194
+ }
195
+ } else {
196
+ $result['status'] = 'Error';
197
+ $result['error_msg'] = $this->__('General error in API call');
198
+ return $result;
199
+ }
200
+ }
201
+
202
+ public function shipOrder($orderId)
203
+ {
204
+ $order = Mage::getModel('sales/order')->load($orderId);
205
+ $barcode = $order->getFadelloBarcode();
206
+ $storeId = $order->getStoreId();
207
+ $result = array();
208
+
209
+ if(empty($order)) {
210
+ $result['status'] = 'Error';
211
+ $result['error_msg'] = $this->__('Could not find Order');
212
+ return $result;
213
+ }
214
+ if(empty($barcode)) {
215
+ $result['status'] = 'Error';
216
+ $result['error_msg'] = $this->__('Could not find Track & Trace info');
217
+ return $result;
218
+ }
219
+
220
+ $shipments = $order->getShipmentsCollection();
221
+ if(count($shipments)) {
222
+ $result['status'] = 'Error';
223
+ $result['error_msg'] = $this->__('Order %s allready shipped', $order->getInrementId());
224
+ return $result;
225
+ }
226
+
227
+ try {
228
+ $name = Mage::getStoreConfig('carriers/fadello/name');
229
+ $shipment = $order->prepareShipment();
230
+ $arrTracking = array('carrier_code' => 'fadello', 'title' => $name, 'number' => $barcode);
231
+ $track = Mage::getModel('sales/order_shipment_track')->addData($arrTracking);
232
+ $shipment->addTrack($track);
233
+ $shipment->register();
234
+ $shipment->sendEmail(true);
235
+ $shipment->setEmailSent(true);
236
+ $shipment->getOrder()->setIsInProcess(true);
237
+ $transactionSave = Mage::getModel('core/resource_transaction')->addObject($shipment)->addObject($shipment->getOrder())->save();
238
+ unset($shipment);
239
+ } catch (Exception $e) {
240
+ $result['status'] = 'Error';
241
+ $result['error_msg'] = $e->getMessage();
242
+ return $result;
243
+ }
244
+
245
+ $order->setData('state', "complete")->setStatus("complete")->setFadelloStatus('shipped')->save();
246
+ $result['status'] = 'Success';
247
+ $result['success_msg'] = $this->__('Order %s shipped and completed', $order->getInrementId());
248
+ return $result;
249
+ }
250
+
251
+ public function getRegionAvailability($storeId = 0)
252
+ {
253
+ $config = Mage::helper('fadello')->getConfig($storeId, 0);
254
+ $result = array();
255
+ if(empty($config)) {
256
+ $result['status'] = 'Error';
257
+ $result['error_msg'] = $this->__('Missing API details in Admin');
258
+ return $result;
259
+ }
260
+ $request = curl_init();
261
+ $request_url = $config['url'] . 'getRegionAvailability?' . $config['url_params'];
262
+ curl_setopt($request, CURLOPT_SSL_VERIFYPEER, false);
263
+ curl_setopt($request, CURLOPT_URL, $request_url);
264
+ curl_setopt($request, CURLOPT_RETURNTRANSFER, true);
265
+ $content = curl_exec($request);
266
+ $api_result = json_decode($content, true);
267
+
268
+ echo '<pre>';
269
+ print_r($api_result);
270
+ exit;
271
+ }
272
+
273
+ public function getPostOrderArray($config, $order)
274
+ {
275
+ $post = array();
276
+ $post['Name'] = $config['pu_name'];
277
+ $post['Phone'] = $config['pu_phone'];
278
+ $post['YourRef'] = $order->getIncrementId() . time();
279
+ $post['Note'] = '';
280
+ $post['Email'] = $config['pu_email'];
281
+ $post['ShipType'] = $config['ship_type'];
282
+ $post['PUname'] = $config['pu_name'];
283
+ $post['PUstreet'] = $config['pu_street'];
284
+ $post['PUpostalcode'] = $config['pu_postalcode'];
285
+ $post['PUhomeno'] = $config['pu_homeno'];
286
+ $post['PUhomenoAdd'] = $config['pu_homeno_add'];
287
+ $post['PUcity'] = $config['pu_city'];
288
+ $post['PUcountry'] = $config['pu_country'];
289
+ $post['PUphone'] = $config['pu_phone'];
290
+ $post['PUemail'] = $config['pu_email'];
291
+ $post['PUdate'] = $config['pu_date'];
292
+ $post['PUtime'] = $config['pickup_time'];
293
+ $post['PUnote'] = '';
294
+ $post['Deliver'][] = $this->getDeliveryData($config, $order);
295
+ return $post;
296
+ }
297
+
298
+ public function getDeliveryData($config, $order)
299
+ {
300
+ $delivery = array();
301
+ $shippingAddress = $order->getShippingAddress();
302
+ $address = $this->splitStreet($shippingAddress->getStreet(), $config['homeno']);
303
+ $delivery['DELCompanyName'] = $shippingAddress->getData('company');
304
+ $delivery['DELname'] = $shippingAddress->getFirstname() . ' ' . $shippingAddress->getLastname();
305
+ $delivery['DELstreet'] = $address['street'];
306
+ $delivery['DELpostalcode'] = $shippingAddress->getPostcode();
307
+ $delivery['DELhomeno'] = $address['homeno'];
308
+ $delivery['DELhomenoAdd'] = $address['homeno_add'];
309
+ $delivery['DELcity'] = $shippingAddress->getCity();
310
+ $delivery['DELcountry'] = $shippingAddress->getCountry();
311
+ $delivery['DELphone'] = preg_replace("/[^0-9]/", "", $shippingAddress->getTelephone());
312
+ $delivery['DELemail'] = $order->getCustomerEmail();
313
+ $delivery['DELdate'] = $config['del_date'];
314
+ $delivery['DELtime'] = $config['del_time'];
315
+ $delivery['DELAaantalColli'] = 1;
316
+ $delivery['DELbarcodes'] = '';
317
+ $delivery['CreateLabel'] = 'True';
318
+ $delivery['DELnote'] = '';
319
+ return $delivery;
320
+ }
321
+
322
+ public function splitStreet($street_arr, $homeno_sep = 0)
323
+ {
324
+ if($homeno_sep && isset($street_arr[1])) {
325
+ $street = $street_arr[0];
326
+ $homeno_string = str_replace('-', ' ', $street_arr[1]);
327
+ $homeno = reset(array_filter(preg_split("/\D+/", $homeno_string)));
328
+ $homeno_add = trim(str_replace($homeno, '', $homeno_string));
329
+ return array('street' => $street, 'homeno' => $homeno, 'homeno_add' => $homeno_add);
330
+ } else {
331
+ $street = $street_arr[0];
332
+ preg_match('/^([^\d]*[^\d\s]) *(\d.*)$/', $street, $match);
333
+ $street = (isset($match[1])) ? $match[1] : '';
334
+ $homeno_string = (isset($match[2])) ? str_replace('-', ' ', $match[2]) : '';
335
+ $homeno = reset(array_filter(preg_split("/\D+/", $homeno_string)));
336
+ $homeno_add = trim(str_replace($homeno, '', $homeno_string));
337
+ return array('street' => $street, 'homeno' => $homeno, 'homeno_add' => $homeno_add);
338
+ }
339
+ }
340
+
341
+ }
app/code/community/Magmodules/Fadello/Model/Carrier/ShippingMethod.php ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magmodules.eu - http://www.magmodules.eu
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 info@magmodules.eu so we can send you a copy immediately.
14
+ *
15
+ * @category Magmodules
16
+ * @package Magmodules_Fadello
17
+ * @author Magmodules <info@magmodules.eu)
18
+ * @copyright Copyright (c) 2016 (http://www.magmodules.eu)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+
22
+ class Magmodules_Fadello_Model_Carrier_ShippingMethod extends Mage_Shipping_Model_Carrier_Abstract {
23
+
24
+ protected $_code = 'fadello';
25
+
26
+ public function collectRates(Mage_Shipping_Model_Rate_Request $request)
27
+ {
28
+
29
+ if(!$this->getConfigFlag('active')) {
30
+ return false;
31
+ }
32
+
33
+ if(!Mage::getStoreConfig('shipping/fadello/enabled')) {
34
+ return false;
35
+ }
36
+
37
+ if($max_weight = Mage::getStoreConfig('carriers/fadello/weight')) {
38
+ if($request->getPackageWeight() > $max_weight) {
39
+ return false;
40
+ }
41
+ }
42
+
43
+ $active = Mage::helper('fadello')->isActive();
44
+ if(!$active) {
45
+ return false;
46
+ }
47
+
48
+ $postcode = $request->getDestPostcode();
49
+ if(!empty($postcode)) {
50
+ $postcode_check = Mage::helper('fadello')->checkPostcode($request->getDestPostcode());
51
+ if(!$postcode_check) {
52
+ return false;
53
+ }
54
+ }
55
+
56
+ $prices = @unserialize($this->getConfigData('shipping_price'));
57
+ $total = $request->getBaseSubtotalInclTax();
58
+ $shipping_cost = '0.00';
59
+
60
+ foreach($prices as $shipping_price) {
61
+ if(($total >= $shipping_price['from']) && ($total <= $shipping_price['to'])) {
62
+ $shipping_cost = $shipping_price['cost'];
63
+ }
64
+ }
65
+
66
+ $result = Mage::getModel('shipping/rate_result');
67
+ $method = Mage::getModel('shipping/rate_result_method');
68
+ $name = Mage::getStoreConfig('carriers/fadello/name');
69
+
70
+ $method->setCarrier('fadello');
71
+ $method->setCarrierTitle($name);
72
+ $method->setMethod('fadello');
73
+ $method->setMethodTitle($active['title']);
74
+ $method->setPrice($shipping_cost);
75
+ $method->setCost('0.00');
76
+ $result->append($method);
77
+ return $result;
78
+ }
79
+
80
+ public function getAllowedMethods()
81
+ {
82
+ return array($this->_code => $this->getConfigData('name'));
83
+ }
84
+
85
+ }
app/code/community/Magmodules/Fadello/Model/Observer.php ADDED
@@ -0,0 +1,57 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magmodules.eu - http://www.magmodules.eu
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 info@magmodules.eu so we can send you a copy immediately.
14
+ *
15
+ * @category Magmodules
16
+ * @package Magmodules_Fadello
17
+ * @author Magmodules <info@magmodules.eu)
18
+ * @copyright Copyright (c) 2016 (http://www.magmodules.eu)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+
22
+ class Magmodules_Fadello_Model_Observer {
23
+
24
+ public function addDataToOrderGrid($observer)
25
+ {
26
+ $block = $observer->getEvent()->getBlock();
27
+ if($block->getType() == 'adminhtml/sales_order_grid') {
28
+ if(Mage::getStoreConfig('shipping/fadello/enabled')) {
29
+ $block->addColumnAfter('fadello', array(
30
+ 'header' => 'Fadello',
31
+ 'type' => 'text',
32
+ 'index' => 'fadello',
33
+ 'filter' => false,
34
+ 'sortable' => false,
35
+ 'renderer' => 'Magmodules_Fadello_Block_Adminhtml_Renderer_Shipment',
36
+ 'width' => '120px',
37
+ ), 'status');
38
+ }
39
+ }
40
+ }
41
+
42
+ public function salesOrderGridCollectionLoadBefore($observer)
43
+ {
44
+ if(Mage::getStoreConfig('shipping/fadello/enabled')) {
45
+ if(Mage::helper('core')->isModuleEnabled('TIG_PostNL')) {
46
+ if(Mage::helper('postnl')->isEnabled()) {
47
+ return;
48
+ }
49
+ }
50
+ $collection = $observer->getOrderGridCollection();
51
+ $select = $collection->getSelect();
52
+ $select->join('sales_flat_order', 'main_table.entity_id = sales_flat_order.entity_id', array('shipping_method'));
53
+ $select->group('main_table.entity_id');
54
+ }
55
+ }
56
+
57
+ }
app/code/community/Magmodules/Fadello/controllers/Adminhtml/FadelloController.php ADDED
@@ -0,0 +1,111 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magmodules.eu - http://www.magmodules.eu
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 info@magmodules.eu so we can send you a copy immediately.
14
+ *
15
+ * @category Magmodules
16
+ * @package Magmodules_Fadello
17
+ * @author Magmodules <info@magmodules.eu)
18
+ * @copyright Copyright (c) 2016 (http://www.magmodules.eu)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+
22
+ class Magmodules_Fadello_Adminhtml_FadelloController extends Mage_Adminhtml_Controller_Action {
23
+
24
+ public function createShipmentAction()
25
+ {
26
+ $orderId = $this->getRequest()->getParam('order_id');
27
+ if($orderId > 0) {
28
+ $result = Mage::getModel('fadello/api')->createShipment($orderId);
29
+ if(!empty($result['success_msg'])) {
30
+ Mage::getSingleton('core/session')->addSuccess($result['success_msg']);
31
+ }
32
+ if(!empty($result['error_msg'])) {
33
+ Mage::getSingleton('core/session')->addError($result['error_msg']);
34
+ }
35
+ } else {
36
+ $msg = $this->__('Order not found!');
37
+ }
38
+ $this->_redirect('adminhtml/sales_order');
39
+ }
40
+
41
+ public function shipOrderAction()
42
+ {
43
+ $orderId = $this->getRequest()->getParam('order_id');
44
+ if($orderId > 0) {
45
+ $result = Mage::getModel('fadello/api')->shipOrder($orderId);
46
+ if(!empty($result['success_msg'])) {
47
+ Mage::getSingleton('core/session')->addSuccess($result['success_msg']);
48
+ }
49
+ if(!empty($result['error_msg'])) {
50
+ Mage::getSingleton('core/session')->addError($result['error_msg']);
51
+ }
52
+ } else {
53
+ $msg = $this->__('Order not found!');
54
+ Mage::getSingleton('core/session')->addError($msg);
55
+ }
56
+ $this->_redirect('adminhtml/sales_order');
57
+ }
58
+
59
+ public function cancelShipmentAction()
60
+ {
61
+ $orderId = $this->getRequest()->getParam('order_id');
62
+ $magento = $this->getRequest()->getParam('magento');
63
+ if($orderId > 0) {
64
+ $result = Mage::getModel('fadello/api')->cancelShipment($orderId, $magento);
65
+ if(!empty($result['success_msg'])) {
66
+ Mage::getSingleton('core/session')->addSuccess($result['success_msg']);
67
+ }
68
+ if(!empty($result['error_msg'])) {
69
+ Mage::getSingleton('core/session')->addError($result['error_msg']);
70
+ }
71
+ } else {
72
+ $msg = $this->__('Order not found!');
73
+ Mage::getSingleton('core/session')->addError($msg);
74
+ }
75
+ $this->_redirect('adminhtml/sales_order');
76
+ }
77
+
78
+ public function getPdfAction()
79
+ {
80
+ $orderId = $this->getRequest()->getParam('order_id');
81
+ if($orderId > 0) {
82
+ $result = Mage::getModel('fadello/api')->getPdf($orderId);
83
+ if(!empty($result['label_url']) && !empty($result['file_name'])) {
84
+ header('Content-Type: application/pdf');
85
+ header('Content-Disposition: attachment; filename=' . $result['file_name']);
86
+ header('Pragma: no-cache');
87
+ readfile($result['label_url']);
88
+ exit;
89
+ } else {
90
+ if(!empty($result['error_msg'])) {
91
+ Mage::getSingleton('core/session')->addError($result['error_msg']);
92
+ }
93
+ }
94
+ } else {
95
+ $msg = $this->__('Order not found!');
96
+ Mage::getSingleton('core/session')->addError($msg);
97
+ }
98
+ $this->_redirect('adminhtml/sales_order');
99
+ }
100
+
101
+ public function getRegionAvailabilityAction()
102
+ {
103
+ $result = Mage::getModel('fadello/api')->getRegionAvailability();
104
+ }
105
+
106
+ protected function _isAllowed()
107
+ {
108
+ return true;
109
+ }
110
+
111
+ }
app/code/community/Magmodules/Fadello/etc/adminhtml.xml ADDED
@@ -0,0 +1,43 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Magmodules.eu - http://www.magmodules.eu
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to info@magmodules.eu so we can send you a copy immediately.
15
+ *
16
+ * @category Magmodules
17
+ * @package Magmodules_Fadello
18
+ * @author Magmodules <info@magmodules.eu)
19
+ * @copyright Copyright (c) 2016 (http://www.magmodules.eu)
20
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
21
+ */
22
+ -->
23
+ <config>
24
+ <acl>
25
+ <resources>
26
+ <admin>
27
+ <children>
28
+ <system>
29
+ <children>
30
+ <config>
31
+ <children>
32
+ <fadello translate="title" module="fadello">
33
+ <title>Fadello</title>
34
+ </fadello>
35
+ </children>
36
+ </config>
37
+ </children>
38
+ </system>
39
+ </children>
40
+ </admin>
41
+ </resources>
42
+ </acl>
43
+ </config>
app/code/community/Magmodules/Fadello/etc/config.xml ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Magmodules.eu - http://www.magmodules.eu
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to info@magmodules.eu so we can send you a copy immediately.
15
+ *
16
+ * @category Magmodules
17
+ * @package Magmodules_Fadello
18
+ * @author Magmodules <info@magmodules.eu)
19
+ * @copyright Copyright (c) 2016 (http://www.magmodules.eu)
20
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
21
+ */
22
+ -->
23
+ <config>
24
+ <modules>
25
+ <Magmodules_Fadello>
26
+ <version>1.0.0</version>
27
+ </Magmodules_Fadello>
28
+ </modules>
29
+ <global>
30
+ <models>
31
+ <fadello>
32
+ <class>Magmodules_Fadello_Model</class>
33
+ </fadello>
34
+ </models>
35
+ <helpers>
36
+ <fadello>
37
+ <class>Magmodules_Fadello_Helper</class>
38
+ </fadello>
39
+ </helpers>
40
+ <blocks>
41
+ <fadello>
42
+ <class>Magmodules_Fadello_Block</class>
43
+ </fadello>
44
+ </blocks>
45
+ <resources>
46
+ <fadello_setup>
47
+ <setup>
48
+ <module>Magmodules_Fadello</module>
49
+ </setup>
50
+ <connection>
51
+ <use>core_setup</use>
52
+ </connection>
53
+ </fadello_setup>
54
+ </resources>
55
+ </global>
56
+ <adminhtml>
57
+ <translate>
58
+ <modules>
59
+ <magmodules_fadello>
60
+ <files>
61
+ <default>Magmodules_Fadello.csv</default>
62
+ </files>
63
+ </magmodules_fadello>
64
+ </modules>
65
+ </translate>
66
+ <events>
67
+ <core_block_abstract_prepare_layout_before>
68
+ <observers>
69
+ <fadello_core_block_abstract_prepare_layout_before>
70
+ <class>fadello/observer</class>
71
+ <method>addDataToOrderGrid</method>
72
+ </fadello_core_block_abstract_prepare_layout_before>
73
+ </observers>
74
+ </core_block_abstract_prepare_layout_before>
75
+ <sales_order_grid_collection_load_before>
76
+ <observers>
77
+ <fadello_sales_order_grid_collection_load_before>
78
+ <model>fadello/observer</model>
79
+ <method>salesOrderGridCollectionLoadBefore</method>
80
+ </fadello_sales_order_grid_collection_load_before>
81
+ </observers>
82
+ </sales_order_grid_collection_load_before>
83
+ </events>
84
+ </adminhtml>
85
+ <admin>
86
+ <routers>
87
+ <adminhtml>
88
+ <args>
89
+ <modules>
90
+ <magmodules_fadello after="Mage_Adminhtml">Magmodules_Fadello_Adminhtml</magmodules_fadello>
91
+ </modules>
92
+ </args>
93
+ </adminhtml>
94
+ </routers>
95
+ </admin>
96
+ <default>
97
+ <shipping>
98
+ <fadello>
99
+ <cutoff_time>13:00</cutoff_time>
100
+ <cutoff_time>13:00-16:00</cutoff_time>
101
+ <cutoff_time>18:00-22:30</cutoff_time>
102
+ <pu_country>NL</pu_country>
103
+ <show_all_shipments>0</show_all_shipments>
104
+ <after_cutoff>0</after_cutoff>
105
+ <seperate_homenumber>0</seperate_homenumber>
106
+ </fadello>
107
+ </shipping>
108
+ <carriers>
109
+ <fadello>
110
+ <active>1</active>
111
+ <model>Magmodules_Fadello_Model_Carrier_ShippingMethod</model>
112
+ <name>Standaard gratis verzending</name>
113
+ <specificerrmsg>This shipping method is currently unavailable. If you would like to ship using this shipping method, please contact us.</specificerrmsg>
114
+ <sallowspecific>1</sallowspecific>
115
+ <specificcountry>NL</specificcountry>
116
+ <sort_order>10</sort_order>
117
+ </fadello>
118
+ </carriers>
119
+ </default>
120
+ </config>
app/code/community/Magmodules/Fadello/etc/system.xml ADDED
@@ -0,0 +1,414 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Magmodules.eu - http://www.magmodules.eu
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to info@magmodules.eu so we can send you a copy immediately.
15
+ *
16
+ * @category Magmodules
17
+ * @package Magmodules_Fadello
18
+ * @author Magmodules <info@magmodules.eu)
19
+ * @copyright Copyright (c) 2016 (http://www.magmodules.eu)
20
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
21
+ */
22
+ -->
23
+ <config>
24
+ <tabs>
25
+ <magmodules translate="label" module="fadello">
26
+ <label>Magmodules</label>
27
+ <sort_order>200</sort_order>
28
+ </magmodules>
29
+ </tabs>
30
+ <sections>
31
+ <shipping>
32
+ <groups>
33
+ <fadello translate="label" module="fadello">
34
+ <label>Fadello - Same Day Delivery</label>
35
+ <frontend_type>text</frontend_type>
36
+ <sort_order>103</sort_order>
37
+ <show_in_default>1</show_in_default>
38
+ <show_in_website>1</show_in_website>
39
+ <show_in_store>1</show_in_store>
40
+ <fields>
41
+ <about_heading translate="label">
42
+ <label>About the Extension</label>
43
+ <frontend_model>fadello/adminhtml_system_config_form_field_heading</frontend_model>
44
+ <sort_order>1</sort_order>
45
+ <show_in_default>1</show_in_default>
46
+ <show_in_website>1</show_in_website>
47
+ <show_in_store>1</show_in_store>
48
+ </about_heading>
49
+ <about_note translate="label">
50
+ <label><![CDATA[<p>This extension is developed by <a href="http://www.magmodules.eu/">Magmodules</a>. We are a Magento only E-commerce Agency located in the Netherlands.<br></p><p><strong>Read everything about the extension configuration in our <a href="https://www.magmodules.eu/help/fadello" target="_blank">Knowledgebase.</a></strong></p>]]></label>
51
+ <frontend_model>fadello/adminhtml_system_config_form_field_note</frontend_model>
52
+ <sort_order>2</sort_order>
53
+ <show_in_default>1</show_in_default>
54
+ <show_in_website>1</show_in_website>
55
+ <show_in_store>1</show_in_store>
56
+ </about_note>
57
+
58
+ <extension_heading translate="label">
59
+ <label>General Settings</label>
60
+ <frontend_model>fadello/adminhtml_system_config_form_field_heading</frontend_model>
61
+ <sort_order>10</sort_order>
62
+ <show_in_default>1</show_in_default>
63
+ <show_in_website>1</show_in_website>
64
+ <show_in_store>1</show_in_store>
65
+ </extension_heading>
66
+ <version translate="label">
67
+ <label>Extension Version</label>
68
+ <frontend_type>text</frontend_type>
69
+ <frontend_model>fadello/adminhtml_system_config_form_field_version</frontend_model>
70
+ <sort_order>11</sort_order>
71
+ <show_in_default>1</show_in_default>
72
+ <show_in_website>0</show_in_website>
73
+ <show_in_store>0</show_in_store>
74
+ </version>
75
+ <enabled translate="label">
76
+ <label>Enabled</label>
77
+ <frontend_type>select</frontend_type>
78
+ <source_model>adminhtml/system_config_source_yesno</source_model>
79
+ <sort_order>12</sort_order>
80
+ <show_in_default>1</show_in_default>
81
+ <show_in_website>0</show_in_website>
82
+ <show_in_store>0</show_in_store>
83
+ </enabled>
84
+ <api_heading translate="label">
85
+ <label>API Details</label>
86
+ <frontend_model>fadello/adminhtml_system_config_form_field_heading</frontend_model>
87
+ <sort_order>20</sort_order>
88
+ <show_in_default>1</show_in_default>
89
+ <show_in_website>1</show_in_website>
90
+ <show_in_store>1</show_in_store>
91
+ </api_heading>
92
+ <api_note translate="label">
93
+ <label><![CDATA[<p>Enter the API details as supplied by Fadello.<br>Note that Fadello has seperate API keys depending on live and testing environment.</p><br/>]]></label>
94
+ <frontend_model>fadello/adminhtml_system_config_form_field_note</frontend_model>
95
+ <sort_order>21</sort_order>
96
+ <show_in_default>1</show_in_default>
97
+ <show_in_website>1</show_in_website>
98
+ <show_in_store>1</show_in_store>
99
+ </api_note>
100
+ <api_id translate="label">
101
+ <label>API ID</label>
102
+ <frontend_type>text</frontend_type>
103
+ <sort_order>22</sort_order>
104
+ <show_in_default>1</show_in_default>
105
+ <show_in_website>1</show_in_website>
106
+ <show_in_store>1</show_in_store>
107
+ </api_id>
108
+ <api_token translate="label">
109
+ <label>API Key</label>
110
+ <frontend_type>text</frontend_type>
111
+ <sort_order>23</sort_order>
112
+ <show_in_default>1</show_in_default>
113
+ <show_in_website>1</show_in_website>
114
+ <show_in_store>1</show_in_store>
115
+ </api_token>
116
+ <shipping_heading translate="label">
117
+ <label>Shipping Settings</label>
118
+ <frontend_model>fadello/adminhtml_system_config_form_field_heading</frontend_model>
119
+ <sort_order>30</sort_order>
120
+ <show_in_default>1</show_in_default>
121
+ <show_in_website>1</show_in_website>
122
+ <show_in_store>1</show_in_store>
123
+ </shipping_heading>
124
+ <shipping_note translate="label">
125
+ <label><![CDATA[<p>Enter the Cut Off, Pickup and Delivery Time as supplies by Fadello.<br>Note that these settings needs to correspond with the settings in the Fadello dashboard.<br>See the tooltip for default values and representation.</p><br/>]]></label>
126
+ <frontend_model>fadello/adminhtml_system_config_form_field_note</frontend_model>
127
+ <sort_order>31</sort_order>
128
+ <show_in_default>1</show_in_default>
129
+ <show_in_website>1</show_in_website>
130
+ <show_in_store>1</show_in_store>
131
+ </shipping_note>
132
+ <cutoff_time translate="label">
133
+ <label>Cut Off Time</label>
134
+ <frontend_type>text</frontend_type>
135
+ <sort_order>32</sort_order>
136
+ <show_in_default>1</show_in_default>
137
+ <show_in_website>1</show_in_website>
138
+ <show_in_store>1</show_in_store>
139
+ <tooltip>Data as supplied by Fadello, eg. 13:00</tooltip>
140
+ </cutoff_time>
141
+ <pickup_time translate="label">
142
+ <label>Pickup Time</label>
143
+ <frontend_type>text</frontend_type>
144
+ <sort_order>33</sort_order>
145
+ <show_in_default>1</show_in_default>
146
+ <show_in_website>1</show_in_website>
147
+ <show_in_store>1</show_in_store>
148
+ <tooltip>Data as supplied by Fadello, eg. 13:00-16:00</tooltip>
149
+ </pickup_time>
150
+ <delivery_time translate="label">
151
+ <label>Delivery Time</label>
152
+ <frontend_type>text</frontend_type>
153
+ <sort_order>34</sort_order>
154
+ <show_in_default>1</show_in_default>
155
+ <show_in_website>1</show_in_website>
156
+ <show_in_store>1</show_in_store>
157
+ <tooltip>Data as supplied by Fadello, eg. 18:00-22:30</tooltip>
158
+ </delivery_time>
159
+ <sender_heading translate="label">
160
+ <label>Pickup / Label Information</label>
161
+ <frontend_model>fadello/adminhtml_system_config_form_field_heading</frontend_model>
162
+ <sort_order>40</sort_order>
163
+ <show_in_default>1</show_in_default>
164
+ <show_in_website>1</show_in_website>
165
+ <show_in_store>1</show_in_store>
166
+ </sender_heading>
167
+ <sender_note translate="label">
168
+ <label><![CDATA[<p>Enter the pickup information for the packages. This data will also be used on the shipping labels.</p><br/>]]></label>
169
+ <frontend_model>fadello/adminhtml_system_config_form_field_note</frontend_model>
170
+ <sort_order>41</sort_order>
171
+ <show_in_default>1</show_in_default>
172
+ <show_in_website>1</show_in_website>
173
+ <show_in_store>1</show_in_store>
174
+ </sender_note>
175
+ <pu_name translate="label">
176
+ <label>Company Name</label>
177
+ <frontend_type>text</frontend_type>
178
+ <sort_order>42</sort_order>
179
+ <show_in_default>1</show_in_default>
180
+ <show_in_website>1</show_in_website>
181
+ <show_in_store>1</show_in_store>
182
+ </pu_name>
183
+ <pu_street translate="label">
184
+ <label>Street</label>
185
+ <frontend_type>text</frontend_type>
186
+ <sort_order>43</sort_order>
187
+ <show_in_default>1</show_in_default>
188
+ <show_in_website>1</show_in_website>
189
+ <show_in_store>1</show_in_store>
190
+ </pu_street>
191
+ <pu_homeno translate="label">
192
+ <label>Home Number</label>
193
+ <frontend_type>text</frontend_type>
194
+ <sort_order>44</sort_order>
195
+ <show_in_default>1</show_in_default>
196
+ <show_in_website>1</show_in_website>
197
+ <show_in_store>1</show_in_store>
198
+ </pu_homeno>
199
+ <pu_homeno_add translate="label">
200
+ <label>Home Number Addition</label>
201
+ <frontend_type>text</frontend_type>
202
+ <sort_order>45</sort_order>
203
+ <show_in_default>1</show_in_default>
204
+ <show_in_website>1</show_in_website>
205
+ <show_in_store>1</show_in_store>
206
+ </pu_homeno_add>
207
+ <pu_postalcode translate="label">
208
+ <label>Postalcode</label>
209
+ <frontend_type>text</frontend_type>
210
+ <sort_order>46</sort_order>
211
+ <show_in_default>1</show_in_default>
212
+ <show_in_website>1</show_in_website>
213
+ <show_in_store>1</show_in_store>
214
+ </pu_postalcode>
215
+ <pu_city translate="label">
216
+ <label>City</label>
217
+ <frontend_type>text</frontend_type>
218
+ <sort_order>47</sort_order>
219
+ <show_in_default>1</show_in_default>
220
+ <show_in_website>1</show_in_website>
221
+ <show_in_store>1</show_in_store>
222
+ </pu_city>
223
+ <pu_country translate="label">
224
+ <label>Country</label>
225
+ <frontend_type>select</frontend_type>
226
+ <source_model>adminhtml/system_config_source_country</source_model>
227
+ <sort_order>48</sort_order>
228
+ <show_in_default>1</show_in_default>
229
+ <show_in_website>1</show_in_website>
230
+ <show_in_store>1</show_in_store>
231
+ </pu_country>
232
+ <pu_phone translate="label">
233
+ <label>Telephone</label>
234
+ <frontend_type>text</frontend_type>
235
+ <sort_order>49</sort_order>
236
+ <show_in_default>1</show_in_default>
237
+ <show_in_website>1</show_in_website>
238
+ <show_in_store>1</show_in_store>
239
+ </pu_phone>
240
+ <pu_email translate="label">
241
+ <label>Email</label>
242
+ <frontend_type>text</frontend_type>
243
+ <sort_order>50</sort_order>
244
+ <show_in_default>1</show_in_default>
245
+ <show_in_website>1</show_in_website>
246
+ <show_in_store>1</show_in_store>
247
+ </pu_email>
248
+ <general_heading translate="label">
249
+ <label>General Settings</label>
250
+ <frontend_model>fadello/adminhtml_system_config_form_field_heading</frontend_model>
251
+ <sort_order>60</sort_order>
252
+ <show_in_default>1</show_in_default>
253
+ <show_in_website>1</show_in_website>
254
+ <show_in_store>1</show_in_store>
255
+ </general_heading>
256
+ <seperate_homenumber translate="label">
257
+ <label>Home Number on second street</label>
258
+ <frontend_type>select</frontend_type>
259
+ <source_model>adminhtml/system_config_source_yesno</source_model>
260
+ <sort_order>62</sort_order>
261
+ <show_in_default>1</show_in_default>
262
+ <show_in_website>1</show_in_website>
263
+ <show_in_store>1</show_in_store>
264
+ <tooltip>Set this value to yes when using the second street as House number field</tooltip>
265
+ </seperate_homenumber>
266
+ <after_cutoff translate="label">
267
+ <label>Allow Shipment after Cut Off Time</label>
268
+ <frontend_type>select</frontend_type>
269
+ <source_model>adminhtml/system_config_source_yesno</source_model>
270
+ <sort_order>63</sort_order>
271
+ <show_in_default>1</show_in_default>
272
+ <show_in_website>1</show_in_website>
273
+ <show_in_store>1</show_in_store>
274
+ <tooltip>Enable this function to create shipments for next day. Will be available one hour after Cut Off Time.</tooltip>
275
+ </after_cutoff>
276
+ <show_all_shipments translate="label">
277
+ <label>Allow Shipment for non-Fadello orders</label>
278
+ <frontend_type>select</frontend_type>
279
+ <source_model>adminhtml/system_config_source_yesno</source_model>
280
+ <sort_order>64</sort_order>
281
+ <show_in_default>1</show_in_default>
282
+ <show_in_website>0</show_in_website>
283
+ <show_in_store>0</show_in_store>
284
+ <tooltip>Enable this function to create shipments in depend of the selected shipment carrier.</tooltip>
285
+ </show_all_shipments>
286
+ </fields>
287
+ </fadello>
288
+ </groups>
289
+ </shipping>
290
+ <carriers>
291
+ <groups>
292
+ <fadello translate="label" module="fadello">
293
+ <label>Fadello - Same Day Delivery</label>
294
+ <frontend_type>text</frontend_type>
295
+ <sort_order>103</sort_order>
296
+ <show_in_default>1</show_in_default>
297
+ <show_in_website>1</show_in_website>
298
+ <show_in_store>1</show_in_store>
299
+ <fields>
300
+ <active translate="label">
301
+ <label>Enabled</label>
302
+ <frontend_type>select</frontend_type>
303
+ <source_model>adminhtml/system_config_source_yesno</source_model>
304
+ <sort_order>1</sort_order>
305
+ <show_in_default>1</show_in_default>
306
+ <show_in_website>1</show_in_website>
307
+ <show_in_store>1</show_in_store>
308
+ </active>
309
+ <title translate="label">
310
+ <label>Method title</label>
311
+ <frontend_type>text</frontend_type>
312
+ <sort_order>2</sort_order>
313
+ <show_in_default>1</show_in_default>
314
+ <show_in_website>1</show_in_website>
315
+ <show_in_store>1</show_in_store>
316
+ </title>
317
+ <sort_order translate="label">
318
+ <label>Sort Order</label>
319
+ <frontend_type>text</frontend_type>
320
+ <sort_order>3</sort_order>
321
+ <show_in_default>1</show_in_default>
322
+ <show_in_website>1</show_in_website>
323
+ <show_in_store>0</show_in_store>
324
+ </sort_order>
325
+ <price_heading translate="label">
326
+ <label>Pricing</label>
327
+ <frontend_model>fadello/adminhtml_system_config_form_field_heading</frontend_model>
328
+ <sort_order>10</sort_order>
329
+ <show_in_default>1</show_in_default>
330
+ <show_in_website>1</show_in_website>
331
+ <show_in_store>1</show_in_store>
332
+ </price_heading>
333
+ <price_note translate="label">
334
+ <label><![CDATA[<p>Set the shipping price rules by using a from and to price.<br>For eg. a €5.00 shipping price for all orders under €100.00 needs to be configured with the start price of 0.00 and the end price of 100.00.</p><br/>]]></label>
335
+ <frontend_model>fadello/adminhtml_system_config_form_field_note</frontend_model>
336
+ <sort_order>11</sort_order>
337
+ <show_in_default>1</show_in_default>
338
+ <show_in_website>1</show_in_website>
339
+ <show_in_store>1</show_in_store>
340
+ </price_note>
341
+ <shipping_price>
342
+ <label>Shipping Price</label>
343
+ <frontend_model>fadello/adminhtml_config_form_field_shipping</frontend_model>
344
+ <backend_model>fadello/adminhtml_system_config_backend_design_shipping</backend_model>
345
+ <sort_order>12</sort_order>
346
+ <show_in_default>1</show_in_default>
347
+ <show_in_website>1</show_in_website>
348
+ <show_in_store>1</show_in_store>
349
+ </shipping_price>
350
+ <availability_heading translate="label">
351
+ <label>Availability</label>
352
+ <frontend_model>fadello/adminhtml_system_config_form_field_heading</frontend_model>
353
+ <sort_order>30</sort_order>
354
+ <show_in_default>1</show_in_default>
355
+ <show_in_website>1</show_in_website>
356
+ <show_in_store>1</show_in_store>
357
+ </availability_heading>
358
+ <availability_note translate="label">
359
+ <label><![CDATA[<p>Set the availability and naming of the method based on time and day.<br>For eg. offer Sameday Delivery on weekdays before 13:00 and offer Nextday Evening Delivery between 13:00 and 23:59.<br>You can use different descriptions for these timespans, like: "Maandagavond levering 18:00-22:30".</p><br/>]]></label>
360
+ <frontend_model>fadello/adminhtml_system_config_form_field_note</frontend_model>
361
+ <sort_order>31</sort_order>
362
+ <show_in_default>1</show_in_default>
363
+ <show_in_website>1</show_in_website>
364
+ <show_in_store>1</show_in_store>
365
+ </availability_note>
366
+ <availability>
367
+ <label>Method Availability</label>
368
+ <frontend_model>fadello/adminhtml_config_form_field_availability</frontend_model>
369
+ <backend_model>fadello/adminhtml_system_config_backend_design_availability</backend_model>
370
+ <sort_order>32</sort_order>
371
+ <show_in_default>1</show_in_default>
372
+ <show_in_website>1</show_in_website>
373
+ <show_in_store>1</show_in_store>
374
+ </availability>
375
+ <heading_sort translate="label">
376
+ <label>Limitations</label>
377
+ <frontend_model>fadello/adminhtml_system_config_form_field_heading</frontend_model>
378
+ <sort_order>90</sort_order>
379
+ <show_in_default>1</show_in_default>
380
+ <show_in_website>1</show_in_website>
381
+ <show_in_store>1</show_in_store>
382
+ </heading_sort>
383
+ <weight translate="label">
384
+ <label>Maximum weight</label>
385
+ <frontend_type>text</frontend_type>
386
+ <sort_order>91</sort_order>
387
+ <show_in_default>1</show_in_default>
388
+ <show_in_website>1</show_in_website>
389
+ <show_in_store>1</show_in_store>
390
+ <tooltip>Fill in the Maximum weight of a shipment with the same data format as used in the Products.</tooltip>
391
+ </weight>
392
+ <showmethod translate="label">
393
+ <label>Show Method if Not Applicable</label>
394
+ <frontend_type>select</frontend_type>
395
+ <sort_order>93</sort_order>
396
+ <source_model>adminhtml/system_config_source_yesno</source_model>
397
+ <show_in_default>1</show_in_default>
398
+ <show_in_website>1</show_in_website>
399
+ <show_in_store>0</show_in_store>
400
+ </showmethod>
401
+ <specificerrmsg translate="label">
402
+ <label>Displayed Error Message</label>
403
+ <frontend_type>textarea</frontend_type>
404
+ <sort_order>94</sort_order>
405
+ <show_in_default>1</show_in_default>
406
+ <show_in_website>1</show_in_website>
407
+ <show_in_store>1</show_in_store>
408
+ </specificerrmsg>
409
+ </fields>
410
+ </fadello>
411
+ </groups>
412
+ </carriers>
413
+ </sections>
414
+ </config>
app/code/community/Magmodules/Fadello/sql/fadello_setup/mysql4-install-0.9.0.php ADDED
@@ -0,0 +1,66 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Magmodules.eu - http://www.magmodules.eu
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 info@magmodules.eu so we can send you a copy immediately.
14
+ *
15
+ * @category Magmodules
16
+ * @package Magmodules_Fadello
17
+ * @author Magmodules <info@magmodules.eu)
18
+ * @copyright Copyright (c) 2016 (http://www.magmodules.eu)
19
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ */
21
+
22
+ $installer = new Mage_Sales_Model_Mysql4_Setup('core_setup');
23
+ $installer->startSetup();
24
+
25
+ $installer->addAttribute('order', 'fadello_trans_id', array(
26
+ 'type' => 'varchar',
27
+ 'default' => NULL,
28
+ 'label' => 'Fadello: TransID',
29
+ 'visible' => false,
30
+ 'required' => false,
31
+ 'visible_on_front' => false,
32
+ 'user_defined' => false,
33
+ ));
34
+
35
+ $installer->addAttribute('order', 'fadello_deliver_id', array(
36
+ 'type' => 'varchar',
37
+ 'default' => NULL,
38
+ 'label' => 'Fadello: TransDeliverID',
39
+ 'visible' => false,
40
+ 'required' => false,
41
+ 'visible_on_front' => false,
42
+ 'user_defined' => false,
43
+ ));
44
+
45
+ $installer->addAttribute('order', 'fadello_barcode', array(
46
+ 'type' => 'varchar',
47
+ 'default' => NULL,
48
+ 'label' => 'Fadello: Barcode',
49
+ 'visible' => false,
50
+ 'required' => false,
51
+ 'visible_on_front' => false,
52
+ 'user_defined' => false,
53
+ ));
54
+
55
+ $installer->addAttribute('order', 'fadello_status', array(
56
+ 'type' => 'varchar',
57
+ 'default' => NULL,
58
+ 'label' => 'Fadello: Status',
59
+ 'visible' => false,
60
+ 'required' => false,
61
+ 'visible_on_front' => false,
62
+ 'user_defined' => false,
63
+ ));
64
+
65
+ $installer->getConnection()->addColumn($this->getTable('sales/order_grid'), 'fadello_status', 'varchar(255) not null default ""');
66
+ $installer->endSetup();
app/etc/modules/Magmodules_Fadello.xml ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ /**
4
+ * Magmodules.eu - http://www.magmodules.eu
5
+ *
6
+ * NOTICE OF LICENSE
7
+ *
8
+ * This source file is subject to the Open Software License (OSL 3.0)
9
+ * that is bundled with this package in the file LICENSE.txt.
10
+ * It is also available through the world-wide-web at this URL:
11
+ * http://opensource.org/licenses/osl-3.0.php
12
+ * If you did not receive a copy of the license and are unable to
13
+ * obtain it through the world-wide-web, please send an email
14
+ * to info@magmodules.eu so we can send you a copy immediately.
15
+ *
16
+ * @category Magmodules
17
+ * @package Magmodules_Fadello
18
+ * @author Magmodules <info@magmodules.eu)
19
+ * @copyright Copyright (c) 2016 (http://www.magmodules.eu)
20
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
21
+ */
22
+ -->
23
+ <config>
24
+ <modules>
25
+ <Magmodules_Fadello>
26
+ <active>true</active>
27
+ <codePool>community</codePool>
28
+ </Magmodules_Fadello>
29
+ </modules>
30
+ </config>
app/locale/en_US/Magmodules_Fadello.csv ADDED
@@ -0,0 +1,45 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "<p>This extension is developed by <a href="http://www.magmodules.eu/">Magmodules</a>. We are a Magento only E-commerce Agency located in the Netherlands.<br></p><p><strong>Read everything about the extension configuration in our <a href="https://www.magmodules.eu/help/fadello" target="_blank">Knowledgebase.</a></strong></p>","<p>This extension is developed by <a href="http://www.magmodules.eu/">Magmodules</a>. We are a Magento only E-commerce Agency located in the Netherlands.<br></p><p><strong>Read everything about the extension configuration in our <a href="https://www.magmodules.eu/help/fadello" target="_blank">Knowledgebase.</a></strong></p>"
2
+ "About the Extension","About the Extension"
3
+ "General Settings","General Settings"
4
+ "Enabled","Enabled"
5
+ "Method title","Method title"
6
+ "Sort Order","Sort Order"
7
+ "Calculation","Calculation"
8
+ "API ID","API ID"
9
+ "API Key","API Key"
10
+ "Shipping Settings","Shipping Settings"
11
+ "<p>Enter the Cut Off, Pickup and Delivery Time as supplies by Fadello.<br>Note that these settings needs to correspond with the settings in the Fadello dashboard.<br>See the tooltip for default values and representation.</p><br/>","<p>Enter the Cut Off, Pickup and Delivery Time as supplies by Fadello.<br>Note that these settings needs to correspond with the settings in the Fadello dashboard.<br>See the tooltip for default values and representation.</p><br/>"
12
+ "Cut Off Time","Cut Off Time"
13
+ "Data as supplied by Fadello, eg. 13:00","Data as supplied by Fadello, eg. 13:00"
14
+ "Pickup Time","Pickup Time"
15
+ "Data as supplied by Fadello, eg. 13:00-16:00","Data as supplied by Fadello, eg. 13:00-16:00"
16
+ "Delivery Time","Delivery Time"
17
+ "Data as supplied by Fadello, eg. 18:00-22:30","Data as supplied by Fadello, eg. 18:00-22:30"
18
+ "Pickup / Label Information","Pickup / Label Information"
19
+ "<p>Enter the pickup information for the packages. This data will also be used on the shipping labels.</p><br/>","<p>Enter the pickup information for the packages. This data will also be used on the shipping labels.</p><br/>"
20
+ "Company Name","Company Name"
21
+ "Street","Street"
22
+ "Home Number","Home Number"
23
+ "Home Number Addition","Home Number Addition"
24
+ "Postalcode","Postalcode"
25
+ "City","City"
26
+ "Country","Country"
27
+ "Telephone","Telephone"
28
+ "Email","Email"
29
+ "General Settings","General Settings"
30
+ "Home Number on second street","Home Number on second street"
31
+ "Set this value to yes when using the second street as House number field","Set this value to yes when using the second street as House number field"
32
+ "Enable this function to create shipments for next day. Will be available one hour after Cut Off Time.","Enable this function to create shipments for next day. Will be available one hour after Cut Off Time."
33
+ "Enable this function to create shipments in depend of the selected shipment carrier.","Enable this function to create shipments in depend of the selected shipment carrier."
34
+ "Fadello - Same Day Delivery","Fadello - Same Day Delivery"
35
+ "Pricing","Pricing"
36
+ "<p>Set the shipping price rules by using a from and to price.<br>For eg. a €5.00 shipping price for all orders under €100.00 needs to be configured with the start price of 0.00 and the end price of 100.00.</p><br/>","<p>Set the shipping price rules by using a from and to price.<br>For eg. a €5.00 shipping price for all orders under €100.00 needs to be configured with the start price of 0.00 and the end price of 100.00.</p><br/>"
37
+ "Shipping Price","Shipping Price"
38
+ "Availability","Availability"
39
+ "<p>Set the availability and naming of the method based on time and day.<br>For eg. offer Sameday Delivery on weekdays before 13:00 and offer Nextday Evening Delivery between 13:00 and 23:59.<br>You can use different descriptions for these timespans, like: "Maandagavond levering 18:00-22:30".</p><br/>","<p>Set the availability and naming of the method based on time and day.<br>For eg. offer Sameday Delivery on weekdays before 13:00 and offer Nextday Evening Delivery between 13:00 and 23:59.<br>You can use different descriptions for these timespans, like: "Maandagavond levering 18:00-22:30".</p><br/>"
40
+ "Method Availability","Method Availability"
41
+ "Limitations","Limitations"
42
+ "Maximum weight","Maximum weight"
43
+ "Fill in the Maximum weight of a shipment with the same data format as used in the Products.","Fill in the Maximum weight of a shipment with the same data format as used in the Products."
44
+ "Show Method if Not Applicable","Show Method if Not Applicable"
45
+ "Displayed Error Message","Displayed Error Message"
app/locale/nl_NL/Magmodules_Fadello.csv ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ "<p>This extension is developed by <a href="http://www.magmodules.eu/">Magmodules</a>. We are a Magento only E-commerce Agency located in the Netherlands.<br></p><p><strong>Read everything about the extension configuration in our <a href="https://www.magmodules.eu/help/fadello" target="_blank">Knowledgebase.</a></strong></p>","<p>Deze extensie is ontwikkeld door <a href="http://www.magmodules.eu/">Magmodules</a>.</p><p><strong>Meer informatie over de configuratie van deze extensie zijn te vinden in onze<a href="https://www.magmodules.eu/help/fadello" target="_blank">Knowledgebase.</a></strong></p>"
2
+ "About the Extension","Over deze extensie"
3
+ "General Settings","Algemene instellingen"
4
+ "Enabled","Enabled"
5
+ "Method title","Methode titel"
6
+ "Sort Order","Volgorde"
7
+ "Calculation","Berekening"
8
+ "Extension Version","Extensie versie"
9
+ "API ID","API ID"
10
+ "API Key","API Key"
11
+ "Shipping Settings","Verzendopties"
12
+ "<p>Enter the Cut Off, Pickup and Delivery Time as supplies by Fadello.<br>Note that these settings needs to correspond with the settings in the Fadello dashboard.<br>See the tooltip for default values and representation.</p><br/>","<p>Voer de Cut Off in, de haal- en Levertijd in zoals geleverd door Fadello.<br>Let op, deze instellingen moeten overeen komen met de instellingen in het Fadello Dashboard.<br>Bekijk de tooltip voor standaard waardes en voorbeelden.</p><br/>"
13
+ "Cut Off Time","Cut Off Time"
14
+ "Data as supplied by Fadello, eg. 13:00","Data zoals aangegeven door Fadello, als. 13:00"
15
+ "Pickup Time","Afhaaltijd"
16
+ "Data as supplied by Fadello, eg. 13:00-16:00","Data zoals aangegeven door Fadello, als. 13:00-16:00"
17
+ "Delivery Time","Aflevertijd"
18
+ "Data as supplied by Fadello, eg. 18:00-22:30","Data zoals aangegeven door Fadello, als. 18:00-22:30"
19
+ "Pickup / Label Information","Afhaal / Label Information"
20
+ "<p>Enter the pickup information for the packages. This data will also be used on the shipping labels.</p><br/>","<p>Voer de pick-up informatie in voor de pakketten. Deze gegevens zullen ook gebruikt worden op de verzendlabels.</p><br/>"
21
+ "Company Name","Bedrijfsnaam"
22
+ "Street","Straat"
23
+ "Home Number","Huisnummer"
24
+ "Home Number Addition","Huisnummer toevoeging"
25
+ "Postalcode","Postcode"
26
+ "City","Stad"
27
+ "Country","Land"
28
+ "Telephone","Telefoon"
29
+ "Email","Email"
30
+ "General Settings","Algemene instellingen"
31
+ "Home Number on second street","Huisnummer op tweede adres regel"
32
+ "Set this value to yes when using the second street as House number field","Activeer deze optie wanneer het huisnummer op de tweede adresregels wordt ingevoerd."
33
+ "Enable this function to create shipments for next day. Will be available one hour after Cut Off Time.","Activeer deze optie om een verzending voor de volgende dag aan te maken. Deze optie is beschikbaar één uur na de Cut off Time."
34
+ "Enable this function to create shipments in depend of the selected shipment carrier.","Activeer deze optie om een verzending aan te maken voor de geselecteerde verzendservice."
35
+ "Fadello - Same Day Delivery","Fadello - Same Day Delivery"
36
+ "Pricing","Prijsstelling"
37
+ "<p>Set the shipping price rules by using a from and to price.<br>For eg. a €5.00 shipping price for all orders under €100.00 needs to be configured with the start price of 0.00 and the end price of 100.00.</p><br/>","<p>Stel de verzendprijs in met een van en tot prijs.<br>Als voorbeeld. Voor een verzendprijs van €5.00 voor alle bestellingen onder de €100.00 moet deze geconfigureerd worden met een start prijs van 0.00 en een eind prijs van 100.00.</p><br/>"
38
+ "Shipping Price","Verzendkosten"
39
+ "Availability","Beschikbaarheid"
40
+ "<p>Set the availability and naming of the method based on time and day.<br>For eg. offer Sameday Delivery on weekdays before 13:00 and offer Nextday Evening Delivery between 13:00 and 23:59.<br>You can use different descriptions for these timespans, like: ""Maandagavond levering 18:00-22:30"".</p><br/>","<p>Stel de beschikbaarheid en benaming van de methode in op basis van de tijd van de dag.<br>Als voorbeeld, toon de Sameday Delivery op werkdagen voor 13:00 en bied avondlevering voor de volgende dag aan tussen 13:00 and 23:59.<br>Je kunt hier verschillende tijden gebruiken, als: ""Maandagavond levering 18:00-22:30"".</p><br/>"
41
+ "Method Availability","Beschikbaarheid Methode"
42
+ "Limitations","Limieten"
43
+ "Maximum weight","Maximale gewicht"
44
+ "Fill in the Maximum weight of a shipment with the same data format as used in the Products.","Voer het maximale gewicht in van dee verzending in de zelfde notering als bij de producten."
45
+ "Show Method if Not Applicable","Toon verzendmethode indien niet beschikbaar"
46
+ "Displayed Error Message","Toon foutmelding"
47
+ "<p>Enter the API details as supplied by Fadello.<br>Note that Fadello has seperate API keys depending on live and testing environment.</p><br/>","<p>Voer de API gegevens in zoals uitgeleverd door Fadello.<br>Let op dat Fadello verschillende API keys heeft voor de test en live omgeving.</p><br/>"
48
+ "Allow Shipment after Cut Off Time","Sta verzendingen toe na de Cut Off Tijd"
49
+ "Allow Shipment for non-Fadello orders","Sta verzendingen toe voor niet-Fadello bestellingen"
50
+ "Create Shipment","Verzending aanmaken"
51
+ "Cancel this Fadello Shipment","Annuleer deze Fadello verzending"
52
+ "Open PDF","Open PDF"
53
+ "Ship This Order","Verzend deze bestelling"
package.xml ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>Magmodules_Fadello</name>
4
+ <version>1.0.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://www.magmodules.eu/license-agreement/">Single Server License</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Fadello</summary>
10
+ <description>Fadello</description>
11
+ <notes>Fadello</notes>
12
+ <authors><author><name>Magmodules</name><user>magmodules</user><email>info@magmodules.nl</email></author></authors>
13
+ <date>2016-08-02</date>
14
+ <time>07:08:03</time>
15
+ <contents><target name="magecommunity"><dir name="Magmodules"><dir name="Fadello"><dir name="Block"><dir name="Adminhtml"><dir name="Config"><dir name="Form"><dir name="Field"><file name="Availability.php" hash="3ca04582154a7c55051c3b4a843b82c0"/><file name="Shipping.php" hash="e1bbb26e620b7269ea4bcc8e7eff81ac"/></dir><dir name="Renderer"><file name="Select.php" hash="770fd3597fad245a655bee1b1a86fd46"/></dir></dir></dir><dir name="Renderer"><file name="Shipment.php" hash="2908611db82f846bc6df44d0845c7692"/></dir><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><file name="Heading.php" hash="2a778e2d0aa145a7d12ee88ea2082b6e"/><file name="Note.php" hash="34b57d1f8c3b7b6cdaa3312b4a5828f9"/><file name="Version.php" hash="bda96116253c194a69659c53ddafd8d8"/></dir></dir></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="2193a17e21310fdb5b3fc4ba16ed034a"/></dir><dir name="Model"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Backend"><dir name="Design"><file name="Availability.php" hash="664f4fc9fbade8cbb0b3ea32c6727034"/><file name="Shipping.php" hash="782c035cd9b166a8dfd9870c4baebda4"/></dir></dir><dir name="Source"><file name="Days.php" hash="a6c2e096106c17edcc055f88b1283888"/></dir></dir></dir></dir><file name="Api.php" hash="e88ac84bc65eb994c421bf404bdcd7ed"/><dir name="Carrier"><file name="ShippingMethod.php" hash="5620479cd7cac46ebce2b0354f69bd08"/></dir><file name="Observer.php" hash="a8dc7dae0ef690b7ccfabbdca317c4e2"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="FadelloController.php" hash="a7d18c9a84f5f87d3350dd84e30c85b8"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="55c39cbc0f74e4b9a62f5e309fd89709"/><file name="config.xml" hash="550346b0d6a26294d24f1b4bcc394f1d"/><file name="system.xml" hash="6ef8d620f46c6a1a6eed71a126df38d0"/></dir><dir name="sql"><dir name="fadello_setup"><file name="mysql4-install-0.9.0.php" hash="b0ec553fd5f0a731e2cfd1df5ddbe05a"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Magmodules_Fadello.xml" hash="88ffa276bf54b6a8fca175074abcb24c"/></dir></target><target name="magelocale"><dir><dir name="en_US"><file name="Magmodules_Fadello.csv" hash="448bf4573d58d11e99b8233d0a13db08"/></dir><dir name="nl_NL"><file name="Magmodules_Fadello.csv" hash="aa1a40890c587719b05711b8f1e16709"/></dir></dir></target><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="images"><dir name="fadello"><file name="close.png" hash="c057a83b891418703c155c9a1382f8b9"/><file name="export.png" hash="21cef3823db6739081aea971e5789fa9"/><file name="pdf.png" hash="8df694ac11eae7090ccad5062b415020"/><file name="ship.png" hash="05c70f071c5d3cfe6ffa86a1cd3561f7"/></dir></dir></dir></dir></dir></target></contents>
16
+ <compatible/>
17
+ <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
18
+ </package>
skin/adminhtml/default/default/images/fadello/close.png ADDED
Binary file
skin/adminhtml/default/default/images/fadello/export.png ADDED
Binary file
skin/adminhtml/default/default/images/fadello/pdf.png ADDED
Binary file
skin/adminhtml/default/default/images/fadello/ship.png ADDED
Binary file