Magmodules_Fadello - Version 1.0.2

Version Notes

Fadello

Download this release

Release Info

Developer Magmodules
Extension Magmodules_Fadello
Version 1.0.2
Comparing to
See all releases


Code changes from version 1.0.1 to 1.0.2

Files changed (25) hide show
  1. app/code/community/Magmodules/Fadello/Block/Adminhtml/Config/Form/Field/Availability.php +58 -40
  2. app/code/community/Magmodules/Fadello/Block/Adminhtml/Config/Form/Field/Shipping.php +50 -37
  3. app/code/community/Magmodules/Fadello/Block/Adminhtml/Config/Form/Renderer/Select.php +132 -122
  4. app/code/community/Magmodules/Fadello/Block/Adminhtml/Renderer/Shipment.php +69 -38
  5. app/code/community/Magmodules/Fadello/Block/Adminhtml/System/Config/Form/Field/Heading.php +18 -11
  6. app/code/community/Magmodules/Fadello/Block/Adminhtml/System/Config/Form/Field/Note.php +19 -12
  7. app/code/community/Magmodules/Fadello/Block/Adminhtml/System/Config/Form/Field/Version.php +16 -10
  8. app/code/community/Magmodules/Fadello/Helper/Data.php +139 -84
  9. app/code/community/Magmodules/Fadello/Model/Adminhtml/System/Config/Backend/Design/Availability.php +57 -35
  10. app/code/community/Magmodules/Fadello/Model/Adminhtml/System/Config/Backend/Design/Shipping.php +58 -36
  11. app/code/community/Magmodules/Fadello/Model/Adminhtml/System/Config/Source/Days.php +23 -20
  12. app/code/community/Magmodules/Fadello/Model/Api.php +359 -327
  13. app/code/community/Magmodules/Fadello/Model/Carrier/ShippingMethod.php +148 -56
  14. app/code/community/Magmodules/Fadello/Model/Observer.php +41 -47
  15. app/code/community/Magmodules/Fadello/controllers/Adminhtml/FadelloController.php +110 -92
  16. app/code/community/Magmodules/Fadello/etc/adminhtml.xml +20 -23
  17. app/code/community/Magmodules/Fadello/etc/config.xml +88 -98
  18. app/code/community/Magmodules/Fadello/etc/system.xml +122 -115
  19. app/code/community/Magmodules/Fadello/sql/fadello_setup/mysql4-install-0.9.0.php +55 -45
  20. app/design/frontend/base/default/layout/magmodules_fadello.xml +28 -7
  21. app/etc/modules/Magmodules_Fadello.xml +19 -21
  22. app/locale/en_US/Magmodules_Fadello.csv +1 -2
  23. app/locale/nl_NL/Magmodules_Fadello.csv +2 -2
  24. package.xml +4 -4
  25. skin/frontend/base/default/magmodules/fadello/style.css +19 -16
app/code/community/Magmodules/Fadello/Block/Adminhtml/Config/Form/Field/Availability.php CHANGED
@@ -1,9 +1,8 @@
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:
@@ -12,59 +11,78 @@
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
  }
1
+ <?php
2
  /**
3
  * Magmodules.eu - http://www.magmodules.eu
4
  *
5
  * NOTICE OF LICENSE
 
6
  * This source file is subject to the Open Software License (OSL 3.0)
7
  * that is bundled with this package in the file LICENSE.txt.
8
  * It is also available through the world-wide-web at this URL:
11
  * obtain it through the world-wide-web, please send an email
12
  * to info@magmodules.eu so we can send you a copy immediately.
13
  *
14
+ * @category Magmodules
15
+ * @package Magmodules_Fadello
16
+ * @author Magmodules <info@magmodules.eu>
17
+ * @copyright Copyright (c) 2017 (http://www.magmodules.eu)
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
20
 
21
+ class Magmodules_Fadello_Block_Adminhtml_Config_Form_Field_Availability
22
+ extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
23
+ {
24
 
25
+ protected $_renders = array();
26
 
27
+ /**
28
+ * Magmodules_Fadello_Block_Adminhtml_Config_Form_Field_Availability constructor.
29
+ */
30
+ public function __construct()
31
+ {
32
  $layout = Mage::app()->getFrontController()->getAction()->getLayout();
33
+ $rendererDays = $layout->createBlock(
34
+ 'fadello/adminhtml_config_form_renderer_select', '',
35
+ array('is_render_to_js_template' => true)
36
+ );
37
+ $rendererDays->setOptions(Mage::getModel('fadello/adminhtml_system_config_source_days')->toOptionArray());
38
+
39
+ $this->addColumn(
40
+ 'day', array(
41
+ 'label' => Mage::helper('fadello')->__('Day'),
42
+ 'style' => 'width:100px',
43
+ 'renderer' => $rendererDays
44
+ )
45
+ );
46
 
47
+ $this->addColumn(
48
+ 'from', array(
 
 
 
 
 
49
  'label' => Mage::helper('fadello')->__('From'),
50
+ 'style' => 'width:40px',
51
+ )
52
+ );
53
 
54
+ $this->addColumn(
55
+ 'to', array(
56
  'label' => Mage::helper('fadello')->__('To'),
57
+ 'style' => 'width:40px',
58
+ )
59
+ );
60
+
61
+ $this->addColumn(
62
+ 'title', array(
63
  'label' => Mage::helper('fadello')->__('Title'),
64
+ 'style' => 'width:100px',
65
+ )
66
+ );
67
+
68
+ $this->_renders['day'] = $rendererDays;
69
 
 
 
70
  $this->_addAfter = false;
71
  $this->_addButtonLabel = Mage::helper('fadello')->__('Add Option');
72
  parent::__construct();
73
  }
74
 
75
+ /**
76
+ * @param Varien_Object $row
77
+ */
78
+ protected function _prepareArrayRow(Varien_Object $row)
79
+ {
80
+ foreach ($this->_renders as $key => $render) {
81
+ $row->setData(
82
+ 'option_extra_attr_' . $render->calcOptionHash($row->getData($key)),
83
+ 'selected="selected"'
84
+ );
85
+ }
86
+ }
87
 
88
  }
app/code/community/Magmodules/Fadello/Block/Adminhtml/Config/Form/Field/Shipping.php CHANGED
@@ -1,9 +1,8 @@
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:
@@ -12,47 +11,61 @@
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
  }
1
+ <?php
2
  /**
3
  * Magmodules.eu - http://www.magmodules.eu
4
  *
5
  * NOTICE OF LICENSE
 
6
  * This source file is subject to the Open Software License (OSL 3.0)
7
  * that is bundled with this package in the file LICENSE.txt.
8
  * It is also available through the world-wide-web at this URL:
11
  * obtain it through the world-wide-web, please send an email
12
  * to info@magmodules.eu so we can send you a copy immediately.
13
  *
14
+ * @category Magmodules
15
+ * @package Magmodules_Fadello
16
+ * @author Magmodules <info@magmodules.eu>
17
+ * @copyright Copyright (c) 2017 (http://www.magmodules.eu)
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
20
 
21
+ class Magmodules_Fadello_Block_Adminhtml_Config_Form_Field_Shipping
22
+ extends Mage_Adminhtml_Block_System_Config_Form_Field_Array_Abstract
23
+ {
24
+
25
+ protected $_renders = array();
26
+
27
+ /**
28
+ * Magmodules_Fadello_Block_Adminhtml_Config_Form_Field_Shipping constructor.
29
+ */
30
+ public function __construct()
31
+ {
32
+ $this->addColumn(
33
+ 'from', array(
34
+ 'label' => Mage::helper('fadello')->__('From Price'),
35
+ 'style' => 'width:50px',
36
+ )
37
+ );
38
+
39
+ $this->addColumn(
40
+ 'to', array(
41
+ 'label' => Mage::helper('fadello')->__('To Price'),
42
+ 'style' => 'width:50px',
43
+ )
44
+ );
45
+
46
+ $this->addColumn(
47
+ 'cost', array(
48
+ 'label' => Mage::helper('fadello')->__('Cost'),
49
+ 'style' => 'width:50px',
50
+ )
51
+ );
52
+
53
  $this->_addAfter = false;
54
  $this->_addButtonLabel = Mage::helper('fadello')->__('Add Option');
55
  parent::__construct();
56
  }
57
 
58
+ /**
59
+ * @param Varien_Object $row
60
+ */
61
+ protected function _prepareArrayRow(Varien_Object $row)
62
+ {
63
+ foreach ($this->_renders as $key => $render) {
64
+ $row->setData(
65
+ 'option_extra_attr_' . $render->calcOptionHash($row->getData($key)),
66
+ 'selected="selected"'
67
+ );
68
+ }
69
+ }
70
 
71
  }
app/code/community/Magmodules/Fadello/Block/Adminhtml/Config/Form/Renderer/Select.php CHANGED
@@ -1,9 +1,8 @@
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:
@@ -12,98 +11,101 @@
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 {
@@ -112,11 +114,11 @@ class Magmodules_Fadello_Block_Adminhtml_Config_Form_Renderer_Select extends Mag
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;
@@ -125,42 +127,47 @@ class Magmodules_Fadello_Block_Adminhtml_Config_Form_Renderer_Select extends Mag
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']) . '}';
@@ -179,28 +186,31 @@ class Magmodules_Fadello_Block_Adminhtml_Config_Form_Renderer_Select extends Mag
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
  }
1
+ <?php
2
  /**
3
  * Magmodules.eu - http://www.magmodules.eu
4
  *
5
  * NOTICE OF LICENSE
 
6
  * This source file is subject to the Open Software License (OSL 3.0)
7
  * that is bundled with this package in the file LICENSE.txt.
8
  * It is also available through the world-wide-web at this URL:
11
  * obtain it through the world-wide-web, please send an email
12
  * to info@magmodules.eu so we can send you a copy immediately.
13
  *
14
+ * @category Magmodules
15
+ * @package Magmodules_Fadello
16
+ * @author Magmodules <info@magmodules.eu>
17
+ * @copyright Copyright (c) 2017 (http://www.magmodules.eu)
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
20
 
21
+ class Magmodules_Fadello_Block_Adminhtml_Config_Form_Renderer_Select extends Mage_Core_Block_Html_Select
22
+ {
23
+
24
+ /**
25
+ * @param $inputName
26
+ *
27
+ * @return $this
28
+ */
29
+ public function setInputName($inputName)
30
+ {
31
+ $this->setData('inputname', $inputName);
32
  return $this;
33
+ }
34
+
35
+ /**
36
+ * @return mixed
37
+ */
38
+ public function getInputName()
39
+ {
40
+ return $this->getData('inputname');
41
+ }
42
+
43
+ /**
44
+ * @param $columnName
45
+ *
46
+ * @return $this
47
+ */
48
+ public function setColumnName($columnName)
49
+ {
50
+ $this->setData('columnname', $columnName);
51
  return $this;
52
+ }
53
+
54
+ /**
55
+ * @return mixed
56
+ */
57
+ public function getColumnName()
58
+ {
59
+ return $this->getData('columnname');
60
+ }
61
+
62
+ /**
63
+ * @param $column
64
+ *
65
+ * @return $this
66
+ */
67
+ public function setColumn($column)
68
+ {
69
+ $this->setData('column', $column);
70
  return $this;
71
+ }
72
+
73
+ /**
74
+ * @return mixed
75
+ */
76
+ public function getColumn()
77
+ {
78
+ return $this->getData('column');
79
+ }
80
+
81
+ /**
82
+ * @return string
83
+ */
84
+ public function getExtraParams()
85
+ {
86
+ $column = $this->getColumn();
87
+ if ($column && isset($column['style'])) {
88
+ return ' style="' . $column['style'] . '" ';
89
+ } else {
90
+ return '';
91
+ }
92
+ }
93
+
94
+ /**
95
+ * @return string
96
+ */
97
+ protected function _toHtml()
98
+ {
99
+
100
+ if (!$this->_beforeToHtml()) {
101
  return '';
102
  }
103
 
104
+ $html = '<select name="' . $this->getInputName() . '" class="' . $this->getClass() . '" ' . $this->getExtraParams() . '>';
105
+
106
  $values = $this->getValue();
107
 
108
+ if (!is_array($values)) {
109
  if (!is_null($values)) {
110
  $values = array($values);
111
  } else {
114
  }
115
 
116
  $isArrayOption = true;
117
+
118
+ foreach ($this->getOptions() as $key => $option) {
119
+ if ($isArrayOption && is_array($option)) {
120
+ $value = $option['value'];
121
+ $label = $option['label'];
122
  $params = (!empty($option['params'])) ? $option['params'] : array();
123
  } else {
124
  $value = $key;
127
  $params = array();
128
  }
129
 
130
+ if (is_array($value)) {
131
+ $html .= '<optgroup label="' . $label . '">';
132
+ foreach ($value as $keyGroup => $optionGroup) {
133
+ if (!is_array($optionGroup)) {
134
  $optionGroup = array(
135
  'value' => $keyGroup,
136
  'label' => $optionGroup
137
  );
138
  }
139
+
140
+ $html .= $this->_optionToHtml(
141
  $optionGroup,
142
  in_array($optionGroup['value'], $values)
143
  );
144
  }
145
+
146
+ $html .= '</optgroup>';
147
  } else {
148
+ $html .= $this->_optionToHtml(
149
+ array(
150
+ 'value' => $value,
151
+ 'label' => $label,
152
  'params' => $params
153
+ ),
154
  in_array($value, $values)
155
  );
156
  }
157
  }
158
+
159
+ $html .= '</select>';
160
  return $html;
161
  }
162
 
163
+ /**
164
+ * @param array $option
165
+ * @param bool $selected
166
+ *
167
+ * @return string
168
+ */
169
+ protected function _optionToHtml($option, $selected = false)
170
+ {
171
  $selectedHtml = $selected ? ' selected="selected"' : '';
172
  if ($this->getIsRenderToJsTemplate() === true) {
173
  $selectedHtml .= ' #{option_extra_attr_' . self::calcOptionHash($option['value']) . '}';
186
  }
187
  }
188
 
189
+ return sprintf(
190
+ '<option value="%s" %s %s>%s</option>',
191
+ $this->escapeHtml($option['value']),
192
  $selectedHtml,
193
  $params,
194
+ $this->escapeHtml($option['label'])
195
+ );
196
  }
197
 
198
+ /**
199
+ * @return string
200
+ */
201
+ public function getHtml()
202
+ {
203
  return $this->toHtml();
204
  }
205
 
206
+ /**
207
+ * @param string $optionValue
208
+ *
209
+ * @return string
210
+ */
211
+ public function calcOptionHash($optionValue)
212
+ {
213
  return sprintf('%u', crc32($this->getColumnName() . $this->getInputName() . $optionValue));
214
  }
215
+
216
  }
app/code/community/Magmodules/Fadello/Block/Adminhtml/Renderer/Shipment.php CHANGED
@@ -1,9 +1,8 @@
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:
@@ -12,43 +11,75 @@
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
  }
1
+ <?php
2
  /**
3
  * Magmodules.eu - http://www.magmodules.eu
4
  *
5
  * NOTICE OF LICENSE
 
6
  * This source file is subject to the Open Software License (OSL 3.0)
7
  * that is bundled with this package in the file LICENSE.txt.
8
  * It is also available through the world-wide-web at this URL:
11
  * obtain it through the world-wide-web, please send an email
12
  * to info@magmodules.eu so we can send you a copy immediately.
13
  *
14
+ * @category Magmodules
15
+ * @package Magmodules_Fadello
16
+ * @author Magmodules <info@magmodules.eu>
17
+ * @copyright Copyright (c) 2017 (http://www.magmodules.eu)
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
20
 
21
+ class Magmodules_Fadello_Block_Adminhtml_Renderer_Shipment
22
+ extends Mage_Adminhtml_Block_Widget_Grid_Column_Renderer_Abstract
23
+ {
24
+
25
+ /**
26
+ * @param Varien_Object $row
27
+ *
28
+ * @return string
29
+ */
30
+ public function render(Varien_Object $row)
31
+ {
32
+ $html = '';
33
+
34
+ $orderId = $row->getEntityId();
35
+ $status = $row->getFadelloStatus();
36
+
37
+ $showAllShipments = Mage::getStoreConfig('shipping/fadello/show_all_shipments');
38
+ if (!$showAllShipments) {
39
+ if ($row->getShippingMethod() != 'fadello_fadello') {
40
+ return $html;
41
+ }
42
+ }
43
+
44
+ // Cancel Shipment
45
+ $cUrl = $this->getUrl('*/fadello/cancelShipment', array('order_id' => $orderId));
46
+ $cMsg = $this->__('Cancel this Fadello Shipment');
47
+ $cImg = $this->getSkinUrl('images/fadello/close.png');
48
+
49
+ // Open PDF
50
+ $pUrl = $this->getUrl('*/fadello/getPdf', array('order_id' => $orderId));
51
+ $pMsg = $this->__('Open PDF');
52
+ $pImg = $this->getSkinUrl('images/fadello/pdf.png');
53
+
54
+ // Ship Order
55
+ $sUrl = $this->getUrl('*/fadello/shipOrder', array('order_id' => $orderId));
56
+ $sMsg = $this->__('Ship This Order');
57
+ $sImg = $this->getSkinUrl('images/fadello/export.png');
58
+
59
+ // Ship Order
60
+ $csUrl = $this->getUrl('*/fadello/createShipment', array('order_id' => $orderId));
61
+ $csMsg = $this->__('Create Shipmentr');
62
+ $csImg = $this->getSkinUrl('images/fadello/ship.png');
63
+
64
+ if (!empty($status)) {
65
+ if ($status == 'created') {
66
+ $html .= '<a href="' . $cUrl . '"><img title="' . $cMsg . '" src="' . $cImg . '"></a>';
67
+ $html .= '&nbsp; ';
68
+ $html .= '<a href="' . $pUrl . '"><img title="' . $pMsg . '" src="' . $pImg . '"></a>';
69
+ $html .= '&nbsp; ';
70
+ $html .= '<a href="' . $sUrl . '"><img title="' . $sMsg . '" src="' . $sImg . '"></a>';
71
+ }
72
+
73
+ if ($status == 'shipped') {
74
+ $html .= '<a href="' . $cUrl . '"><img title="' . $cMsg . '" src="' . $cImg . '"></a>';
75
+ $html .= '&nbsp; ';
76
+ $html .= '<a href="' . $pUrl . '"><img title="' . $pMsg . '" src="' . $pImg . '"></a>';
77
+ }
78
+ } else {
79
+ $html .= '<a href="' . $csUrl . '"><img title="' . $csMsg . '" src="' . $csImg . '"></a>';
80
+ }
81
+
82
+ return $html;
83
+ }
84
 
85
  }
app/code/community/Magmodules/Fadello/Block/Adminhtml/System/Config/Form/Field/Heading.php CHANGED
@@ -1,9 +1,8 @@
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:
@@ -12,21 +11,29 @@
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
  }
1
+ <?php
2
  /**
3
  * Magmodules.eu - http://www.magmodules.eu
4
  *
5
  * NOTICE OF LICENSE
 
6
  * This source file is subject to the Open Software License (OSL 3.0)
7
  * that is bundled with this package in the file LICENSE.txt.
8
  * It is also available through the world-wide-web at this URL:
11
  * obtain it through the world-wide-web, please send an email
12
  * to info@magmodules.eu so we can send you a copy immediately.
13
  *
14
+ * @category Magmodules
15
+ * @package Magmodules_Fadello
16
+ * @author Magmodules <info@magmodules.eu>
17
+ * @copyright Copyright (c) 2017 (http://www.magmodules.eu)
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
20
 
21
+ class Magmodules_Fadello_Block_Adminhtml_System_Config_Form_Field_Heading
22
+ extends Mage_Adminhtml_Block_Abstract implements Varien_Data_Form_Element_Renderer_Interface
23
+ {
24
 
25
+ /**
26
+ * @param Varien_Data_Form_Element_Abstract $element
27
+ *
28
+ * @return string
29
+ */
30
+ public function render(Varien_Data_Form_Element_Abstract $element)
31
  {
32
  $useContainerId = $element->getData('use_container_id');
33
+ return sprintf(
34
+ '<tr class="system-fieldset-sub-head" id="row_%s"><td colspan="5"><h4>%s</h4></td></tr>',
35
  $element->getHtmlId(), $element->getLabel()
36
  );
37
  }
38
+
39
  }
app/code/community/Magmodules/Fadello/Block/Adminhtml/System/Config/Form/Field/Note.php CHANGED
@@ -1,9 +1,8 @@
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:
@@ -12,21 +11,29 @@
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
  }
1
+ <?php
2
  /**
3
  * Magmodules.eu - http://www.magmodules.eu
4
  *
5
  * NOTICE OF LICENSE
 
6
  * This source file is subject to the Open Software License (OSL 3.0)
7
  * that is bundled with this package in the file LICENSE.txt.
8
  * It is also available through the world-wide-web at this URL:
11
  * obtain it through the world-wide-web, please send an email
12
  * to info@magmodules.eu so we can send you a copy immediately.
13
  *
14
+ * @category Magmodules
15
+ * @package Magmodules_Fadello
16
+ * @author Magmodules <info@magmodules.eu>
17
+ * @copyright Copyright (c) 2017 (http://www.magmodules.eu)
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
 
 
20
 
21
+ class Magmodules_Fadello_Block_Adminhtml_System_Config_Form_Field_Note
22
+ extends Mage_Adminhtml_Block_Abstract implements Varien_Data_Form_Element_Renderer_Interface
23
+ {
24
+
25
+ /**
26
+ * @param Varien_Data_Form_Element_Abstract $element
27
+ *
28
+ * @return string
29
+ */
30
+ public function render(Varien_Data_Form_Element_Abstract $element)
31
  {
32
  $useContainerId = $element->getData('use_container_id');
33
+ return sprintf(
34
+ '<tr id="row_%s"><td colspan="5" class="label" style="margin-bottom: 10px;">%s</td></tr>',
35
  $element->getHtmlId(), $element->getLabel()
36
  );
37
  }
38
+
39
  }
app/code/community/Magmodules/Fadello/Block/Adminhtml/System/Config/Form/Field/Version.php CHANGED
@@ -1,9 +1,8 @@
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:
@@ -12,18 +11,25 @@
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
  }
1
+ <?php
2
  /**
3
  * Magmodules.eu - http://www.magmodules.eu
4
  *
5
  * NOTICE OF LICENSE
 
6
  * This source file is subject to the Open Software License (OSL 3.0)
7
  * that is bundled with this package in the file LICENSE.txt.
8
  * It is also available through the world-wide-web at this URL:
11
  * obtain it through the world-wide-web, please send an email
12
  * to info@magmodules.eu so we can send you a copy immediately.
13
  *
14
+ * @category Magmodules
15
+ * @package Magmodules_Fadello
16
+ * @author Magmodules <info@magmodules.eu>
17
+ * @copyright Copyright (c) 2017 (http://www.magmodules.eu)
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
20
 
21
+ class Magmodules_Fadello_Block_Adminhtml_System_Config_Form_Field_Version
22
+ extends Mage_Adminhtml_Block_System_Config_Form_Field
23
+ {
24
 
25
+ /**
26
+ * @param Varien_Data_Form_Element_Abstract $element
27
+ *
28
+ * @return mixed
29
+ */
30
+ public function _getElementHtml(Varien_Data_Form_Element_Abstract $element)
31
  {
32
  return Mage::getConfig()->getNode()->modules->Magmodules_Fadello->version;
33
  }
34
+
35
  }
app/code/community/Magmodules/Fadello/Helper/Data.php CHANGED
@@ -1,9 +1,8 @@
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:
@@ -12,93 +11,149 @@
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
  }
1
+ <?php
2
  /**
3
  * Magmodules.eu - http://www.magmodules.eu
4
  *
5
  * NOTICE OF LICENSE
 
6
  * This source file is subject to the Open Software License (OSL 3.0)
7
  * that is bundled with this package in the file LICENSE.txt.
8
  * It is also available through the world-wide-web at this URL:
11
  * obtain it through the world-wide-web, please send an email
12
  * to info@magmodules.eu so we can send you a copy immediately.
13
  *
14
+ * @category Magmodules
15
+ * @package Magmodules_Fadello
16
+ * @author Magmodules <info@magmodules.eu>
17
+ * @copyright Copyright (c) 2017 (http://www.magmodules.eu)
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
 
 
20
 
21
+ class Magmodules_Fadello_Helper_Data extends Mage_Core_Helper_Abstract
22
+ {
23
+
24
+ /**
25
+ * @param int $storeId
26
+ * @param int $detailed
27
+ *
28
+ * @return array|bool
29
+ */
30
+ public function getConfig($storeId = 0, $detailed = 0)
31
+ {
32
+ $api = array();
33
+
34
+ $afterCutoff = Mage::getStoreConfig('shipping/fadello/pu_name', $storeId);
35
+ $cutoff = str_replace(' ', '', Mage::getStoreConfig('shipping/fadello/cutoff_time', $storeId));
36
+ $date = $this->getDate($afterCutoff, $cutoff);
37
+
38
+ $api['api_id'] = Mage::getStoreConfig('shipping/fadello/api_id', $storeId);
39
+ $api['api_token'] = Mage::getStoreConfig('shipping/fadello/api_token', $storeId);
40
+ $api['cutoff_time'] = $cutoff;
41
+ $api['pickup_time'] = str_replace(' ', '', Mage::getStoreConfig('shipping/fadello/pickup_time', $storeId));
42
+ $api['del_time'] = str_replace(' ', '', Mage::getStoreConfig('shipping/fadello/delivery_time', $storeId));
43
+ $api['pu_date'] = $date;
44
+ $api['del_date'] = $date;
45
+ $api['url_params'] = 'apiID=' . $api['api_id'] . '&apitoken=' . $api['api_token'];
46
+ $api['url'] = 'https://api.fadello.nl/desktopmodules/fadello_retailAPI/API/v1/';
47
+ $api['ship_type'] = 'DC';
48
+ $api['label'] = 'PDF';
49
+ if ($detailed) {
50
+ $api['pu_name'] = Mage::getStoreConfig('shipping/fadello/pu_name', $storeId);
51
+ $api['pu_street'] = Mage::getStoreConfig('shipping/fadello/pu_street', $storeId);
52
+ $api['pu_homeno'] = Mage::getStoreConfig('shipping/fadello/pu_homeno', $storeId);
53
+ $api['pu_homeno_add'] = Mage::getStoreConfig('shipping/fadello/pu_homeno_add', $storeId);
54
+ $api['pu_postalcode'] = Mage::getStoreConfig('shipping/fadello/pu_postalcode', $storeId);
55
+ $api['pu_city'] = Mage::getStoreConfig('shipping/fadello/pu_city', $storeId);
56
+ $api['pu_country'] = Mage::getStoreConfig('shipping/fadello/pu_country', $storeId);
57
+ $api['pu_phone'] = preg_replace(
58
+ "/[^0-9]/", "",
59
+ Mage::getStoreConfig('shipping/fadello/pu_phone', $storeId)
60
+ );
61
+ $api['pu_email'] = Mage::getStoreConfig('shipping/fadello/pu_email', $storeId);
62
+ $api['homeno'] = Mage::getStoreConfig('shipping/fadello/seperate_homenumber', $storeId);
63
+ }
64
+
65
+ if (!empty($api['api_id']) && !empty($api['api_token'])) {
66
+ return $api;
67
+ }
68
+
69
+ return false;
70
+ }
71
+
72
+ /**
73
+ * @return bool
74
+ */
75
+ public function isActive()
76
+ {
77
+ $time = date('Hi', Mage::getModel('core/date')->timestamp(time()));
78
+ $day = date('N', Mage::getModel('core/date')->timestamp(time()));
79
+ $availability = @unserialize(Mage::getStoreConfig('carriers/fadello/availability'));
80
+ foreach ($availability as $option) {
81
+ if ($option['day'] == $day) {
82
+ if (!empty($option['from']) && !empty($option['to'])) {
83
+ $from = str_replace(':', '', $option['from']);
84
+ $to = str_replace(':', '', $option['to']);
85
+ if (($time > $from) && ($time < $to)) {
86
+ return $option;
87
+ }
88
+ }
89
+ }
90
+ }
91
 
92
+ return false;
93
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
94
 
95
+ /**
96
+ * @param int $afterCutoff
97
+ * @param $cutoff
98
+ *
99
+ * @return mixed
100
+ */
101
+ public function getDate($afterCutoff = 0, $cutoff)
102
+ {
103
+ $today = Mage::getModel('core/date')->date('d-m-Y');
104
+ $tomorrow = Mage::getModel('core/date')->date("d-m-Y", time() + 86400);
105
+ if ($afterCutoff) {
106
+ $time = Mage::getModel('core/date')->date('Hi');
107
+ $cutoff = (str_replace(':', '', $cutoff) + 100);
108
+ if ($time > $cutoff) {
109
+ return $tomorrow;
110
+ }
111
+ }
 
112
 
113
+ return $today;
114
+ }
 
 
 
 
 
 
 
 
 
 
 
115
 
116
+ /**
117
+ * @param $postcode
118
+ *
119
+ * @return bool
120
+ */
121
+ public function checkPostcode($postcode)
122
+ {
123
+ $postcode = substr($postcode, 0, 4);
124
+ $nonDelivery = array(
125
+ "1791",
126
+ "1792",
127
+ "1793",
128
+ "1794",
129
+ "1795",
130
+ "1796",
131
+ "1797",
132
+ "8881",
133
+ "8882",
134
+ "8883",
135
+ "8884",
136
+ "8885",
137
+ "8891",
138
+ "8892",
139
+ "8893",
140
+ "8894",
141
+ "8895",
142
+ "8896",
143
+ "8897",
144
+ "8899",
145
+ "9161",
146
+ "9162",
147
+ "9163",
148
+ "9164",
149
+ "9166",
150
+ "9988"
151
+ );
152
+ if (!in_array($postcode, $nonDelivery)) {
153
+ return true;
154
+ } else {
155
+ return false;
156
+ }
157
+ }
158
 
159
  }
app/code/community/Magmodules/Fadello/Model/Adminhtml/System/Config/Backend/Design/Availability.php CHANGED
@@ -1,9 +1,8 @@
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:
@@ -12,48 +11,71 @@
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
  }
1
+ <?php
2
  /**
3
  * Magmodules.eu - http://www.magmodules.eu
4
  *
5
  * NOTICE OF LICENSE
 
6
  * This source file is subject to the Open Software License (OSL 3.0)
7
  * that is bundled with this package in the file LICENSE.txt.
8
  * It is also available through the world-wide-web at this URL:
11
  * obtain it through the world-wide-web, please send an email
12
  * to info@magmodules.eu so we can send you a copy immediately.
13
  *
14
+ * @category Magmodules
15
+ * @package Magmodules_Fadello
16
+ * @author Magmodules <info@magmodules.eu>
17
+ * @copyright Copyright (c) 2017 (http://www.magmodules.eu)
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
20
 
21
+ class Magmodules_Fadello_Model_Adminhtml_System_Config_Backend_Design_Availability
22
+ extends Mage_Adminhtml_Model_System_Config_Backend_Serialized_Array
23
+ {
24
 
25
+ /**
26
+ *
27
+ */
28
+ protected function _beforeSave()
29
+ {
30
  $value = $this->getValue();
31
+ if (is_array($value)) {
32
  unset($value['__empty']);
33
+ if (count($value)) {
34
+ $value = $this->orderData($value, 'day');
35
+ $keys = array();
36
+ for ($i = 0; $i < count($value); $i++) {
37
+ $keys[] = 'availability_' . uniqid();
38
+ }
39
+
40
+ foreach ($value as $key => $field) {
41
+ $from = str_replace('.', ':', $field['from']);
42
+ $to = str_replace('.', ':', $field['to']);
43
+ if (empty($from)) {
44
+ $from = '0:00';
45
+ }
46
+
47
+ if (empty($to)) {
48
+ $to = '23:59';
49
+ }
50
+
51
+ if ($to == '0:00') {
52
+ $to = '23:59';
53
+ }
54
+
55
+ $value[$key]['from'] = $from;
56
+ $value[$key]['to'] = $to;
57
+ $value[$key]['title'] = $field['title'];
58
+ }
59
+
60
+ $value = array_combine($keys, array_values($value));
61
  }
62
  }
63
+
64
  $this->setValue($value);
65
  parent::_beforeSave();
66
  }
67
 
68
+ /**
69
+ * @param $data
70
+ * @param $sort
71
+ *
72
+ * @return mixed
73
+ */
74
+ function orderData($data, $sort)
75
+ {
76
+ $code = "return strnatcmp(\$a['$sort'], \$b['$sort']);";
77
+ usort($data, create_function('$a,$b', $code));
78
+ return $data;
79
+ }
80
+
81
  }
app/code/community/Magmodules/Fadello/Model/Adminhtml/System/Config/Backend/Design/Shipping.php CHANGED
@@ -1,9 +1,8 @@
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:
@@ -12,49 +11,72 @@
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
  }
1
+ <?php
2
  /**
3
  * Magmodules.eu - http://www.magmodules.eu
4
  *
5
  * NOTICE OF LICENSE
 
6
  * This source file is subject to the Open Software License (OSL 3.0)
7
  * that is bundled with this package in the file LICENSE.txt.
8
  * It is also available through the world-wide-web at this URL:
11
  * obtain it through the world-wide-web, please send an email
12
  * to info@magmodules.eu so we can send you a copy immediately.
13
  *
14
+ * @category Magmodules
15
+ * @package Magmodules_Fadello
16
+ * @author Magmodules <info@magmodules.eu>
17
+ * @copyright Copyright (c) 2017 (http://www.magmodules.eu)
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
20
 
21
+ class Magmodules_Fadello_Model_Adminhtml_System_Config_Backend_Design_Shipping
22
+ extends Mage_Adminhtml_Model_System_Config_Backend_Serialized_Array
23
+ {
24
 
25
+ /**
26
+ *
27
+ */
28
+ protected function _beforeSave()
29
+ {
30
  $value = $this->getValue();
31
+ if (is_array($value)) {
32
  unset($value['__empty']);
33
+ if (count($value)) {
34
+ $value = $this->orderData($value, 'from');
35
+ $keys = array();
36
+ for ($i = 0; $i < count($value); $i++) {
37
+ $keys[] = 'shipping_' . uniqid();
38
+ }
39
+
40
+ foreach ($value as $key => $field) {
41
+ $from = str_replace(',', '.', $field['from']);
42
+ $to = str_replace(',', '.', $field['to']);
43
+ $cost = str_replace(',', '.', $field['cost']);
44
+ if (empty($from)) {
45
+ $from = '0.00';
46
+ }
47
+
48
+ if (empty($to)) {
49
+ $to = '100000.00';
50
+ }
51
+
52
+ if (empty($cost)) {
53
+ $cost = '0.00';
54
+ }
55
+
56
+ $value[$key]['from'] = number_format($from, 2, '.', '');
57
+ $value[$key]['to'] = number_format($to, 2, '.', '');
58
+ $value[$key]['cost'] = number_format($cost, 2, '.', '');
59
+ }
60
+
61
+ $value = array_combine($keys, array_values($value));
62
  }
63
  }
64
+
65
  $this->setValue($value);
66
  parent::_beforeSave();
67
  }
68
 
69
+ /**
70
+ * @param $data
71
+ * @param $sort
72
+ *
73
+ * @return mixed
74
+ */
75
+ function orderData($data, $sort)
76
+ {
77
+ $code = "return strnatcmp(\$a['$sort'], \$b['$sort']);";
78
+ usort($data, create_function('$a,$b', $code));
79
+ return $data;
80
+ }
81
+
82
  }
app/code/community/Magmodules/Fadello/Model/Adminhtml/System/Config/Source/Days.php CHANGED
@@ -1,9 +1,8 @@
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:
@@ -12,26 +11,30 @@
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
  }
1
+ <?php
2
  /**
3
  * Magmodules.eu - http://www.magmodules.eu
4
  *
5
  * NOTICE OF LICENSE
 
6
  * This source file is subject to the Open Software License (OSL 3.0)
7
  * that is bundled with this package in the file LICENSE.txt.
8
  * It is also available through the world-wide-web at this URL:
11
  * obtain it through the world-wide-web, please send an email
12
  * to info@magmodules.eu so we can send you a copy immediately.
13
  *
14
+ * @category Magmodules
15
+ * @package Magmodules_Fadello
16
+ * @author Magmodules <info@magmodules.eu>
17
+ * @copyright Copyright (c) 2017 (http://www.magmodules.eu)
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
20
+
21
+ class Magmodules_Fadello_Model_Adminhtml_System_Config_Source_Days
22
+ {
23
+
24
+ /**
25
+ * @return array
26
+ */
27
+ public function toOptionArray()
28
  {
29
+ $days = array();
30
+ $days[] = array('value' => '1', 'label' => Mage::helper('adminhtml')->__('Monday'));
31
+ $days[] = array('value' => '2', 'label' => Mage::helper('adminhtml')->__('Tuesday'));
32
+ $days[] = array('value' => '3', 'label' => Mage::helper('adminhtml')->__('Wednesday'));
33
+ $days[] = array('value' => '4', 'label' => Mage::helper('adminhtml')->__('Thursday'));
34
+ $days[] = array('value' => '5', 'label' => Mage::helper('adminhtml')->__('Friday'));
35
+ $days[] = array('value' => '6', 'label' => Mage::helper('adminhtml')->__('Saturday'));
36
+ $days[] = array('value' => '7', 'label' => Mage::helper('adminhtml')->__('Sunday'));
37
+ return $days;
38
  }
39
 
40
  }
app/code/community/Magmodules/Fadello/Model/Api.php CHANGED
@@ -1,9 +1,8 @@
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:
@@ -12,330 +11,363 @@
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
  }
1
+ <?php
2
  /**
3
  * Magmodules.eu - http://www.magmodules.eu
4
  *
5
  * NOTICE OF LICENSE
 
6
  * This source file is subject to the Open Software License (OSL 3.0)
7
  * that is bundled with this package in the file LICENSE.txt.
8
  * It is also available through the world-wide-web at this URL:
11
  * obtain it through the world-wide-web, please send an email
12
  * to info@magmodules.eu so we can send you a copy immediately.
13
  *
14
+ * @category Magmodules
15
+ * @package Magmodules_Fadello
16
+ * @author Magmodules <info@magmodules.eu>
17
+ * @copyright Copyright (c) 2017 (http://www.magmodules.eu)
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
20
+
21
+ class Magmodules_Fadello_Model_Api extends Mage_Core_Helper_Abstract
22
+ {
23
+
24
+ /**
25
+ * @param $orderId
26
+ *
27
+ * @return array
28
+ */
29
+ public function createShipment($orderId)
30
+ {
31
+ $result = array();
32
+ $order = Mage::getModel('sales/order')->load($orderId);
33
+ $storeId = $order->getStoreId();
34
+ $config = Mage::helper('fadello')->getConfig($storeId, 1);
35
+
36
+ if (empty($config)) {
37
+ $result['status'] = 'Error';
38
+ $result['error_msg'] = $this->__('Missing API details in Admin');
39
+ return $result;
40
+ }
41
+
42
+ if (empty($order)) {
43
+ $result['status'] = 'Error';
44
+ $result['error_msg'] = $this->__('Could not find Order');
45
+ return $result;
46
+ }
47
+
48
+ $post = json_encode($this->getPostOrderArray($config, $order));
49
+
50
+ $request = curl_init();
51
+ $requestUrl = $config['url'] . 'postOrder?' . $config['url_params'];
52
+ curl_setopt($request, CURLOPT_SSL_VERIFYPEER, false);
53
+ curl_setopt($request, CURLOPT_URL, $requestUrl);
54
+ curl_setopt($request, CURLOPT_HTTPHEADER, array('Content-Type:application/json'));
55
+ curl_setopt($request, CURLOPT_POST, true);
56
+ curl_setopt($request, CURLOPT_POSTFIELDS, $post);
57
+ curl_setopt($request, CURLOPT_RETURNTRANSFER, true);
58
+ $content = curl_exec($request);
59
+ $apiResult = json_decode($content, true);
60
+
61
+ if (!empty($apiResult['Status'])) {
62
+ if ($apiResult['Status'] == 'OK') {
63
+ $transId = $apiResult['TransID'];
64
+ $deliverId = $apiResult['TransDeliverID'][0]['Deliver1'];
65
+ $barcode = $apiResult['TransDeliverID'][0]['Barcode1'];
66
+ $status = 'created';
67
+
68
+ $order->setFadelloTransId($transId)
69
+ ->setFadelloDeliverId($deliverId)
70
+ ->setFadelloBarcode($barcode)
71
+ ->setFadelloStatus($status)
72
+ ->save();
73
+
74
+ $url = Mage::helper("adminhtml")->getUrl('*/fadello/getPdf', array('order_id' => $orderId));
75
+ $result['status'] = 'Success';
76
+ $result['success_msg'] = $this->__(
77
+ 'Fadello shipment created for order, %s',
78
+ '<a href="' . $url . '">Download PDF</a>'
79
+ );
80
+ return $result;
81
+ } else {
82
+ $result['status'] = $apiResult['Status'];
83
+ $result['error_msg'] = 'Fadello API: ' . $apiResult['Message'];
84
+ return $result;
85
+ }
86
+ } else {
87
+ $result['status'] = 'Error';
88
+ $result['error_msg'] = $this->__('General error in API call');
89
+ return $result;
90
+ }
91
+ }
92
+
93
+ /**
94
+ * @param $orderId
95
+ * @param int $magento
96
+ *
97
+ * @return array
98
+ */
99
+ public function cancelShipment($orderId, $magento = 0)
100
+ {
101
+ $result = array();
102
+ $order = Mage::getModel('sales/order')->load($orderId);
103
+ $storeId = $order->getStoreId();
104
+ $config = Mage::helper('fadello')->getConfig($storeId, 0);
105
+
106
+ if (empty($config)) {
107
+ $result['status'] = 'Error';
108
+ $result['error_msg'] = $this->__('Missing API details in Admin');
109
+ return $result;
110
+ }
111
+
112
+ if (empty($order)) {
113
+ $result['status'] = 'Error';
114
+ $result['error_msg'] = $this->__('Could not find Order');
115
+ return $result;
116
+ }
117
+
118
+ $transId = $order->getFadelloTransId();
119
+ if (empty($transId)) {
120
+ $result['status'] = 'Error';
121
+ $result['error_msg'] = $this->__('TransID Missing');
122
+ return $result;
123
+ }
124
+
125
+ $request = curl_init();
126
+ $requestUrl = $config['url'] . 'cancelOrder?' . $config['url_params'] . '&transID=' . $transId;
127
+ curl_setopt($request, CURLOPT_SSL_VERIFYPEER, false);
128
+ curl_setopt($request, CURLOPT_URL, $requestUrl);
129
+ curl_setopt($request, CURLOPT_RETURNTRANSFER, true);
130
+ $content = curl_exec($request);
131
+ $apiResult = json_decode($content, true);
132
+
133
+ if (!empty($apiResult['Status'])) {
134
+ if ($apiResult['Status'] == 'OK') {
135
+ if (!empty($apiResult['ErrorCode'])) {
136
+ $result['status'] = 'Error';
137
+ $result['error_msg'] = 'Fadello API: ' . $apiResult['Message'];
138
+ return $result;
139
+ } else {
140
+ $order->setFadelloTransId('')->setFadelloDeliverId('')->setFadelloBarcode('')->setFadelloStatus('');
141
+ if ($magento == 1) {
142
+ $shipments = $order->getShipmentsCollection();
143
+ foreach ($shipments as $shipment) {
144
+ $shipment->delete();
145
+ }
146
+
147
+ $items = $order->getAllVisibleItems();
148
+ foreach ($items as $i) {
149
+ $i->setQtyShipped(0);
150
+ $i->save();
151
+ }
152
+
153
+ $order->setData('state', 'processing')->setStatus('processing');
154
+ }
155
+
156
+ $order->save();
157
+ $result['status'] = 'Success';
158
+ $result['success_msg'] = $apiResult['Message'];
159
+ return $result;
160
+ }
161
+ } else {
162
+ $result['status'] = $apiResult['Status'];
163
+ $result['error_msg'] = $apiResult['Message'];
164
+ return $result;
165
+ }
166
+ } else {
167
+ $result['status'] = 'Error';
168
+ $result['error_msg'] = $this->__('General error in API call');
169
+ return $result;
170
+ }
171
+ }
172
+
173
+ /**
174
+ * @param $orderId
175
+ *
176
+ * @return array
177
+ */
178
+ public function getPdf($orderId)
179
+ {
180
+ $order = Mage::getModel('sales/order')->load($orderId);
181
+ $storeId = $order->getStoreId();
182
+ $config = Mage::helper('fadello')->getConfig($storeId, 0);
183
+ $result = array();
184
+
185
+ if (empty($config)) {
186
+ $result['status'] = 'Error';
187
+ $result['error_msg'] = $this->__('Missing API details in Admin');
188
+ return $result;
189
+ }
190
+
191
+ if (empty($order)) {
192
+ $result['status'] = 'Error';
193
+ $result['error_msg'] = $this->__('Could not find Order');
194
+ return $result;
195
+ }
196
+
197
+ $transId = $order->getFadelloTransId();
198
+ $transDeliverId = $order->getFadelloDeliverId();
199
+ if (empty($transId) || empty($transDeliverId)) {
200
+ $result['status'] = 'Error';
201
+ $result['error_msg'] = $this->__('Trans Data Missing');
202
+ return $result;
203
+ }
204
+
205
+ $request = curl_init();
206
+ $requestUrl = $config['url'] . 'getLabel?' . $config['url_params'] . '&transID=' . $transId . '&transDeliverID=' . $transDeliverId . '&Lformat=' . $config['label'];
207
+ curl_setopt($request, CURLOPT_SSL_VERIFYPEER, false);
208
+ curl_setopt($request, CURLOPT_URL, $requestUrl);
209
+ curl_setopt($request, CURLOPT_RETURNTRANSFER, true);
210
+ $content = curl_exec($request);
211
+ $apiResult = json_decode($content, true);
212
+
213
+ if (!empty($apiResult['Status'])) {
214
+ if ($apiResult['Status'] == 'OK') {
215
+ $labelUrl = $apiResult['Labelurl'];
216
+ $result['status'] = 'Success';
217
+ $result['increment_id'] = $order->getIncrementId();
218
+ $result['label_url'] = $labelUrl;
219
+ $result['file_name'] = 'Fadello-' . $order->getIncrementId() . '.pdf';
220
+ return $result;
221
+ } else {
222
+ $result['status'] = $apiResult['Status'];
223
+ $result['error_msg'] = $apiResult['Message'];
224
+ return $result;
225
+ }
226
+ } else {
227
+ $result['status'] = 'Error';
228
+ $result['error_msg'] = $this->__('General error in API call');
229
+ return $result;
230
+ }
231
+ }
232
+
233
+ /**
234
+ * @param $orderId
235
+ *
236
+ * @return array
237
+ */
238
+ public function shipOrder($orderId)
239
+ {
240
+ $order = Mage::getModel('sales/order')->load($orderId);
241
+ $barcode = $order->getFadelloBarcode();
242
+ $result = array();
243
+
244
+ if (empty($order)) {
245
+ $result['status'] = 'Error';
246
+ $result['error_msg'] = $this->__('Could not find Order');
247
+ return $result;
248
+ }
249
+
250
+ if (empty($barcode)) {
251
+ $result['status'] = 'Error';
252
+ $result['error_msg'] = $this->__('Could not find Track & Trace info');
253
+ return $result;
254
+ }
255
+
256
+ $shipments = $order->getShipmentsCollection();
257
+ if (count($shipments)) {
258
+ $result['status'] = 'Error';
259
+ $result['error_msg'] = $this->__('Order %s allready shipped', $order->getInrementId());
260
+ return $result;
261
+ }
262
+
263
+ try {
264
+ $name = Mage::getStoreConfig('carriers/fadello/name');
265
+ $shipment = $order->prepareShipment();
266
+ $arrTracking = array('carrier_code' => 'fadello', 'title' => $name, 'number' => $barcode);
267
+ $track = Mage::getModel('sales/order_shipment_track')->addData($arrTracking);
268
+ $shipment->addTrack($track);
269
+ $shipment->register();
270
+ $shipment->sendEmail(true);
271
+ $shipment->setEmailSent(true);
272
+ $shipment->getOrder()->setIsInProcess(true);
273
+ Mage::getModel('core/resource_transaction')->addObject($shipment)->addObject($shipment->getOrder())->save();
274
+ unset($shipment);
275
+ } catch (Exception $e) {
276
+ $result['status'] = 'Error';
277
+ $result['error_msg'] = $e->getMessage();
278
+ return $result;
279
+ }
280
+
281
+ $order->setData('state', "complete")->setStatus("complete")->setFadelloStatus('shipped')->save();
282
+ $result['status'] = 'Success';
283
+ $result['success_msg'] = $this->__('Order %s shipped and completed', $order->getInrementId());
284
+ return $result;
285
+ }
286
+
287
+ /**
288
+ * @param $config
289
+ * @param $order
290
+ *
291
+ * @return array
292
+ */
293
+ public function getPostOrderArray($config, $order)
294
+ {
295
+ $post = array();
296
+ $post['Name'] = $config['pu_name'];
297
+ $post['Phone'] = $config['pu_phone'];
298
+ $post['YourRef'] = $order->getIncrementId() . time();
299
+ $post['Note'] = '';
300
+ $post['Email'] = $config['pu_email'];
301
+ $post['ShipType'] = $config['ship_type'];
302
+ $post['PUname'] = $config['pu_name'];
303
+ $post['PUstreet'] = $config['pu_street'];
304
+ $post['PUpostalcode'] = $config['pu_postalcode'];
305
+ $post['PUhomeno'] = $config['pu_homeno'];
306
+ $post['PUhomenoAdd'] = $config['pu_homeno_add'];
307
+ $post['PUcity'] = $config['pu_city'];
308
+ $post['PUcountry'] = $config['pu_country'];
309
+ $post['PUphone'] = $config['pu_phone'];
310
+ $post['PUemail'] = $config['pu_email'];
311
+ $post['PUdate'] = $config['pu_date'];
312
+ $post['PUtime'] = $config['pickup_time'];
313
+ $post['PUnote'] = '';
314
+ $post['Deliver'][] = $this->getDeliveryData($config, $order);
315
+ return $post;
316
+ }
317
+
318
+ /**
319
+ * @param $config
320
+ * @param $order
321
+ *
322
+ * @return array
323
+ */
324
+ public function getDeliveryData($config, $order)
325
+ {
326
+ $delivery = array();
327
+ $shippingAddress = $order->getShippingAddress();
328
+ $address = $this->splitStreet($shippingAddress->getStreet(), $config['homeno']);
329
+ $delivery['DELCompanyName'] = $shippingAddress->getData('company');
330
+ $delivery['DELname'] = $shippingAddress->getFirstname() . ' ' . $shippingAddress->getLastname();
331
+ $delivery['DELstreet'] = $address['street'];
332
+ $delivery['DELpostalcode'] = $shippingAddress->getPostcode();
333
+ $delivery['DELhomeno'] = $address['homeno'];
334
+ $delivery['DELhomenoAdd'] = $address['homeno_add'];
335
+ $delivery['DELcity'] = $shippingAddress->getCity();
336
+ $delivery['DELcountry'] = $shippingAddress->getCountry();
337
+ $delivery['DELphone'] = preg_replace("/[^0-9]/", "", $shippingAddress->getTelephone());
338
+ $delivery['DELemail'] = $order->getCustomerEmail();
339
+ $delivery['DELdate'] = $config['del_date'];
340
+ $delivery['DELtime'] = $config['del_time'];
341
+ $delivery['DELAaantalColli'] = 1;
342
+ $delivery['DELbarcodes'] = '';
343
+ $delivery['CreateLabel'] = 'True';
344
+ $delivery['DELnote'] = '';
345
+ return $delivery;
346
+ }
347
+
348
+ /**
349
+ * @param $streetArr
350
+ * @param int $homeNoSep
351
+ *
352
+ * @return array
353
+ */
354
+ public function splitStreet($streetArr, $homeNoSep = 0)
355
+ {
356
+ if ($homeNoSep && isset($streetArr[1])) {
357
+ $street = $streetArr[0];
358
+ $homeNoString = str_replace(array('-', ','), ' ', $streetArr[1]);
359
+ $homeNo = @reset(array_filter(preg_split("/\D+/", $homeNoString)));
360
+ $homeNoAdd = trim(str_replace($homeNo, '', $homeNoString));
361
+ return array('street' => $street, 'homeno' => $homeNo, 'homeno_add' => $homeNoAdd);
362
+ } else {
363
+ $street = $streetArr[0];
364
+ preg_match('/^([^\d]*[^\d\s]) *(\d.*)$/', $street, $match);
365
+ $street = (isset($match[1])) ? $match[1] : '';
366
+ $homeNoString = (isset($match[2])) ? str_replace('-', ' ', $match[2]) : '';
367
+ $homeNo = @reset(array_filter(preg_split("/\D+/", $homeNoString)));
368
+ $homeNoAdd = trim(str_replace($homeNo, '', $homeNoString));
369
+ return array('street' => $street, 'homeno' => $homeNo, 'homeno_add' => $homeNoAdd);
370
+ }
371
+ }
372
+
373
  }
app/code/community/Magmodules/Fadello/Model/Carrier/ShippingMethod.php CHANGED
@@ -1,9 +1,8 @@
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:
@@ -12,74 +11,167 @@
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
  }
1
+ <?php
2
  /**
3
  * Magmodules.eu - http://www.magmodules.eu
4
  *
5
  * NOTICE OF LICENSE
 
6
  * This source file is subject to the Open Software License (OSL 3.0)
7
  * that is bundled with this package in the file LICENSE.txt.
8
  * It is also available through the world-wide-web at this URL:
11
  * obtain it through the world-wide-web, please send an email
12
  * to info@magmodules.eu so we can send you a copy immediately.
13
  *
14
+ * @category Magmodules
15
+ * @package Magmodules_Fadello
16
+ * @author Magmodules <info@magmodules.eu>
17
+ * @copyright Copyright (c) 2017 (http://www.magmodules.eu)
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
 
 
20
 
21
+ class Magmodules_Fadello_Model_Carrier_ShippingMethod extends Mage_Shipping_Model_Carrier_Abstract
22
+ {
23
+
24
+ const XML_PATH_MANAGE_STOCK = 'cataloginventory/item_options/manage_stock';
25
+
26
+ protected $_code = 'fadello';
27
 
28
+ /**
29
+ * @param Mage_Shipping_Model_Rate_Request $request
30
+ *
31
+ * @return mixed
32
+ */
33
+ public function collectRates(Mage_Shipping_Model_Rate_Request $request)
34
  {
35
+ $displayError = $this->getConfigFlag('showmethod');
36
+ $error = '';
37
 
38
+ if (!$this->getConfigFlag('active')) {
39
  return false;
40
  }
41
 
42
+ if (!Mage::getStoreConfig('shipping/fadello/enabled')) {
43
  return false;
44
  }
45
+
46
+ if ($maxWeight = Mage::getStoreConfig('carriers/fadello/weight')) {
47
+ if ($request->getPackageWeight() > $maxWeight) {
48
+ if ($displayError) {
49
+ $error++;
50
+ } else {
51
+ return false;
52
+ }
53
+ }
54
+ }
55
+
56
+ $active = Mage::helper('fadello')->isActive();
57
+ if (!$active) {
58
+ if ($displayError) {
59
+ $error++;
60
+ } else {
61
+ return false;
62
+ }
63
+ }
64
+
65
+ $postcode = $request->getDestPostcode();
66
+ if (!empty($postcode)) {
67
+ $postcodeCheck = Mage::helper('fadello')->checkPostcode($request->getDestPostcode());
68
+ if (!$postcodeCheck) {
69
+ if ($displayError) {
70
+ $error++;
71
+ } else {
72
+ return false;
73
+ }
74
+ }
75
+ }
76
+
77
+ if ($this->getConfigData('stock_check')) {
78
+
79
+ $configManageStock = (int) Mage::getStoreConfigFlag(self::XML_PATH_MANAGE_STOCK);
80
+
81
+ foreach ($request->getAllItems() as $item) {
82
+
83
+ if ($item->getProduct()->isVirtual()) {
84
+ continue;
85
+ }
86
+
87
+ if ($item->getProduct()->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE) {
88
+ continue;
89
+ }
90
+
91
+ if ($item->getProduct()->getTypeId() == Mage_Catalog_Model_Product_Type::TYPE_BUNDLE) {
92
+ continue;
93
+ }
94
+
95
+ if ($item->getParentItem()) {
96
+ $qty = $item->getParentItem()->getQty();
97
+ } else {
98
+ $qty = $item->getQty();
99
+ }
100
+
101
+ $stockItem = $item->getProduct()->getStockItem();
102
+
103
+ if ($stockItem->getUseConfigManageStock()) {
104
+ if (!$configManageStock) {
105
+ continue;
106
+ }
107
+ } else {
108
+ if (!$stockItem->getManageStock()) {
109
+ continue;
110
+ }
111
+ }
112
+
113
+ if (!$stockItem->getIsInStock()) {
114
+ if ($displayError) {
115
+ $error++;
116
+ } else {
117
+ return false;
118
+ }
119
+ }
120
+
121
+ if ($qty > $stockItem->getQty()) {
122
+ if ($displayError) {
123
+ $error++;
124
+ } else {
125
+ return false;
126
+ }
127
+ }
128
+ }
129
+
130
+ }
131
+
132
+ $prices = @unserialize($this->getConfigData('shipping_price'));
133
+ $total = $request->getBaseSubtotalInclTax();
134
+ $shippingCost = '0.00';
135
+
136
+ foreach ($prices as $shippingPrice) {
137
+ if (($total >= $shippingPrice['from']) && ($total <= $shippingPrice['to'])) {
138
+ $shippingCost = $shippingPrice['cost'];
139
+ }
140
+ }
141
+
142
+ $name = Mage::getStoreConfig('carriers/fadello/name');
143
  $method = Mage::getModel('shipping/rate_result_method');
144
+ $result = Mage::getModel('shipping/rate_result');
145
+
146
+ if (empty($error)) {
147
+
148
+ $method->setCarrier('fadello');
149
+ $method->setCarrierTitle($name);
150
+ $method->setMethod('fadello');
151
+ $method->setMethodTitle($active['title']);
152
+ $method->setPrice($shippingCost);
153
+ $method->setCost('0.00');
154
+ $result->append($method);
155
+
156
+ } else {
157
+
158
+ $error = Mage::getModel('shipping/rate_result_error');
159
+ $method->setCarrier('fadello');
160
+ $method->setCarrierTitle($name);
161
+ $error->setErrorMessage($this->getConfigData('specificerrmsg'));
162
+ $result->append($error);
163
+
164
+ }
165
+
166
  return $result;
167
  }
168
+
169
+ /**
170
+ * @return array
171
+ */
172
+ public function getAllowedMethods()
173
  {
174
  return array($this->_code => $this->getConfigData('name'));
175
  }
176
+
177
  }
app/code/community/Magmodules/Fadello/Model/Observer.php CHANGED
@@ -1,9 +1,8 @@
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:
@@ -12,59 +11,54 @@
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
- $sales_table = Mage::getSingleton('core/resource')->getTableName('sales_flat_order');
52
- $collection->getSelect()->from(array(), array('shipping_method' => new Zend_Db_Expr('(SELECT `weight` FROM `' . $sales_table . '` as `o` WHERE `main_table`.`entity_id` = `o`.`entity_id`)')));
53
- }
54
- }
55
 
 
 
 
56
  public function core_block_abstract_to_html_after($observer)
57
  {
58
- if($observer->getBlock() instanceof Mage_Checkout_Block_Onepage_Shipping_Method_Available) {
59
- $enabled = Mage::getStoreConfig('carriers/fadello/active');
60
- $logo_style = Mage::getStoreConfig('carriers/fadello/logo_style');
61
- if($enabled && $logo_style) {
62
- $html = $observer->getTransport()->getHtml();
63
- $header = '<dt>' . Mage::getStoreConfig('carriers/fadello/title') . '</dt>';
64
- $header_new = '<dt class="fadello-class">' . Mage::getStoreConfig('carriers/fadello/title') . '</dt>';
65
- $html = str_replace($header, $header_new, $html);
66
- $observer->getTransport()->setHtml($html);
67
- }
68
  }
69
  }
70
 
1
+ <?php
2
  /**
3
  * Magmodules.eu - http://www.magmodules.eu
4
  *
5
  * NOTICE OF LICENSE
 
6
  * This source file is subject to the Open Software License (OSL 3.0)
7
  * that is bundled with this package in the file LICENSE.txt.
8
  * It is also available through the world-wide-web at this URL:
11
  * obtain it through the world-wide-web, please send an email
12
  * to info@magmodules.eu so we can send you a copy immediately.
13
  *
14
+ * @category Magmodules
15
+ * @package Magmodules_Fadello
16
+ * @author Magmodules <info@magmodules.eu>
17
+ * @copyright Copyright (c) 2017 (http://www.magmodules.eu)
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
 
 
20
 
21
+ class Magmodules_Fadello_Model_Observer
22
+ {
23
+
24
+ /**
25
+ * @param $observer
26
+ */
27
  public function addDataToOrderGrid($observer)
28
  {
29
  $block = $observer->getEvent()->getBlock();
30
+ if ($block->getType() == 'adminhtml/sales_order_grid') {
31
+ if (Mage::getStoreConfig('shipping/fadello/enabled')) {
32
+ $block->addColumnAfter(
33
+ 'fadello', array(
34
+ 'header' => 'Fadello',
35
+ 'type' => 'text',
36
+ 'index' => 'fadello',
37
+ 'filter' => false,
38
+ 'sortable' => false,
39
+ 'renderer' => 'Magmodules_Fadello_Block_Adminhtml_Renderer_Shipment',
40
+ 'width' => '120px',
41
+ ), 'status'
42
+ );
43
+ }
44
+ }
45
+ }
 
 
 
 
 
 
 
 
 
 
 
 
46
 
47
+ /**
48
+ * @param $observer
49
+ */
50
  public function core_block_abstract_to_html_after($observer)
51
  {
52
+ if ($observer->getBlock() instanceof Mage_Checkout_Block_Onepage_Shipping_Method_Available) {
53
+ $enabled = Mage::getStoreConfig('carriers/fadello/active');
54
+ $logoStyle = Mage::getStoreConfig('carriers/fadello/logo_style');
55
+ if ($enabled && $logoStyle) {
56
+ $html = $observer->getTransport()->getHtml();
57
+ $header = '<dt>' . Mage::getStoreConfig('carriers/fadello/title') . '</dt>';
58
+ $headerNew = '<dt class="fadello-class">' . Mage::getStoreConfig('carriers/fadello/title') . '</dt>';
59
+ $html = str_replace($header, $headerNew, $html);
60
+ $observer->getTransport()->setHtml($html);
61
+ }
62
  }
63
  }
64
 
app/code/community/Magmodules/Fadello/controllers/Adminhtml/FadelloController.php CHANGED
@@ -1,9 +1,8 @@
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:
@@ -12,100 +11,119 @@
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
  }
1
+ <?php
2
  /**
3
  * Magmodules.eu - http://www.magmodules.eu
4
  *
5
  * NOTICE OF LICENSE
 
6
  * This source file is subject to the Open Software License (OSL 3.0)
7
  * that is bundled with this package in the file LICENSE.txt.
8
  * It is also available through the world-wide-web at this URL:
11
  * obtain it through the world-wide-web, please send an email
12
  * to info@magmodules.eu so we can send you a copy immediately.
13
  *
14
+ * @category Magmodules
15
+ * @package Magmodules_Fadello
16
+ * @author Magmodules <info@magmodules.eu>
17
+ * @copyright Copyright (c) 2017 (http://www.magmodules.eu)
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
 
 
20
 
21
+ class Magmodules_Fadello_Adminhtml_FadelloController extends Mage_Adminhtml_Controller_Action
22
+ {
23
+
24
+ /**
25
+ *
26
+ */
27
+ public function createShipmentAction()
28
+ {
29
+ $orderId = $this->getRequest()->getParam('order_id');
30
+ if ($orderId > 0) {
31
+ $result = Mage::getModel('fadello/api')->createShipment($orderId);
32
+ if (!empty($result['success_msg'])) {
33
+ Mage::getSingleton('core/session')->addSuccess($result['success_msg']);
34
+ }
35
+
36
+ if (!empty($result['error_msg'])) {
37
+ Mage::getSingleton('core/session')->addError($result['error_msg']);
38
+ }
39
+ } else {
40
+ $msg = $this->__('Order not found!');
41
+ Mage::getSingleton('core/session')->addError($msg);
42
+ }
43
+
44
+ $this->_redirect('adminhtml/sales_order');
45
+ }
46
+
47
+ /**
48
+ *
49
+ */
50
+ public function shipOrderAction()
51
+ {
52
+ $orderId = $this->getRequest()->getParam('order_id');
53
+ if ($orderId > 0) {
54
+ $result = Mage::getModel('fadello/api')->shipOrder($orderId);
55
+ if (!empty($result['success_msg'])) {
56
+ Mage::getSingleton('core/session')->addSuccess($result['success_msg']);
57
+ }
58
 
59
+ if (!empty($result['error_msg'])) {
60
+ Mage::getSingleton('core/session')->addError($result['error_msg']);
61
+ }
62
+ } else {
63
+ $msg = $this->__('Order not found!');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
64
  Mage::getSingleton('core/session')->addError($msg);
65
+ }
66
+
67
+ $this->_redirect('adminhtml/sales_order');
68
+ }
69
+
70
+ /**
71
+ *
72
+ */
73
+ public function cancelShipmentAction()
74
+ {
75
+ $orderId = $this->getRequest()->getParam('order_id');
76
+ $magento = $this->getRequest()->getParam('magento');
77
+ if ($orderId > 0) {
78
+ $result = Mage::getModel('fadello/api')->cancelShipment($orderId, $magento);
79
+ if (!empty($result['success_msg'])) {
80
+ Mage::getSingleton('core/session')->addSuccess($result['success_msg']);
81
+ }
 
 
 
 
 
 
 
 
 
82
 
83
+ if (!empty($result['error_msg'])) {
84
+ Mage::getSingleton('core/session')->addError($result['error_msg']);
85
+ }
86
+ } else {
87
+ $msg = $this->__('Order not found!');
88
+ Mage::getSingleton('core/session')->addError($msg);
89
+ }
90
+
91
+ $this->_redirect('adminhtml/sales_order');
92
+ }
93
+
94
+ /**
95
+ *
96
+ */
97
+ public function getPdfAction()
98
+ {
99
+ $orderId = $this->getRequest()->getParam('order_id');
100
+ if ($orderId > 0) {
101
+ $result = Mage::getModel('fadello/api')->getPdf($orderId);
102
+ if (!empty($result['label_url']) && !empty($result['file_name'])) {
103
+ header('Content-Type: application/pdf');
104
+ header('Content-Disposition: attachment; filename=' . $result['file_name']);
105
+ header('Pragma: no-cache');
106
+ readfile($result['label_url']);
107
+ exit;
108
+ } else {
109
+ if (!empty($result['error_msg'])) {
110
+ Mage::getSingleton('core/session')->addError($result['error_msg']);
111
+ }
112
+ }
113
+ } else {
114
+ $msg = $this->__('Order not found!');
115
+ Mage::getSingleton('core/session')->addError($msg);
116
+ }
117
+
118
+ $this->_redirect('adminhtml/sales_order');
119
+ }
120
+
121
+ /**
122
+ * @return bool
123
+ */
124
+ protected function _isAllowed()
125
+ {
126
  return true;
127
+ }
128
+
129
  }
app/code/community/Magmodules/Fadello/etc/adminhtml.xml CHANGED
@@ -1,31 +1,28 @@
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>
@@ -35,9 +32,9 @@
35
  </children>
36
  </config>
37
  </children>
38
- </system>
39
  </children>
40
  </admin>
41
  </resources>
42
- </acl>
43
  </config>
1
  <?xml version="1.0"?>
2
  <!--
3
+ ~ Magmodules.eu - http://www.magmodules.eu
4
+ ~
5
+ ~ NOTICE OF LICENSE
6
+ ~ This source file is subject to the Open Software License (OSL 3.0)
7
+ ~ that is bundled with this package in the file LICENSE.txt.
8
+ ~ It is also available through the world-wide-web at this URL:
9
+ ~ http://opensource.org/licenses/osl-3.0.php
10
+ ~ If you did not receive a copy of the license and are unable to
11
+ ~ obtain it through the world-wide-web, please send an email
12
+ ~ to info@magmodules.eu so we can send you a copy immediately.
13
+ ~
14
+ ~ @category Magmodules
15
+ ~ @package Magmodules_Fadello
16
+ ~ @author Magmodules <info@magmodules.eu>
17
+ ~ @copyright Copyright (c) 2017 (http://www.magmodules.eu)
18
+ ~ @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ -->
 
 
 
20
  <config>
21
  <acl>
22
  <resources>
23
  <admin>
24
  <children>
25
+ <system>
26
  <children>
27
  <config>
28
  <children>
32
  </children>
33
  </config>
34
  </children>
35
+ </system>
36
  </children>
37
  </admin>
38
  </resources>
39
+ </acl>
40
  </config>
app/code/community/Magmodules/Fadello/etc/config.xml CHANGED
@@ -1,69 +1,67 @@
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.1</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
- <events>
56
- <core_block_abstract_to_html_after>
57
  <observers>
58
  <fadello>
59
  <class>fadello/observer</class>
60
  <method>core_block_abstract_to_html_after</method>
61
  </fadello>
62
  </observers>
63
- </core_block_abstract_to_html_after>
64
- </events>
65
- </global>
66
- <adminhtml>
67
  <translate>
68
  <modules>
69
  <magmodules_fadello>
@@ -73,24 +71,16 @@
73
  </magmodules_fadello>
74
  </modules>
75
  </translate>
76
- <events>
77
- <core_block_abstract_prepare_layout_before>
78
- <observers>
79
- <fadello_core_block_abstract_prepare_layout_before>
80
- <class>fadello/observer</class>
81
- <method>addDataToOrderGrid</method>
82
- </fadello_core_block_abstract_prepare_layout_before>
83
- </observers>
84
- </core_block_abstract_prepare_layout_before>
85
- <sales_order_grid_collection_load_before>
86
- <observers>
87
- <fadello_sales_order_grid_collection_load_before>
88
- <model>fadello/observer</model>
89
- <method>salesOrderGridCollectionLoadBefore</method>
90
- </fadello_sales_order_grid_collection_load_before>
91
- </observers>
92
- </sales_order_grid_collection_load_before>
93
- </events>
94
  </adminhtml>
95
  <admin>
96
  <routers>
@@ -103,37 +93,37 @@
103
  </adminhtml>
104
  </routers>
105
  </admin>
106
- <frontend>
107
  <layout>
108
  <updates>
109
  <fadello>
110
  <file>magmodules_fadello.xml</file>
111
  </fadello>
112
  </updates>
113
- </layout>
114
- </frontend>
115
- <default>
116
- <shipping>
117
- <fadello>
118
- <cutoff_time>13:00</cutoff_time>
119
- <cutoff_time>13:00-16:00</cutoff_time>
120
- <cutoff_time>18:00-22:30</cutoff_time>
121
- <pu_country>NL</pu_country>
122
- <show_all_shipments>0</show_all_shipments>
123
- <after_cutoff>0</after_cutoff>
124
- <seperate_homenumber>0</seperate_homenumber>
125
- </fadello>
126
- </shipping>
127
- <carriers>
128
- <fadello>
129
- <active>1</active>
130
- <model>Magmodules_Fadello_Model_Carrier_ShippingMethod</model>
131
- <name>Standaard gratis verzending</name>
132
- <specificerrmsg>This shipping method is currently unavailable. If you would like to ship using this shipping method, please contact us.</specificerrmsg>
133
- <sallowspecific>1</sallowspecific>
134
- <specificcountry>NL</specificcountry>
135
- <sort_order>10</sort_order>
136
- </fadello>
137
- </carriers>
138
- </default>
139
  </config>
1
  <?xml version="1.0"?>
2
  <!--
3
+ ~ Magmodules.eu - http://www.magmodules.eu
4
+ ~
5
+ ~ NOTICE OF LICENSE
6
+ ~ This source file is subject to the Open Software License (OSL 3.0)
7
+ ~ that is bundled with this package in the file LICENSE.txt.
8
+ ~ It is also available through the world-wide-web at this URL:
9
+ ~ http://opensource.org/licenses/osl-3.0.php
10
+ ~ If you did not receive a copy of the license and are unable to
11
+ ~ obtain it through the world-wide-web, please send an email
12
+ ~ to info@magmodules.eu so we can send you a copy immediately.
13
+ ~
14
+ ~ @category Magmodules
15
+ ~ @package Magmodules_Fadello
16
+ ~ @author Magmodules <info@magmodules.eu>
17
+ ~ @copyright Copyright (c) 2017 (http://www.magmodules.eu)
18
+ ~ @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ -->
20
+
 
 
21
  <config>
22
+ <modules>
23
+ <Magmodules_Fadello>
24
+ <version>1.0.2</version>
25
+ </Magmodules_Fadello>
26
+ </modules>
27
+ <global>
28
+ <models>
29
+ <fadello>
30
+ <class>Magmodules_Fadello_Model</class>
31
+ </fadello>
32
+ </models>
33
  <helpers>
34
  <fadello>
35
  <class>Magmodules_Fadello_Helper</class>
36
  </fadello>
37
+ </helpers>
38
+ <blocks>
39
+ <fadello>
40
+ <class>Magmodules_Fadello_Block</class>
41
+ </fadello>
42
+ </blocks>
43
+ <resources>
44
+ <fadello_setup>
45
+ <setup>
46
+ <module>Magmodules_Fadello</module>
47
+ </setup>
48
+ <connection>
49
+ <use>core_setup</use>
50
+ </connection>
51
+ </fadello_setup>
52
+ </resources>
53
+ <events>
54
+ <core_block_abstract_to_html_after>
55
  <observers>
56
  <fadello>
57
  <class>fadello/observer</class>
58
  <method>core_block_abstract_to_html_after</method>
59
  </fadello>
60
  </observers>
61
+ </core_block_abstract_to_html_after>
62
+ </events>
63
+ </global>
64
+ <adminhtml>
65
  <translate>
66
  <modules>
67
  <magmodules_fadello>
71
  </magmodules_fadello>
72
  </modules>
73
  </translate>
74
+ <events>
75
+ <core_block_abstract_prepare_layout_before>
76
+ <observers>
77
+ <fadello_core_block_abstract_prepare_layout_before>
78
+ <class>fadello/observer</class>
79
+ <method>addDataToOrderGrid</method>
80
+ </fadello_core_block_abstract_prepare_layout_before>
81
+ </observers>
82
+ </core_block_abstract_prepare_layout_before>
83
+ </events>
 
 
 
 
 
 
 
 
84
  </adminhtml>
85
  <admin>
86
  <routers>
93
  </adminhtml>
94
  </routers>
95
  </admin>
96
+ <frontend>
97
  <layout>
98
  <updates>
99
  <fadello>
100
  <file>magmodules_fadello.xml</file>
101
  </fadello>
102
  </updates>
103
+ </layout>
104
+ </frontend>
105
+ <default>
106
+ <shipping>
107
+ <fadello>
108
+ <cutoff_time>13:00</cutoff_time>
109
+ <cutoff_time>13:00-16:00</cutoff_time>
110
+ <cutoff_time>18:00-22:30</cutoff_time>
111
+ <pu_country>NL</pu_country>
112
+ <show_all_shipments>0</show_all_shipments>
113
+ <after_cutoff>0</after_cutoff>
114
+ <seperate_homenumber>0</seperate_homenumber>
115
+ </fadello>
116
+ </shipping>
117
+ <carriers>
118
+ <fadello>
119
+ <active>1</active>
120
+ <model>Magmodules_Fadello_Model_Carrier_ShippingMethod</model>
121
+ <name>Standaard gratis verzending</name>
122
+ <specificerrmsg>This shipping method is currently unavailable. If you would like to ship using this shipping method, please contact us.</specificerrmsg>
123
+ <sallowspecific>1</sallowspecific>
124
+ <specificcountry>NL</specificcountry>
125
+ <sort_order>10</sort_order>
126
+ </fadello>
127
+ </carriers>
128
+ </default>
129
  </config>
app/code/community/Magmodules/Fadello/etc/system.xml CHANGED
@@ -1,42 +1,39 @@
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>
@@ -45,16 +42,16 @@
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>
@@ -62,7 +59,7 @@
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>
@@ -71,7 +68,7 @@
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>
@@ -88,15 +85,15 @@
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>
@@ -104,7 +101,7 @@
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>
@@ -121,14 +118,14 @@
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>
@@ -137,7 +134,7 @@
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>
@@ -146,7 +143,7 @@
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>
@@ -155,7 +152,7 @@
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>
@@ -164,14 +161,14 @@
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>
@@ -179,7 +176,7 @@
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>
@@ -187,7 +184,7 @@
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>
@@ -195,7 +192,7 @@
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>
@@ -203,7 +200,7 @@
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>
@@ -211,7 +208,7 @@
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>
@@ -219,16 +216,16 @@
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>
@@ -236,7 +233,7 @@
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>
@@ -244,7 +241,7 @@
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>
@@ -252,7 +249,7 @@
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>
@@ -272,7 +269,7 @@
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>
@@ -282,20 +279,20 @@
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>
@@ -330,7 +327,7 @@
330
  <show_in_default>1</show_in_default>
331
  <show_in_website>1</show_in_website>
332
  <show_in_store>0</show_in_store>
333
- </sort_order>
334
  <price_heading translate="label">
335
  <label>Pricing</label>
336
  <frontend_model>fadello/adminhtml_system_config_form_field_heading</frontend_model>
@@ -339,23 +336,23 @@
339
  <show_in_website>1</show_in_website>
340
  <show_in_store>1</show_in_store>
341
  </price_heading>
342
- <price_note translate="label">
343
  <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>
344
  <frontend_model>fadello/adminhtml_system_config_form_field_note</frontend_model>
345
  <sort_order>11</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
- </price_note>
350
- <shipping_price>
351
- <label>Shipping Price</label>
352
- <frontend_model>fadello/adminhtml_config_form_field_shipping</frontend_model>
353
- <backend_model>fadello/adminhtml_system_config_backend_design_shipping</backend_model>
354
- <sort_order>12</sort_order>
355
- <show_in_default>1</show_in_default>
356
- <show_in_website>1</show_in_website>
357
- <show_in_store>1</show_in_store>
358
- </shipping_price>
359
  <availability_heading translate="label">
360
  <label>Availability</label>
361
  <frontend_model>fadello/adminhtml_system_config_form_field_heading</frontend_model>
@@ -363,24 +360,24 @@
363
  <show_in_default>1</show_in_default>
364
  <show_in_website>1</show_in_website>
365
  <show_in_store>1</show_in_store>
366
- </availability_heading>
367
- <availability_note translate="label">
368
  <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>
369
  <frontend_model>fadello/adminhtml_system_config_form_field_note</frontend_model>
370
  <sort_order>31</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_note>
375
- <availability>
376
- <label>Method Availability</label>
377
- <frontend_model>fadello/adminhtml_config_form_field_availability</frontend_model>
378
- <backend_model>fadello/adminhtml_system_config_backend_design_availability</backend_model>
379
- <sort_order>32</sort_order>
380
- <show_in_default>1</show_in_default>
381
- <show_in_website>1</show_in_website>
382
- <show_in_store>1</show_in_store>
383
- </availability>
384
  <heading_sort translate="label">
385
  <label>Limitations</label>
386
  <frontend_model>fadello/adminhtml_system_config_form_field_heading</frontend_model>
@@ -388,7 +385,7 @@
388
  <show_in_default>1</show_in_default>
389
  <show_in_website>1</show_in_website>
390
  <show_in_store>1</show_in_store>
391
- </heading_sort>
392
  <weight translate="label">
393
  <label>Maximum weight</label>
394
  <frontend_type>text</frontend_type>
@@ -397,7 +394,17 @@
397
  <show_in_website>1</show_in_website>
398
  <show_in_store>1</show_in_store>
399
  <tooltip>Fill in the Maximum weight of a shipment with the same data format as used in the Products.</tooltip>
400
- </weight>
 
 
 
 
 
 
 
 
 
 
401
  <showmethod translate="label">
402
  <label>Show Method if Not Applicable</label>
403
  <frontend_type>select</frontend_type>
@@ -414,10 +421,10 @@
414
  <show_in_default>1</show_in_default>
415
  <show_in_website>1</show_in_website>
416
  <show_in_store>1</show_in_store>
417
- </specificerrmsg>
418
  </fields>
419
- </fadello>
420
- </groups>
421
- </carriers>
422
- </sections>
423
  </config>
1
  <?xml version="1.0"?>
2
  <!--
3
+ ~ Magmodules.eu - http://www.magmodules.eu
4
+ ~
5
+ ~ NOTICE OF LICENSE
6
+ ~ This source file is subject to the Open Software License (OSL 3.0)
7
+ ~ that is bundled with this package in the file LICENSE.txt.
8
+ ~ It is also available through the world-wide-web at this URL:
9
+ ~ http://opensource.org/licenses/osl-3.0.php
10
+ ~ If you did not receive a copy of the license and are unable to
11
+ ~ obtain it through the world-wide-web, please send an email
12
+ ~ to info@magmodules.eu so we can send you a copy immediately.
13
+ ~
14
+ ~ @category Magmodules
15
+ ~ @package Magmodules_Fadello
16
+ ~ @author Magmodules <info@magmodules.eu>
17
+ ~ @copyright Copyright (c) 2017 (http://www.magmodules.eu)
18
+ ~ @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ -->
 
 
 
20
  <config>
21
+ <tabs>
22
+ <magmodules translate="label" module="fadello">
23
+ <label>Magmodules</label>
24
+ <sort_order>200</sort_order>
25
+ </magmodules>
26
+ </tabs>
27
+ <sections>
28
+ <shipping>
29
  <groups>
30
+ <fadello translate="label" module="fadello">
31
+ <label>Fadello - Same Day Delivery</label>
32
+ <frontend_type>text</frontend_type>
33
+ <sort_order>103</sort_order>
34
+ <show_in_default>1</show_in_default>
35
+ <show_in_website>1</show_in_website>
36
+ <show_in_store>1</show_in_store>
37
  <fields>
38
  <about_heading translate="label">
39
  <label>About the Extension</label>
42
  <show_in_default>1</show_in_default>
43
  <show_in_website>1</show_in_website>
44
  <show_in_store>1</show_in_store>
45
+ </about_heading>
46
+ <about_note translate="label">
47
  <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>
48
  <frontend_model>fadello/adminhtml_system_config_form_field_note</frontend_model>
49
  <sort_order>2</sort_order>
50
  <show_in_default>1</show_in_default>
51
  <show_in_website>1</show_in_website>
52
+ <show_in_store>1</show_in_store>
53
+ </about_note>
54
+
55
  <extension_heading translate="label">
56
  <label>General Settings</label>
57
  <frontend_model>fadello/adminhtml_system_config_form_field_heading</frontend_model>
59
  <show_in_default>1</show_in_default>
60
  <show_in_website>1</show_in_website>
61
  <show_in_store>1</show_in_store>
62
+ </extension_heading>
63
  <version translate="label">
64
  <label>Extension Version</label>
65
  <frontend_type>text</frontend_type>
68
  <show_in_default>1</show_in_default>
69
  <show_in_website>0</show_in_website>
70
  <show_in_store>0</show_in_store>
71
+ </version>
72
  <enabled translate="label">
73
  <label>Enabled</label>
74
  <frontend_type>select</frontend_type>
85
  <show_in_default>1</show_in_default>
86
  <show_in_website>1</show_in_website>
87
  <show_in_store>1</show_in_store>
88
+ </api_heading>
89
+ <api_note translate="label">
90
  <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>
91
  <frontend_model>fadello/adminhtml_system_config_form_field_note</frontend_model>
92
  <sort_order>21</sort_order>
93
  <show_in_default>1</show_in_default>
94
  <show_in_website>1</show_in_website>
95
+ <show_in_store>1</show_in_store>
96
+ </api_note>
97
  <api_id translate="label">
98
  <label>API ID</label>
99
  <frontend_type>text</frontend_type>
101
  <show_in_default>1</show_in_default>
102
  <show_in_website>1</show_in_website>
103
  <show_in_store>1</show_in_store>
104
+ </api_id>
105
  <api_token translate="label">
106
  <label>API Key</label>
107
  <frontend_type>text</frontend_type>
118
  <show_in_website>1</show_in_website>
119
  <show_in_store>1</show_in_store>
120
  </shipping_heading>
121
+ <shipping_note translate="label">
122
  <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>
123
  <frontend_model>fadello/adminhtml_system_config_form_field_note</frontend_model>
124
  <sort_order>31</sort_order>
125
  <show_in_default>1</show_in_default>
126
  <show_in_website>1</show_in_website>
127
+ <show_in_store>1</show_in_store>
128
+ </shipping_note>
129
  <cutoff_time translate="label">
130
  <label>Cut Off Time</label>
131
  <frontend_type>text</frontend_type>
134
  <show_in_website>1</show_in_website>
135
  <show_in_store>1</show_in_store>
136
  <tooltip>Data as supplied by Fadello, eg. 13:00</tooltip>
137
+ </cutoff_time>
138
  <pickup_time translate="label">
139
  <label>Pickup Time</label>
140
  <frontend_type>text</frontend_type>
143
  <show_in_website>1</show_in_website>
144
  <show_in_store>1</show_in_store>
145
  <tooltip>Data as supplied by Fadello, eg. 13:00-16:00</tooltip>
146
+ </pickup_time>
147
  <delivery_time translate="label">
148
  <label>Delivery Time</label>
149
  <frontend_type>text</frontend_type>
152
  <show_in_website>1</show_in_website>
153
  <show_in_store>1</show_in_store>
154
  <tooltip>Data as supplied by Fadello, eg. 18:00-22:30</tooltip>
155
+ </delivery_time>
156
  <sender_heading translate="label">
157
  <label>Pickup / Label Information</label>
158
  <frontend_model>fadello/adminhtml_system_config_form_field_heading</frontend_model>
161
  <show_in_website>1</show_in_website>
162
  <show_in_store>1</show_in_store>
163
  </sender_heading>
164
+ <sender_note translate="label">
165
  <label><![CDATA[<p>Enter the pickup information for the packages. This data will also be used on the shipping labels.</p><br/>]]></label>
166
  <frontend_model>fadello/adminhtml_system_config_form_field_note</frontend_model>
167
  <sort_order>41</sort_order>
168
  <show_in_default>1</show_in_default>
169
  <show_in_website>1</show_in_website>
170
+ <show_in_store>1</show_in_store>
171
+ </sender_note>
172
  <pu_name translate="label">
173
  <label>Company Name</label>
174
  <frontend_type>text</frontend_type>
176
  <show_in_default>1</show_in_default>
177
  <show_in_website>1</show_in_website>
178
  <show_in_store>1</show_in_store>
179
+ </pu_name>
180
  <pu_street translate="label">
181
  <label>Street</label>
182
  <frontend_type>text</frontend_type>
184
  <show_in_default>1</show_in_default>
185
  <show_in_website>1</show_in_website>
186
  <show_in_store>1</show_in_store>
187
+ </pu_street>
188
  <pu_homeno translate="label">
189
  <label>Home Number</label>
190
  <frontend_type>text</frontend_type>
192
  <show_in_default>1</show_in_default>
193
  <show_in_website>1</show_in_website>
194
  <show_in_store>1</show_in_store>
195
+ </pu_homeno>
196
  <pu_homeno_add translate="label">
197
  <label>Home Number Addition</label>
198
  <frontend_type>text</frontend_type>
200
  <show_in_default>1</show_in_default>
201
  <show_in_website>1</show_in_website>
202
  <show_in_store>1</show_in_store>
203
+ </pu_homeno_add>
204
  <pu_postalcode translate="label">
205
  <label>Postalcode</label>
206
  <frontend_type>text</frontend_type>
208
  <show_in_default>1</show_in_default>
209
  <show_in_website>1</show_in_website>
210
  <show_in_store>1</show_in_store>
211
+ </pu_postalcode>
212
  <pu_city translate="label">
213
  <label>City</label>
214
  <frontend_type>text</frontend_type>
216
  <show_in_default>1</show_in_default>
217
  <show_in_website>1</show_in_website>
218
  <show_in_store>1</show_in_store>
219
+ </pu_city>
220
  <pu_country translate="label">
221
  <label>Country</label>
222
  <frontend_type>select</frontend_type>
223
+ <source_model>adminhtml/system_config_source_country</source_model>
224
  <sort_order>48</sort_order>
225
  <show_in_default>1</show_in_default>
226
  <show_in_website>1</show_in_website>
227
  <show_in_store>1</show_in_store>
228
+ </pu_country>
229
  <pu_phone translate="label">
230
  <label>Telephone</label>
231
  <frontend_type>text</frontend_type>
233
  <show_in_default>1</show_in_default>
234
  <show_in_website>1</show_in_website>
235
  <show_in_store>1</show_in_store>
236
+ </pu_phone>
237
  <pu_email translate="label">
238
  <label>Email</label>
239
  <frontend_type>text</frontend_type>
241
  <show_in_default>1</show_in_default>
242
  <show_in_website>1</show_in_website>
243
  <show_in_store>1</show_in_store>
244
+ </pu_email>
245
  <general_heading translate="label">
246
  <label>General Settings</label>
247
  <frontend_model>fadello/adminhtml_system_config_form_field_heading</frontend_model>
249
  <show_in_default>1</show_in_default>
250
  <show_in_website>1</show_in_website>
251
  <show_in_store>1</show_in_store>
252
+ </general_heading>
253
  <seperate_homenumber translate="label">
254
  <label>Home Number on second street</label>
255
  <frontend_type>select</frontend_type>
269
  <show_in_website>1</show_in_website>
270
  <show_in_store>1</show_in_store>
271
  <tooltip>Enable this function to create shipments for next day. Will be available one hour after Cut Off Time.</tooltip>
272
+ </after_cutoff>
273
  <show_all_shipments translate="label">
274
  <label>Allow Shipment for non-Fadello orders</label>
275
  <frontend_type>select</frontend_type>
279
  <show_in_website>0</show_in_website>
280
  <show_in_store>0</show_in_store>
281
  <tooltip>Enable this function to create shipments in depend of the selected shipment carrier.</tooltip>
282
+ </show_all_shipments>
283
+ </fields>
284
+ </fadello>
285
+ </groups>
286
+ </shipping>
287
+ <carriers>
288
+ <groups>
289
+ <fadello translate="label" module="fadello">
290
+ <label>Fadello - Same Day Delivery</label>
291
+ <frontend_type>text</frontend_type>
292
+ <sort_order>103</sort_order>
293
+ <show_in_default>1</show_in_default>
294
+ <show_in_website>1</show_in_website>
295
+ <show_in_store>1</show_in_store>
296
  <fields>
297
  <active translate="label">
298
  <label>Enabled</label>
327
  <show_in_default>1</show_in_default>
328
  <show_in_website>1</show_in_website>
329
  <show_in_store>0</show_in_store>
330
+ </sort_order>
331
  <price_heading translate="label">
332
  <label>Pricing</label>
333
  <frontend_model>fadello/adminhtml_system_config_form_field_heading</frontend_model>
336
  <show_in_website>1</show_in_website>
337
  <show_in_store>1</show_in_store>
338
  </price_heading>
339
+ <price_note translate="label">
340
  <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>
341
  <frontend_model>fadello/adminhtml_system_config_form_field_note</frontend_model>
342
  <sort_order>11</sort_order>
343
  <show_in_default>1</show_in_default>
344
  <show_in_website>1</show_in_website>
345
+ <show_in_store>1</show_in_store>
346
+ </price_note>
347
+ <shipping_price>
348
+ <label>Shipping Price</label>
349
+ <frontend_model>fadello/adminhtml_config_form_field_shipping</frontend_model>
350
+ <backend_model>fadello/adminhtml_system_config_backend_design_shipping</backend_model>
351
+ <sort_order>12</sort_order>
352
+ <show_in_default>1</show_in_default>
353
+ <show_in_website>1</show_in_website>
354
+ <show_in_store>1</show_in_store>
355
+ </shipping_price>
356
  <availability_heading translate="label">
357
  <label>Availability</label>
358
  <frontend_model>fadello/adminhtml_system_config_form_field_heading</frontend_model>
360
  <show_in_default>1</show_in_default>
361
  <show_in_website>1</show_in_website>
362
  <show_in_store>1</show_in_store>
363
+ </availability_heading>
364
+ <availability_note translate="label">
365
  <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>
366
  <frontend_model>fadello/adminhtml_system_config_form_field_note</frontend_model>
367
  <sort_order>31</sort_order>
368
  <show_in_default>1</show_in_default>
369
  <show_in_website>1</show_in_website>
370
+ <show_in_store>1</show_in_store>
371
+ </availability_note>
372
+ <availability>
373
+ <label>Method Availability</label>
374
+ <frontend_model>fadello/adminhtml_config_form_field_availability</frontend_model>
375
+ <backend_model>fadello/adminhtml_system_config_backend_design_availability</backend_model>
376
+ <sort_order>32</sort_order>
377
+ <show_in_default>1</show_in_default>
378
+ <show_in_website>1</show_in_website>
379
+ <show_in_store>1</show_in_store>
380
+ </availability>
381
  <heading_sort translate="label">
382
  <label>Limitations</label>
383
  <frontend_model>fadello/adminhtml_system_config_form_field_heading</frontend_model>
385
  <show_in_default>1</show_in_default>
386
  <show_in_website>1</show_in_website>
387
  <show_in_store>1</show_in_store>
388
+ </heading_sort>
389
  <weight translate="label">
390
  <label>Maximum weight</label>
391
  <frontend_type>text</frontend_type>
394
  <show_in_website>1</show_in_website>
395
  <show_in_store>1</show_in_store>
396
  <tooltip>Fill in the Maximum weight of a shipment with the same data format as used in the Products.</tooltip>
397
+ </weight>
398
+ <stock_check translate="label">
399
+ <label>In Stock Check</label>
400
+ <frontend_type>select</frontend_type>
401
+ <source_model>adminhtml/system_config_source_yesno</source_model>
402
+ <sort_order>92</sort_order>
403
+ <show_in_default>1</show_in_default>
404
+ <show_in_website>1</show_in_website>
405
+ <show_in_store>1</show_in_store>
406
+ <tooltip>Only show method when complete cart is in stock based on quantity &amp; stock status.</tooltip>
407
+ </stock_check>
408
  <showmethod translate="label">
409
  <label>Show Method if Not Applicable</label>
410
  <frontend_type>select</frontend_type>
421
  <show_in_default>1</show_in_default>
422
  <show_in_website>1</show_in_website>
423
  <show_in_store>1</show_in_store>
424
+ </specificerrmsg>
425
  </fields>
426
+ </fadello>
427
+ </groups>
428
+ </carriers>
429
+ </sections>
430
  </config>
app/code/community/Magmodules/Fadello/sql/fadello_setup/mysql4-install-0.9.0.php CHANGED
@@ -1,9 +1,8 @@
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:
@@ -12,55 +11,66 @@
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();
1
+ <?php
2
  /**
3
  * Magmodules.eu - http://www.magmodules.eu
4
  *
5
  * NOTICE OF LICENSE
 
6
  * This source file is subject to the Open Software License (OSL 3.0)
7
  * that is bundled with this package in the file LICENSE.txt.
8
  * It is also available through the world-wide-web at this URL:
11
  * obtain it through the world-wide-web, please send an email
12
  * to info@magmodules.eu so we can send you a copy immediately.
13
  *
14
+ * @category Magmodules
15
+ * @package Magmodules_Fadello
16
+ * @author Magmodules <info@magmodules.eu>
17
+ * @copyright Copyright (c) 2017 (http://www.magmodules.eu)
18
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
  */
20
+
21
  $installer = new Mage_Sales_Model_Mysql4_Setup('core_setup');
22
  $installer->startSetup();
23
 
24
+ $installer->addAttribute(
25
+ '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
 
36
+ $installer->addAttribute(
37
+ 'order', 'fadello_deliver_id', array(
38
+ 'type' => 'varchar',
39
+ 'default' => null,
40
+ 'label' => 'Fadello: TransDeliverID',
41
+ 'visible' => false,
42
+ 'required' => false,
43
+ 'visible_on_front' => false,
44
+ 'user_defined' => false,
45
+ )
46
+ );
47
 
48
+ $installer->addAttribute(
49
+ 'order', 'fadello_barcode', array(
50
+ 'type' => 'varchar',
51
+ 'default' => null,
52
+ 'label' => 'Fadello: Barcode',
53
+ 'visible' => false,
54
+ 'required' => false,
55
+ 'visible_on_front' => false,
56
+ 'user_defined' => false,
57
+ )
58
+ );
59
 
60
+ $installer->addAttribute(
61
+ 'order', 'fadello_status', array(
62
+ 'type' => 'varchar',
63
+ 'default' => null,
64
+ 'label' => 'Fadello: Status',
65
+ 'visible' => false,
66
+ 'required' => false,
67
+ 'visible_on_front' => false,
68
+ 'user_defined' => false,
69
+ )
70
+ );
71
 
72
+ $installer->getConnection()->addColumn(
73
+ $this->getTable('sales/order_grid'), 'fadello_status',
74
+ 'varchar(255) not null default ""'
75
+ );
76
  $installer->endSetup();
app/design/frontend/base/default/layout/magmodules_fadello.xml CHANGED
@@ -1,8 +1,29 @@
1
- <?xml version="1.0"?>
2
- <layout version="0.1.0">
3
- <default>
4
- <reference name="head">
5
- <action method="addCss" ifconfig="carriers/fadello/active"><stylesheet>magmodules/fadello/style.css</stylesheet></action>
6
- </reference>
7
- </default>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  </layout>
1
+ <?xml version="1.0"?>
2
+ <!--
3
+ ~ Magmodules.eu - http://www.magmodules.eu
4
+ ~
5
+ ~ NOTICE OF LICENSE
6
+ ~ This source file is subject to the Open Software License (OSL 3.0)
7
+ ~ that is bundled with this package in the file LICENSE.txt.
8
+ ~ It is also available through the world-wide-web at this URL:
9
+ ~ http://opensource.org/licenses/osl-3.0.php
10
+ ~ If you did not receive a copy of the license and are unable to
11
+ ~ obtain it through the world-wide-web, please send an email
12
+ ~ to info@magmodules.eu so we can send you a copy immediately.
13
+ ~
14
+ ~ @category Magmodules
15
+ ~ @package Magmodules_Fadello
16
+ ~ @author Magmodules <info@magmodules.eu>
17
+ ~ @copyright Copyright (c) 2017 (http://www.magmodules.eu)
18
+ ~ @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
19
+ -->
20
+
21
+ <layout version="0.1.0">
22
+ <default>
23
+ <reference name="head">
24
+ <action method="addCss" ifconfig="carriers/fadello/active">
25
+ <stylesheet>magmodules/fadello/style.css</stylesheet>
26
+ </action>
27
+ </reference>
28
+ </default>
29
  </layout>
app/etc/modules/Magmodules_Fadello.xml CHANGED
@@ -1,25 +1,23 @@
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>
1
  <?xml version="1.0"?>
2
+
3
+ <!--
4
+ ~ Magmodules.eu - http://www.magmodules.eu
5
+ ~
6
+ ~ NOTICE OF LICENSE
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) 2017 (http://www.magmodules.eu)
19
+ ~ @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
20
+ -->
 
 
21
  <config>
22
  <modules>
23
  <Magmodules_Fadello>
app/locale/en_US/Magmodules_Fadello.csv CHANGED
@@ -1,4 +1,3 @@
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"
@@ -36,7 +35,7 @@
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"
 
1
  "About the Extension","About the Extension"
2
  "General Settings","General Settings"
3
  "Enabled","Enabled"
35
  "<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/>"
36
  "Shipping Price","Shipping Price"
37
  "Availability","Availability"
38
+ "<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/>"
39
  "Method Availability","Method Availability"
40
  "Limitations","Limitations"
41
  "Maximum weight","Maximum weight"
app/locale/nl_NL/Magmodules_Fadello.csv CHANGED
@@ -1,4 +1,3 @@
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
  "Add Fadello logo","Fadello Logo toevoegen"
4
  "General Settings","Algemene instellingen"
@@ -51,4 +50,5 @@
51
  "Create Shipment","Verzending aanmaken"
52
  "Cancel this Fadello Shipment","Annuleer deze Fadello verzending"
53
  "Open PDF","Open PDF"
54
- "Ship This Order","Verzend deze bestelling"
 
 
1
  "About the Extension","Over deze extensie"
2
  "Add Fadello logo","Fadello Logo toevoegen"
3
  "General Settings","Algemene instellingen"
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"
54
+ "<p>This extension is developed by <a href=""http://www.magmodules.eu/"" target=""_blank"">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/"" target=""_blank"">Magmodules</a>. Magmodules is een Magento Bureau gevestigd in Nederland.<br></p><p><strong>Lees alles over de de configuratie van deze extensie in onze <a href=""https://www.magmodules.eu/help/fadello"" target=""_blank"">knowledgebase.</a></strong></p>"
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Magmodules_Fadello</name>
4
- <version>1.0.1</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.magmodules.eu/license-agreement/">Single Server License</license>
7
  <channel>community</channel>
@@ -10,9 +10,9 @@
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-25</date>
14
- <time>11:55:48</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="c8fcd5d6b242abbc5c767505ae7229ac"/></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="4a049ff8d33570319ea4b78851a13bae"/><file name="system.xml" hash="2a65bf2272b1fd171e734955a4aa83d7"/></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="9b0679e3c383c7bc01866974aa3aa76a"/></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><dir name="frontend"><dir name="base"><dir name="default"><dir name="magmodules"><dir name="fadello"><dir name="images"><file name="Fadello_logo3.png" hash="87130480e8187cf4c2fff28142440aa1"/></dir><file name="style.css" hash="a270bf82e8a257817754711e6097a743"/></dir></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="magmodules_fadello.xml" hash="474f2db5123f2d8de0a1a23141570efd"/></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>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Magmodules_Fadello</name>
4
+ <version>1.0.2</version>
5
  <stability>stable</stability>
6
  <license uri="http://www.magmodules.eu/license-agreement/">Single Server License</license>
7
  <channel>community</channel>
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>2017-01-31</date>
14
+ <time>10:06:40</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="64913b7814babacd1ca98be1f7b471df"/><file name="Shipping.php" hash="e3b5fbe95d7ba0c851ecdeb9af1a0828"/></dir><dir name="Renderer"><file name="Select.php" hash="0cec29d42fd9cd861947d81b77b5e8b8"/></dir></dir></dir><dir name="Renderer"><file name="Shipment.php" hash="e93d10328c8d0ac118cafd84b3bc9b65"/></dir><dir name="System"><dir name="Config"><dir name="Form"><dir name="Field"><file name="Heading.php" hash="bfd7dd907ddac09e81909a1a2922c9e0"/><file name="Note.php" hash="5a8bf11167605594868a392cc57c6579"/><file name="Version.php" hash="bb824bb532efc7446dc49f63e5fbc7be"/></dir></dir></dir></dir></dir></dir><dir name="Helper"><file name="Data.php" hash="eabc58ff518d33e6dce0d6dcf5391f4d"/></dir><dir name="Model"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Backend"><dir name="Design"><file name="Availability.php" hash="416edf5e4a158fbd35157052289e41fb"/><file name="Shipping.php" hash="428c16b799df750709d6512cdded0884"/></dir></dir><dir name="Source"><file name="Days.php" hash="d2da23bd5162598137da002010c33272"/></dir></dir></dir></dir><file name="Api.php" hash="19dd3ee4b0418c2fae33e85b6a706f34"/><dir name="Carrier"><file name="ShippingMethod.php" hash="d1ab5b2bfdf59d17481e81c8ffd0f275"/></dir><file name="Observer.php" hash="afcb8e193677a8cd696d4db4013c1e69"/></dir><dir name="controllers"><dir name="Adminhtml"><file name="FadelloController.php" hash="b1ec6d48e97b82ac3e348bc9ec0a634b"/></dir></dir><dir name="etc"><file name="adminhtml.xml" hash="c21568b2ecfbe36b0271e4e7fe37a0f3"/><file name="config.xml" hash="834a929a48159a6e55dc17c5da60d135"/><file name="system.xml" hash="7b7e83a214ca4ed3d82f5fa820078d0d"/></dir><dir name="sql"><dir name="fadello_setup"><file name="mysql4-install-0.9.0.php" hash="d51f8f1f961f798d1e7da372c02a4a32"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Magmodules_Fadello.xml" hash="5565183cd8b0543c266a95077d90c622"/></dir></target><target name="magelocale"><dir><dir name="en_US"><file name="Magmodules_Fadello.csv" hash="396606fa364a8f170e15d6be1c408ebe"/></dir><dir name="nl_NL"><file name="Magmodules_Fadello.csv" hash="a99468173196eeeb79e2e9d6673d1fb1"/></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><dir name="frontend"><dir name="base"><dir name="default"><dir name="magmodules"><dir name="fadello"><dir name="images"><file name="Fadello_logo3.png" hash="87130480e8187cf4c2fff28142440aa1"/></dir><file name="style.css" hash="ff9b3d7c2f1a166fee23007fc1ea7f4a"/></dir></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><file name="magmodules_fadello.xml" hash="569e347f70b4731daf77b6acc5a4488a"/></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/frontend/base/default/magmodules/fadello/style.css CHANGED
@@ -1,21 +1,24 @@
1
- /**
2
- * Magmodules.eu - http://www.magmodules.eu - info@magmodules.eu
3
- * =============================================================
4
- * NOTICE OF LICENSE [Single domain license]
5
- * This source file is subject to the EULA that is
6
- * available through the world-wide-web at:
7
- * http://www.magmodules.eu/license-agreement/
8
- * =============================================================
9
- * @category Magmodules
10
- * @package Magmodules_Fadello
11
- * @author Magmodules <info@magmodules.eu>
12
- * @copyright Copyright (c) 2016 (http://www.magmodules.eu)
13
- * @license http://www.magmodules.eu/license-agreement/
14
- * =============================================================
 
 
 
15
  */
16
-
17
  .fadello-class {
18
- color: #0c9;
19
  background: url(./images/Fadello_logo3.png) no-repeat right;
20
  background-size: 125px;
21
  padding-bottom: 10px;
1
+ /*
2
+ * Magmodules.eu - http://www.magmodules.eu
3
+ *
4
+ * NOTICE OF LICENSE
5
+ * This source file is subject to the Open Software License (OSL 3.0)
6
+ * that is bundled with this package in the file LICENSE.txt.
7
+ * It is also available through the world-wide-web at this URL:
8
+ * http://opensource.org/licenses/osl-3.0.php
9
+ * If you did not receive a copy of the license and are unable to
10
+ * obtain it through the world-wide-web, please send an email
11
+ * to info@magmodules.eu so we can send you a copy immediately.
12
+ *
13
+ * @category Magmodules
14
+ * @package Magmodules_Fadello
15
+ * @author Magmodules <info@magmodules.eu>
16
+ * @copyright Copyright (c) 2017 (http://www.magmodules.eu)
17
+ * @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
18
  */
19
+
20
  .fadello-class {
21
+ color: #0C9;
22
  background: url(./images/Fadello_logo3.png) no-repeat right;
23
  background-size: 125px;
24
  padding-bottom: 10px;