Version Notes
* Correção no cálculo de dimensão dos produtos
Download this release
Release Info
Developer | Willian |
Extension | correios |
Version | 1.3.4 |
Comparing to | |
See all releases |
Code changes from version 1.3.3 to 1.3.4
- app/code/community/Storm/Correios/Helper/Data.php +0 -0
- app/code/community/Storm/Correios/Model/Adminhtml/Observer.php +11 -11
- app/code/community/Storm/Correios/Model/Carrier/Package/Dimension.php +52 -49
- app/code/community/Storm/Correios/Model/Carrier/Shipping.php +152 -147
- app/code/community/Storm/Correios/Model/Carrier/Shipping/Tracking.php +0 -0
- app/code/community/Storm/Correios/Model/Carrier/Webservice.php +56 -55
- app/code/community/Storm/Correios/Model/Catalog/Resource/Setup.php +0 -0
- app/code/community/Storm/Correios/Model/Source/FreeMethods.php +0 -0
- app/code/community/Storm/Correios/Model/Source/Methods.php +0 -0
- app/code/community/Storm/Correios/etc/config.xml +0 -0
- app/code/community/Storm/Correios/etc/system.xml +0 -0
- app/code/community/Storm/Correios/sql/correios_setup/mysql4-install-0.1.0.php +0 -0
- app/etc/modules/Storm_Correios.xml +0 -0
- app/locale/pt_BR/Storm_Correios.csv +1 -1
- package.xml +17 -18
app/code/community/Storm/Correios/Helper/Data.php
CHANGED
File without changes
|
app/code/community/Storm/Correios/Model/Adminhtml/Observer.php
CHANGED
@@ -3,20 +3,20 @@
|
|
3 |
* @category Storm
|
4 |
* @package Storm_Correios
|
5 |
* @copyright Copyright (c) 2013 Willian Cordeiro de Souza
|
6 |
-
* @author Willian Cordeiro de Souza <williancordeirodesouza@gmail.com>
|
7 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
8 |
*/
|
9 |
-
class Storm_Correios_Model_Adminhtml_Observer
|
10 |
-
{
|
11 |
/**
|
12 |
* Check if there are errors in the module configuration
|
13 |
* and requirements for the delivery method
|
14 |
* work properly
|
15 |
-
*
|
16 |
* @param Varien_Event_Observer $observer
|
17 |
* @return boolean
|
18 |
*/
|
19 |
-
public function checkConfiguration(Varien_Event_Observer $observer)
|
20 |
{
|
21 |
try {
|
22 |
if (!Mage::getSingleton('admin/session')->isLoggedIn()) {
|
@@ -26,7 +26,7 @@ class Storm_Correios_Model_Adminhtml_Observer
|
|
26 |
if(!Mage::helper('adminnotification')->isModuleEnabled()) {
|
27 |
return false;
|
28 |
}
|
29 |
-
|
30 |
if(!extension_loaded('soap')) {
|
31 |
throw new Exception(Mage::helper('correios')->__('The extension of PHP Soap must be installed so that the module Correios to function properly.'));
|
32 |
}
|
@@ -36,11 +36,11 @@ class Storm_Correios_Model_Adminhtml_Observer
|
|
36 |
}
|
37 |
|
38 |
return true;
|
39 |
-
} catch(Exception $e) {
|
40 |
$this->_addMessage($e->getMessage());
|
41 |
}
|
42 |
}
|
43 |
-
|
44 |
protected function _addMessage($message)
|
45 |
{
|
46 |
$this->_getInbox()->getResource()->parse($this->_getInbox(), array(
|
@@ -51,13 +51,13 @@ class Storm_Correios_Model_Adminhtml_Observer
|
|
51 |
'url' => '',
|
52 |
)
|
53 |
));
|
54 |
-
|
55 |
return $this;
|
56 |
}
|
57 |
-
|
58 |
/**
|
59 |
* Gets the message model
|
60 |
-
*
|
61 |
* @return Mage_AdminNotification_Model_Inbox
|
62 |
*/
|
63 |
protected function _getInbox()
|
3 |
* @category Storm
|
4 |
* @package Storm_Correios
|
5 |
* @copyright Copyright (c) 2013 Willian Cordeiro de Souza
|
6 |
+
* @author Willian Cordeiro de Souza <williancordeirodesouza@gmail.com>
|
7 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
8 |
*/
|
9 |
+
class Storm_Correios_Model_Adminhtml_Observer
|
10 |
+
{
|
11 |
/**
|
12 |
* Check if there are errors in the module configuration
|
13 |
* and requirements for the delivery method
|
14 |
* work properly
|
15 |
+
*
|
16 |
* @param Varien_Event_Observer $observer
|
17 |
* @return boolean
|
18 |
*/
|
19 |
+
public function checkConfiguration(Varien_Event_Observer $observer)
|
20 |
{
|
21 |
try {
|
22 |
if (!Mage::getSingleton('admin/session')->isLoggedIn()) {
|
26 |
if(!Mage::helper('adminnotification')->isModuleEnabled()) {
|
27 |
return false;
|
28 |
}
|
29 |
+
|
30 |
if(!extension_loaded('soap')) {
|
31 |
throw new Exception(Mage::helper('correios')->__('The extension of PHP Soap must be installed so that the module Correios to function properly.'));
|
32 |
}
|
36 |
}
|
37 |
|
38 |
return true;
|
39 |
+
} catch(Exception $e) {
|
40 |
$this->_addMessage($e->getMessage());
|
41 |
}
|
42 |
}
|
43 |
+
|
44 |
protected function _addMessage($message)
|
45 |
{
|
46 |
$this->_getInbox()->getResource()->parse($this->_getInbox(), array(
|
51 |
'url' => '',
|
52 |
)
|
53 |
));
|
54 |
+
|
55 |
return $this;
|
56 |
}
|
57 |
+
|
58 |
/**
|
59 |
* Gets the message model
|
60 |
+
*
|
61 |
* @return Mage_AdminNotification_Model_Inbox
|
62 |
*/
|
63 |
protected function _getInbox()
|
app/code/community/Storm/Correios/Model/Carrier/Package/Dimension.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
* @method Mage_Shipping_Model_Rate_Request getRequest()
|
4 |
* @method Storm_Correios_Model_Carrier_Package_Dimension setError(Exception $error)
|
@@ -16,80 +17,82 @@ class Storm_Correios_Model_Carrier_Package_Dimension extends Varien_Object
|
|
16 |
const PACKAGE_MAX_LENGTH = 105;
|
17 |
const PACKAGE_MIN_HEIGHT = 2;
|
18 |
const PACKAGE_MAX_HEIGHT = 105;
|
19 |
-
const PACKAGE_MIN_WIDTH = 11;
|
20 |
const PACKAGE_MAX_WIDTH = 105;
|
21 |
const PACKAGE_MAX_SUM = 200;
|
22 |
-
|
23 |
/**
|
24 |
* Assign requisition
|
25 |
-
*
|
26 |
* @param Mage_Shipping_Model_Rate_Request $request
|
27 |
* @return Storm_Correios_Model_Carrier_Package_Dimension
|
28 |
*/
|
29 |
public function setRequest(Mage_Shipping_Model_Rate_Request $request)
|
30 |
{
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
|
|
|
|
53 |
/**
|
54 |
* Checks if the dimensions of packages
|
55 |
* products are valid
|
56 |
-
*
|
57 |
* @return boolean
|
58 |
* @throws Mage_Shipping_Exception
|
59 |
*/
|
60 |
public function isValid()
|
61 |
{
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
}
|
85 |
-
|
86 |
/**
|
87 |
* Gets the helper module's main
|
88 |
-
*
|
89 |
* @return Storm_Correios_Helper_Data
|
90 |
*/
|
91 |
protected function _getHelper()
|
92 |
{
|
93 |
-
|
94 |
}
|
95 |
}
|
1 |
<?php
|
2 |
+
|
3 |
/**
|
4 |
* @method Mage_Shipping_Model_Rate_Request getRequest()
|
5 |
* @method Storm_Correios_Model_Carrier_Package_Dimension setError(Exception $error)
|
17 |
const PACKAGE_MAX_LENGTH = 105;
|
18 |
const PACKAGE_MIN_HEIGHT = 2;
|
19 |
const PACKAGE_MAX_HEIGHT = 105;
|
20 |
+
const PACKAGE_MIN_WIDTH = 11;
|
21 |
const PACKAGE_MAX_WIDTH = 105;
|
22 |
const PACKAGE_MAX_SUM = 200;
|
23 |
+
|
24 |
/**
|
25 |
* Assign requisition
|
26 |
+
*
|
27 |
* @param Mage_Shipping_Model_Rate_Request $request
|
28 |
* @return Storm_Correios_Model_Carrier_Package_Dimension
|
29 |
*/
|
30 |
public function setRequest(Mage_Shipping_Model_Rate_Request $request)
|
31 |
{
|
32 |
+
foreach ($request->getAllItems() as $item) {
|
33 |
+
$cubic = ceil(pow(($item->getProduct()->getPackageWidth() * $item->getProduct()->getPackageHeight() * $item->getProduct()->getPackageLength()) * $item->getQty(), 1/3));
|
34 |
+
|
35 |
+
$this->setHeight($cubic + $this->getHeight())
|
36 |
+
->setWidth($cubic + $this->getWidth())
|
37 |
+
->setLength($cubic + $this->getLength());
|
38 |
+
}
|
39 |
+
|
40 |
+
if ($this->getWidth() < self::PACKAGE_MIN_WIDTH) {
|
41 |
+
$this->setWidth(self::PACKAGE_MIN_WIDTH);
|
42 |
+
}
|
43 |
+
|
44 |
+
if ($this->getHeight() < self::PACKAGE_MIN_HEIGHT) {
|
45 |
+
$this->setHeight(self::PACKAGE_MIN_HEIGHT);
|
46 |
+
}
|
47 |
+
|
48 |
+
if ($this->getLength() < self::PACKAGE_MIN_LENGTH) {
|
49 |
+
$this->setLength(self::PACKAGE_MIN_LENGTH);
|
50 |
+
}
|
51 |
+
|
52 |
+
$this->setData('request', $request);
|
53 |
+
return $this;
|
54 |
+
}
|
55 |
+
|
56 |
/**
|
57 |
* Checks if the dimensions of packages
|
58 |
* products are valid
|
59 |
+
*
|
60 |
* @return boolean
|
61 |
* @throws Mage_Shipping_Exception
|
62 |
*/
|
63 |
public function isValid()
|
64 |
{
|
65 |
+
try {
|
66 |
+
if ($this->getWidth() > self::PACKAGE_MAX_WIDTH) {
|
67 |
+
throw new Mage_Shipping_Exception($this->_getHelper()->__('The width of the products is greater than %d cm', self::PACKAGE_MAX_WIDTH));
|
68 |
+
}
|
69 |
|
70 |
+
if ($this->getHeight() > self::PACKAGE_MAX_HEIGHT) {
|
71 |
+
throw new Mage_Shipping_Exception($this->_getHelper()->__('The heigth of the products is greater than %d cm', self::PACKAGE_MAX_HEIGHT));
|
72 |
+
}
|
73 |
|
74 |
+
if ($this->getLength() > self::PACKAGE_MAX_LENGTH) {
|
75 |
+
throw new Mage_Shipping_Exception($this->_getHelper()->__('The length of the products is greater than %d cm', self::PACKAGE_MAX_LENGTH));
|
76 |
+
}
|
77 |
+
|
78 |
+
if (($this->getWidth() + $this->getHeigth() + $this->getLength()) > self::PACKAGE_MAX_SUM) {
|
79 |
+
throw new Mage_Shipping_Exception($this->_getHelper()->__('The dimensions of the products have passed the limit of of %d cm', self::PACKAGE_MAX_SUM));
|
80 |
+
}
|
81 |
+
} catch (Mage_Shipping_Exception $error) {
|
82 |
+
$this->setError($error);
|
83 |
+
return false;
|
84 |
+
}
|
85 |
+
|
86 |
+
return true;
|
87 |
}
|
88 |
+
|
89 |
/**
|
90 |
* Gets the helper module's main
|
91 |
+
*
|
92 |
* @return Storm_Correios_Helper_Data
|
93 |
*/
|
94 |
protected function _getHelper()
|
95 |
{
|
96 |
+
return Mage::helper('correios');
|
97 |
}
|
98 |
}
|
app/code/community/Storm/Correios/Model/Carrier/Shipping.php
CHANGED
@@ -4,75 +4,80 @@
|
|
4 |
* @category Storm
|
5 |
* @package Storm_Correios
|
6 |
* @copyright Copyright (c) 2013 Willian Cordeiro de Souza
|
7 |
-
* @author Willian Cordeiro de Souza <williancordeirodesouza@gmail.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
9 |
*/
|
10 |
class Storm_Correios_Model_Carrier_Shipping extends Mage_Shipping_Model_Carrier_Abstract implements Mage_Shipping_Model_Carrier_Interface
|
11 |
{
|
12 |
const CODE = 'correios';
|
13 |
const PACKAGE_WEIGHT_MAX = 30;
|
14 |
-
|
15 |
protected $_code = self::CODE;
|
16 |
protected $_clientRequest;
|
17 |
protected $_dimension;
|
18 |
|
19 |
/**
|
20 |
* It does the calculation and returns shipping prices and terms (if enabled)
|
21 |
-
*
|
22 |
* @param Mage_Shipping_Model_Rate_Request $request
|
23 |
* @return boolean
|
24 |
*/
|
25 |
public function collectRates(Mage_Shipping_Model_Rate_Request $request)
|
26 |
-
{
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
if(!$this->isValid($request)) {
|
|
|
|
|
|
|
|
|
35 |
return false;
|
36 |
}
|
37 |
-
|
38 |
-
|
39 |
-
return false;
|
40 |
-
}
|
41 |
-
|
42 |
-
foreach($rates as $rate) {
|
43 |
if ($rate->hasError()) {
|
44 |
-
if($this->_getHelper()->getConfigData('showmethod')) {
|
45 |
$this->_appendError($result, sprintf('%s: %s', $this->_getMethodTitle($rate), $rate->getErrorMessage()));
|
46 |
-
}
|
47 |
continue;
|
48 |
-
}
|
49 |
|
50 |
$method = Mage::getModel('shipping/rate_result_method');
|
51 |
$method->setCarrier($this->_code)
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
|
58 |
$result->append($method);
|
59 |
}
|
60 |
-
} catch(Exception $e) {
|
61 |
$this->_appendError($result, $e->getMessage());
|
62 |
return $result;
|
63 |
-
}
|
64 |
-
|
65 |
-
|
66 |
}
|
67 |
-
|
|
|
|
|
|
|
|
|
|
|
68 |
protected function _canShowDeliverytime()
|
69 |
{
|
70 |
-
return (bool)
|
71 |
}
|
72 |
-
|
73 |
/**
|
74 |
* Adds the error message in the result
|
75 |
-
*
|
76 |
* @param Mage_Shipping_Model_Rate_Result $result
|
77 |
* @param string $message
|
78 |
* @return Storm_Correios_Model_Carrier_Shipping
|
@@ -80,63 +85,63 @@ class Storm_Correios_Model_Carrier_Shipping extends Mage_Shipping_Model_Carrier_
|
|
80 |
protected function _appendError(Mage_Shipping_Model_Rate_Result &$result, $message)
|
81 |
{
|
82 |
$this->_getHelper()->log($message);
|
83 |
-
|
84 |
$error = Mage::getModel('shipping/rate_result_error');
|
85 |
$error->setCarrier($this->_code)
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
$result->append($error);
|
90 |
return $this;
|
91 |
}
|
92 |
|
93 |
/**
|
94 |
* Assign data received request by webservice
|
95 |
-
*
|
96 |
* @param array $request
|
97 |
* @return Storm_Correios_Model_Carrier_Shipping
|
98 |
*/
|
99 |
public function setRequest(array $request)
|
100 |
{
|
101 |
-
|
102 |
-
|
103 |
}
|
104 |
|
105 |
/**
|
106 |
* Gets the data from the webservice request
|
107 |
-
*
|
108 |
* @return array
|
109 |
*/
|
110 |
public function getRequest()
|
111 |
{
|
112 |
-
|
113 |
}
|
114 |
|
115 |
/**
|
116 |
* Checks if all details are correct
|
117 |
* to perform the calculation of shipping
|
118 |
-
*
|
119 |
* @param Mage_Shipping_Model_Rate_Request $request
|
120 |
* @return boolean
|
121 |
*/
|
122 |
public function isValid(Mage_Shipping_Model_Rate_Request $request)
|
123 |
{
|
124 |
-
if(!extension_loaded('soap')) {
|
125 |
throw new Mage_Shipping_Exception($this->_getHelper()->__('You must to install PHP Soap extension to use shipping method Correios.'));
|
126 |
return false;
|
127 |
}
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
return false;
|
132 |
-
|
133 |
-
|
134 |
-
if($request->getPackageWeight() > self::PACKAGE_WEIGHT_MAX) {
|
135 |
throw new Mage_Shipping_Exception($this->_getHelper()->__('The package weight exceeds the weight limit.'));
|
136 |
return false;
|
137 |
}
|
138 |
|
139 |
-
|
140 |
}
|
141 |
|
142 |
/**
|
@@ -147,72 +152,72 @@ class Storm_Correios_Model_Carrier_Shipping extends Mage_Shipping_Model_Carrier_
|
|
147 |
*/
|
148 |
public function getAllowedMethods()
|
149 |
{
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
}
|
154 |
|
155 |
/**
|
156 |
* Returns all methods of delivery of the module
|
157 |
* with their respective titles
|
158 |
-
*
|
159 |
* @return array
|
160 |
*/
|
161 |
public function getShippingMethods()
|
162 |
{
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
|
170 |
-
|
171 |
-
|
172 |
|
173 |
-
|
174 |
}
|
175 |
|
176 |
/**
|
177 |
* Gets the delivery method with the lowest price
|
178 |
-
*
|
179 |
* @param Varien_Object $rates
|
180 |
* @return Varien_Data
|
181 |
*/
|
182 |
public function getLowerPriceMethod(Varien_Object $rates)
|
183 |
{
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
}
|
202 |
-
|
203 |
/**
|
204 |
* Reports that the shipping tracking to is available
|
205 |
-
*
|
206 |
* @return boolean
|
207 |
*/
|
208 |
public function isTrackingAvailable()
|
209 |
{
|
210 |
return true;
|
211 |
}
|
212 |
-
|
213 |
/**
|
214 |
* Returns information from the post office tracker
|
215 |
-
*
|
216 |
* @param string $tracking
|
217 |
* @return Mage_Shipping_Model_Tracking_Result|boolean
|
218 |
*/
|
@@ -220,117 +225,117 @@ class Storm_Correios_Model_Carrier_Shipping extends Mage_Shipping_Model_Carrier_
|
|
220 |
{
|
221 |
$model = Mage::getModel('correios/carrier_shipping_tracking');
|
222 |
$model->setTrackingValue($tracking);
|
223 |
-
|
224 |
$result = $model->request();
|
225 |
-
if($result instanceof Mage_Shipping_Model_Tracking_Result){
|
226 |
-
if ($trackings = $result->getAllTrackings()) {
|
227 |
return $trackings[0];
|
228 |
}
|
229 |
-
} elseif(is_string($result) && !empty($result)) {
|
230 |
return $result;
|
231 |
}
|
232 |
-
|
233 |
return false;
|
234 |
}
|
235 |
-
|
236 |
/**
|
237 |
* Makes a request to the webservice of Correios
|
238 |
* Returns the values in array form
|
239 |
-
*
|
240 |
* @param Mage_Shipping_Model_Rate_Request $request
|
241 |
* @return boolean|array
|
242 |
*/
|
243 |
protected function _doRequest(Mage_Shipping_Model_Rate_Request $request)
|
244 |
{
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
}
|
256 |
-
|
257 |
/**
|
258 |
* Assign the result of the request made from webservice
|
259 |
-
*
|
260 |
* @param Varien_Object $request
|
261 |
* @return Storm_Correios_Model_Carrier_Shipping
|
262 |
*/
|
263 |
protected function _setClientRequest(array $request)
|
264 |
{
|
265 |
-
|
266 |
-
|
267 |
}
|
268 |
-
|
269 |
/**
|
270 |
* Gets the result of the request of the webservice
|
271 |
-
*
|
272 |
* @return Varien_Object
|
273 |
*/
|
274 |
protected function _getClientRequest()
|
275 |
{
|
276 |
-
|
277 |
}
|
278 |
|
279 |
/**
|
280 |
* Gets the title of the delivery method
|
281 |
* with or without delivery
|
282 |
-
*
|
283 |
* @param Varien_Object $method
|
284 |
* @param bool $includeDeliveryTime
|
285 |
* @return string
|
286 |
*/
|
287 |
protected function _getMethodTitle(Varien_Object $method, $includeDeliveryTime = false)
|
288 |
{
|
289 |
-
|
290 |
|
291 |
-
|
292 |
-
if($method->getDeliveryTime() > 1) {
|
293 |
return $this->_getHelper()->__('%s (%d working days)', $title, $method->getDeliveryTime());
|
294 |
} else {
|
295 |
-
return $this->_getHelper()->__('%s (%d working day)', $title, $method->getDeliveryTime());
|
296 |
}
|
297 |
-
|
298 |
|
299 |
-
|
300 |
}
|
301 |
|
302 |
/**
|
303 |
* Gets the final price of the freight
|
304 |
* Follows the rules of free shipping
|
305 |
-
*
|
306 |
* @param Varien_Object $method
|
307 |
* @return boolean|int|float
|
308 |
*/
|
309 |
protected function _getFinalPrice(Varien_Object $method, Mage_Shipping_Model_Rate_Request $request)
|
310 |
{
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
$finalPrice = $method->getPrice();
|
332 |
-
|
333 |
-
if($handlingFee = $this->getConfigData('handling_fee')) {
|
334 |
switch ($this->getConfigData('handling_type')) {
|
335 |
case 'F':
|
336 |
$finalPrice += $handlingFee;
|
@@ -340,17 +345,17 @@ class Storm_Correios_Model_Carrier_Shipping extends Mage_Shipping_Model_Carrier_
|
|
340 |
break;
|
341 |
}
|
342 |
}
|
343 |
-
|
344 |
-
|
345 |
-
}
|
346 |
-
|
347 |
/**
|
348 |
* Returns the Helper main module
|
349 |
-
*
|
350 |
* @return Storm_Correios_Helper_Data
|
351 |
*/
|
352 |
protected function _getHelper()
|
353 |
{
|
354 |
-
|
355 |
}
|
356 |
}
|
4 |
* @category Storm
|
5 |
* @package Storm_Correios
|
6 |
* @copyright Copyright (c) 2013 Willian Cordeiro de Souza
|
7 |
+
* @author Willian Cordeiro de Souza <williancordeirodesouza@gmail.com>
|
8 |
* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0)
|
9 |
*/
|
10 |
class Storm_Correios_Model_Carrier_Shipping extends Mage_Shipping_Model_Carrier_Abstract implements Mage_Shipping_Model_Carrier_Interface
|
11 |
{
|
12 |
const CODE = 'correios';
|
13 |
const PACKAGE_WEIGHT_MAX = 30;
|
14 |
+
|
15 |
protected $_code = self::CODE;
|
16 |
protected $_clientRequest;
|
17 |
protected $_dimension;
|
18 |
|
19 |
/**
|
20 |
* It does the calculation and returns shipping prices and terms (if enabled)
|
21 |
+
*
|
22 |
* @param Mage_Shipping_Model_Rate_Request $request
|
23 |
* @return boolean
|
24 |
*/
|
25 |
public function collectRates(Mage_Shipping_Model_Rate_Request $request)
|
26 |
+
{
|
27 |
+
$result = Mage::getModel('shipping/rate_result');
|
28 |
+
|
29 |
+
try {
|
30 |
+
if (!$this->_getHelper()->isEnabled()) {
|
31 |
+
return false;
|
32 |
+
}
|
33 |
+
|
34 |
+
if (!$this->isValid($request)) {
|
35 |
+
return false;
|
36 |
+
}
|
37 |
+
|
38 |
+
if (!$rates = $this->_doRequest($request)) {
|
39 |
return false;
|
40 |
}
|
41 |
+
|
42 |
+
foreach ($rates as $rate) {
|
|
|
|
|
|
|
|
|
43 |
if ($rate->hasError()) {
|
44 |
+
if ($this->_getHelper()->getConfigData('showmethod')) {
|
45 |
$this->_appendError($result, sprintf('%s: %s', $this->_getMethodTitle($rate), $rate->getErrorMessage()));
|
46 |
+
}
|
47 |
continue;
|
48 |
+
}
|
49 |
|
50 |
$method = Mage::getModel('shipping/rate_result_method');
|
51 |
$method->setCarrier($this->_code)
|
52 |
+
->setCarrierTitle($this->getConfigData('title'))
|
53 |
+
->setMethod($rate->getCode())
|
54 |
+
->setMethodTitle($this->_getMethodTitle($rate, $this->_canShowDeliverytime()))
|
55 |
+
->setCost($rate->getPrice())
|
56 |
+
->setPrice($this->_getFinalPrice($rate, $request));
|
57 |
|
58 |
$result->append($method);
|
59 |
}
|
60 |
+
} catch (Exception $e) {
|
61 |
$this->_appendError($result, $e->getMessage());
|
62 |
return $result;
|
63 |
+
}
|
64 |
+
|
65 |
+
return $result;
|
66 |
}
|
67 |
+
|
68 |
+
/**
|
69 |
+
* Check if can show delivery time to customer
|
70 |
+
*
|
71 |
+
* @return bool
|
72 |
+
*/
|
73 |
protected function _canShowDeliverytime()
|
74 |
{
|
75 |
+
return (bool)$this->_getHelper()->getConfigData('show_deliverytime');
|
76 |
}
|
77 |
+
|
78 |
/**
|
79 |
* Adds the error message in the result
|
80 |
+
*
|
81 |
* @param Mage_Shipping_Model_Rate_Result $result
|
82 |
* @param string $message
|
83 |
* @return Storm_Correios_Model_Carrier_Shipping
|
85 |
protected function _appendError(Mage_Shipping_Model_Rate_Result &$result, $message)
|
86 |
{
|
87 |
$this->_getHelper()->log($message);
|
88 |
+
|
89 |
$error = Mage::getModel('shipping/rate_result_error');
|
90 |
$error->setCarrier($this->_code)
|
91 |
+
->setCarrierTitle($this->getConfigData('title'))
|
92 |
+
->setErrorMessage($message);
|
93 |
+
|
94 |
$result->append($error);
|
95 |
return $this;
|
96 |
}
|
97 |
|
98 |
/**
|
99 |
* Assign data received request by webservice
|
100 |
+
*
|
101 |
* @param array $request
|
102 |
* @return Storm_Correios_Model_Carrier_Shipping
|
103 |
*/
|
104 |
public function setRequest(array $request)
|
105 |
{
|
106 |
+
$this->_request = $request;
|
107 |
+
return $this;
|
108 |
}
|
109 |
|
110 |
/**
|
111 |
* Gets the data from the webservice request
|
112 |
+
*
|
113 |
* @return array
|
114 |
*/
|
115 |
public function getRequest()
|
116 |
{
|
117 |
+
return $this->_request;
|
118 |
}
|
119 |
|
120 |
/**
|
121 |
* Checks if all details are correct
|
122 |
* to perform the calculation of shipping
|
123 |
+
*
|
124 |
* @param Mage_Shipping_Model_Rate_Request $request
|
125 |
* @return boolean
|
126 |
*/
|
127 |
public function isValid(Mage_Shipping_Model_Rate_Request $request)
|
128 |
{
|
129 |
+
if (!extension_loaded('soap')) {
|
130 |
throw new Mage_Shipping_Exception($this->_getHelper()->__('You must to install PHP Soap extension to use shipping method Correios.'));
|
131 |
return false;
|
132 |
}
|
133 |
+
|
134 |
+
if (!$this->_getHelper()->isValidPostcode($request->getDestPostcode())) {
|
135 |
+
throw new Mage_Shipping_Exception($this->_getHelper()->__('Please, enter the postcode correctly.'));
|
136 |
return false;
|
137 |
+
}
|
138 |
+
|
139 |
+
if ($request->getPackageWeight() > self::PACKAGE_WEIGHT_MAX) {
|
140 |
throw new Mage_Shipping_Exception($this->_getHelper()->__('The package weight exceeds the weight limit.'));
|
141 |
return false;
|
142 |
}
|
143 |
|
144 |
+
return true;
|
145 |
}
|
146 |
|
147 |
/**
|
152 |
*/
|
153 |
public function getAllowedMethods()
|
154 |
{
|
155 |
+
return array(
|
156 |
+
$this->_code => $this->getConfigData('name')
|
157 |
+
);
|
158 |
}
|
159 |
|
160 |
/**
|
161 |
* Returns all methods of delivery of the module
|
162 |
* with their respective titles
|
163 |
+
*
|
164 |
* @return array
|
165 |
*/
|
166 |
public function getShippingMethods()
|
167 |
{
|
168 |
+
$configs = explode(',', $this->getConfigData('methods'));
|
169 |
+
$methods = array();
|
170 |
+
foreach ($configs as $code) {
|
171 |
+
if (!$title = $this->_getHelper()->getMethodTitle($code)) {
|
172 |
+
continue;
|
173 |
+
}
|
174 |
|
175 |
+
$methods[$code] = $title;
|
176 |
+
}
|
177 |
|
178 |
+
return $methods;
|
179 |
}
|
180 |
|
181 |
/**
|
182 |
* Gets the delivery method with the lowest price
|
183 |
+
*
|
184 |
* @param Varien_Object $rates
|
185 |
* @return Varien_Data
|
186 |
*/
|
187 |
public function getLowerPriceMethod(Varien_Object $rates)
|
188 |
{
|
189 |
+
$bestMethod = null;
|
190 |
+
foreach ($rates as $rate) {
|
191 |
+
if ($rate->hasError() || $rate->getPrice() <= 0) {
|
192 |
+
continue;
|
193 |
+
}
|
194 |
+
|
195 |
+
if (is_null($bestMethod)) {
|
196 |
+
$bestMethod = $rate;
|
197 |
+
continue;
|
198 |
+
}
|
199 |
+
|
200 |
+
if ($bestMethod->getPrice() > $rate->getPrice()) {
|
201 |
+
$bestMethod = $rate;
|
202 |
+
}
|
203 |
+
}
|
204 |
+
|
205 |
+
return $bestMethod;
|
206 |
}
|
207 |
+
|
208 |
/**
|
209 |
* Reports that the shipping tracking to is available
|
210 |
+
*
|
211 |
* @return boolean
|
212 |
*/
|
213 |
public function isTrackingAvailable()
|
214 |
{
|
215 |
return true;
|
216 |
}
|
217 |
+
|
218 |
/**
|
219 |
* Returns information from the post office tracker
|
220 |
+
*
|
221 |
* @param string $tracking
|
222 |
* @return Mage_Shipping_Model_Tracking_Result|boolean
|
223 |
*/
|
225 |
{
|
226 |
$model = Mage::getModel('correios/carrier_shipping_tracking');
|
227 |
$model->setTrackingValue($tracking);
|
228 |
+
|
229 |
$result = $model->request();
|
230 |
+
if ($result instanceof Mage_Shipping_Model_Tracking_Result) {
|
231 |
+
if ($trackings = $result->getAllTrackings()) {
|
232 |
return $trackings[0];
|
233 |
}
|
234 |
+
} elseif (is_string($result) && !empty($result)) {
|
235 |
return $result;
|
236 |
}
|
237 |
+
|
238 |
return false;
|
239 |
}
|
240 |
+
|
241 |
/**
|
242 |
* Makes a request to the webservice of Correios
|
243 |
* Returns the values in array form
|
244 |
+
*
|
245 |
* @param Mage_Shipping_Model_Rate_Request $request
|
246 |
* @return boolean|array
|
247 |
*/
|
248 |
protected function _doRequest(Mage_Shipping_Model_Rate_Request $request)
|
249 |
{
|
250 |
+
/* @var $client Storm_Correios_Model_Carrier_Webservice */
|
251 |
+
$client = Mage::getModel('correios/carrier_webservice');
|
252 |
+
$client->setShippingRequest($request);
|
253 |
+
|
254 |
+
if (!$requestData = $client->request()) {
|
255 |
+
return false;
|
256 |
+
}
|
257 |
+
|
258 |
+
$this->_setClientRequest($requestData);
|
259 |
+
return $requestData;
|
260 |
}
|
261 |
+
|
262 |
/**
|
263 |
* Assign the result of the request made from webservice
|
264 |
+
*
|
265 |
* @param Varien_Object $request
|
266 |
* @return Storm_Correios_Model_Carrier_Shipping
|
267 |
*/
|
268 |
protected function _setClientRequest(array $request)
|
269 |
{
|
270 |
+
$this->_clientRequest = $request;
|
271 |
+
return $this;
|
272 |
}
|
273 |
+
|
274 |
/**
|
275 |
* Gets the result of the request of the webservice
|
276 |
+
*
|
277 |
* @return Varien_Object
|
278 |
*/
|
279 |
protected function _getClientRequest()
|
280 |
{
|
281 |
+
return $this->_clientRequest;
|
282 |
}
|
283 |
|
284 |
/**
|
285 |
* Gets the title of the delivery method
|
286 |
* with or without delivery
|
287 |
+
*
|
288 |
* @param Varien_Object $method
|
289 |
* @param bool $includeDeliveryTime
|
290 |
* @return string
|
291 |
*/
|
292 |
protected function _getMethodTitle(Varien_Object $method, $includeDeliveryTime = false)
|
293 |
{
|
294 |
+
$title = $this->_getHelper()->getMethodTitle($method->getCode());
|
295 |
|
296 |
+
if ($includeDeliveryTime) {
|
297 |
+
if ($method->getDeliveryTime() > 1) {
|
298 |
return $this->_getHelper()->__('%s (%d working days)', $title, $method->getDeliveryTime());
|
299 |
} else {
|
300 |
+
return $this->_getHelper()->__('%s (%d working day)', $title, $method->getDeliveryTime());
|
301 |
}
|
302 |
+
}
|
303 |
|
304 |
+
return $title;
|
305 |
}
|
306 |
|
307 |
/**
|
308 |
* Gets the final price of the freight
|
309 |
* Follows the rules of free shipping
|
310 |
+
*
|
311 |
* @param Varien_Object $method
|
312 |
* @return boolean|int|float
|
313 |
*/
|
314 |
protected function _getFinalPrice(Varien_Object $method, Mage_Shipping_Model_Rate_Request $request)
|
315 |
{
|
316 |
+
$freeMethod = $this->getConfigData('free_shipping_method');
|
317 |
+
|
318 |
+
if ($method->hasError() || $method->getPrice() <= 0) {
|
319 |
+
return false;
|
320 |
+
}
|
321 |
+
|
322 |
+
if ($request->getFreeShipping() === true) {
|
323 |
+
if ($freeMethod == 'lower-price') {
|
324 |
+
if ($bestMethod = $this->getLowerPriceMethod($this->_getClientRequest())) {
|
325 |
+
if ($bestMethod->getCode() == $method->getCode()) {
|
326 |
+
return 0;
|
327 |
+
}
|
328 |
+
}
|
329 |
+
}
|
330 |
+
|
331 |
+
if ($freeMethod == $method->getCode()) {
|
332 |
+
return 0;
|
333 |
+
}
|
334 |
+
}
|
335 |
+
|
336 |
$finalPrice = $method->getPrice();
|
337 |
+
|
338 |
+
if ($handlingFee = $this->getConfigData('handling_fee')) {
|
339 |
switch ($this->getConfigData('handling_type')) {
|
340 |
case 'F':
|
341 |
$finalPrice += $handlingFee;
|
345 |
break;
|
346 |
}
|
347 |
}
|
348 |
+
|
349 |
+
return $finalPrice;
|
350 |
+
}
|
351 |
+
|
352 |
/**
|
353 |
* Returns the Helper main module
|
354 |
+
*
|
355 |
* @return Storm_Correios_Helper_Data
|
356 |
*/
|
357 |
protected function _getHelper()
|
358 |
{
|
359 |
+
return Mage::helper('correios');
|
360 |
}
|
361 |
}
|
app/code/community/Storm/Correios/Model/Carrier/Shipping/Tracking.php
CHANGED
File without changes
|
app/code/community/Storm/Correios/Model/Carrier/Webservice.php
CHANGED
@@ -1,4 +1,5 @@
|
|
1 |
<?php
|
|
|
2 |
/**
|
3 |
* @category Storm
|
4 |
* @package Storm_Correios
|
@@ -29,14 +30,14 @@ class Storm_Correios_Model_Carrier_Webservice
|
|
29 |
)
|
30 |
));
|
31 |
|
32 |
-
if(!$this->_getHelper()->getConfigData('shipping_methods')) {
|
33 |
throw new Exception($this->_getHelper()->__('You must to select some shipping method.'));
|
34 |
}
|
35 |
|
36 |
$this->setParam('nCdEmpresa', $this->_getHelper()->getConfigData('account_code'))
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
}
|
41 |
|
42 |
/**
|
@@ -47,7 +48,7 @@ class Storm_Correios_Model_Carrier_Webservice
|
|
47 |
*/
|
48 |
public function getClient()
|
49 |
{
|
50 |
-
|
51 |
}
|
52 |
|
53 |
/**
|
@@ -60,8 +61,8 @@ class Storm_Correios_Model_Carrier_Webservice
|
|
60 |
*/
|
61 |
public function setParam($name, $value)
|
62 |
{
|
63 |
-
|
64 |
-
|
65 |
}
|
66 |
|
67 |
/**
|
@@ -71,7 +72,7 @@ class Storm_Correios_Model_Carrier_Webservice
|
|
71 |
*/
|
72 |
public function getParams()
|
73 |
{
|
74 |
-
|
75 |
}
|
76 |
|
77 |
/**
|
@@ -82,11 +83,11 @@ class Storm_Correios_Model_Carrier_Webservice
|
|
82 |
*/
|
83 |
public function getParam($key)
|
84 |
{
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
|
89 |
-
|
90 |
}
|
91 |
|
92 |
/**
|
@@ -97,26 +98,26 @@ class Storm_Correios_Model_Carrier_Webservice
|
|
97 |
*/
|
98 |
public function setShippingRequest(Mage_Shipping_Model_Rate_Request $request)
|
99 |
{
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
if($this->_getHelper()->getConfigData('stated_value')) {
|
115 |
$this->setParam('nVlValorDeclarado', $request->getPackageValue());
|
116 |
}
|
117 |
|
118 |
-
|
119 |
-
|
120 |
}
|
121 |
|
122 |
/**
|
@@ -126,7 +127,7 @@ class Storm_Correios_Model_Carrier_Webservice
|
|
126 |
*/
|
127 |
public function getShippingRequest()
|
128 |
{
|
129 |
-
|
130 |
}
|
131 |
|
132 |
/**
|
@@ -136,35 +137,35 @@ class Storm_Correios_Model_Carrier_Webservice
|
|
136 |
*/
|
137 |
public function request()
|
138 |
{
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
|
155 |
$result = array();
|
156 |
|
157 |
-
if(is_array($request)) {
|
158 |
-
foreach($request as $methodData) {
|
159 |
$result[] = $this->_convertWebserviceValues($methodData);
|
160 |
}
|
161 |
-
} elseif(isset($request->Codigo)) {
|
162 |
$result[] = $this->_convertWebserviceValues($request);
|
163 |
} else {
|
164 |
throw new Exception(Mage::helper('correios')->__('Cannot be possible to estimate shipping from Correios.'));
|
165 |
}
|
166 |
|
167 |
-
|
168 |
}
|
169 |
|
170 |
/**
|
@@ -174,7 +175,7 @@ class Storm_Correios_Model_Carrier_Webservice
|
|
174 |
*/
|
175 |
protected function _getHelper()
|
176 |
{
|
177 |
-
|
178 |
}
|
179 |
|
180 |
/**
|
@@ -186,20 +187,20 @@ class Storm_Correios_Model_Carrier_Webservice
|
|
186 |
*/
|
187 |
private function _convertWebserviceValues(stdClass $data)
|
188 |
{
|
189 |
-
|
190 |
-
|
191 |
|
192 |
-
if($data->Erro != 0) {
|
193 |
$result->setError($data->Erro)
|
194 |
-
|
195 |
|
196 |
return $result;
|
197 |
}
|
198 |
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
|
204 |
return $result;
|
205 |
}
|
1 |
<?php
|
2 |
+
|
3 |
/**
|
4 |
* @category Storm
|
5 |
* @package Storm_Correios
|
30 |
)
|
31 |
));
|
32 |
|
33 |
+
if (!$this->_getHelper()->getConfigData('shipping_methods')) {
|
34 |
throw new Exception($this->_getHelper()->__('You must to select some shipping method.'));
|
35 |
}
|
36 |
|
37 |
$this->setParam('nCdEmpresa', $this->_getHelper()->getConfigData('account_code'))
|
38 |
+
->setParam('sDsSenha', $this->_getHelper()->getConfigData('account_password'))
|
39 |
+
->setParam('nCdServico', $this->_getHelper()->getConfigData('shipping_methods'))
|
40 |
+
->setParam('sCepOrigem', Mage::getStoreConfig('shipping/origin/postcode'));
|
41 |
}
|
42 |
|
43 |
/**
|
48 |
*/
|
49 |
public function getClient()
|
50 |
{
|
51 |
+
return $this->_client;
|
52 |
}
|
53 |
|
54 |
/**
|
61 |
*/
|
62 |
public function setParam($name, $value)
|
63 |
{
|
64 |
+
$this->_params[$name] = $value;
|
65 |
+
return $this;
|
66 |
}
|
67 |
|
68 |
/**
|
72 |
*/
|
73 |
public function getParams()
|
74 |
{
|
75 |
+
return $this->_params;
|
76 |
}
|
77 |
|
78 |
/**
|
83 |
*/
|
84 |
public function getParam($key)
|
85 |
{
|
86 |
+
if (isset($this->_params[$key])) {
|
87 |
+
return $this->_params[$key];
|
88 |
+
}
|
89 |
|
90 |
+
return false;
|
91 |
}
|
92 |
|
93 |
/**
|
98 |
*/
|
99 |
public function setShippingRequest(Mage_Shipping_Model_Rate_Request $request)
|
100 |
{
|
101 |
+
$dimension = Mage::getModel('correios/carrier_package_dimension');
|
102 |
+
$dimension->setRequest($request);
|
103 |
+
|
104 |
+
$this->setParam('sCepDestino', $request->getDestPostcode())
|
105 |
+
->setParam('nVlPeso', $request->getPackageWeight())
|
106 |
+
->setParam('nCdFormato', 1)
|
107 |
+
->setParam('nVlComprimento', $dimension->getLength())
|
108 |
+
->setParam('nVlAltura', $dimension->getHeight())
|
109 |
+
->setParam('nVlLargura', $dimension->getWidth())
|
110 |
+
->setParam('nVlDiametro', 0)
|
111 |
+
->setParam('sCdMaoPropria', $this->_getHelper()->getConfigData('own_hands') ? 'S' : 'N')
|
112 |
+
->setParam('nVlValorDeclarado', 0)
|
113 |
+
->setParam('sCdAvisoRecebimento', $this->_getHelper()->getConfigData('receipt_warning') ? 'S' : 'N');
|
114 |
+
|
115 |
+
if ($this->_getHelper()->getConfigData('stated_value')) {
|
116 |
$this->setParam('nVlValorDeclarado', $request->getPackageValue());
|
117 |
}
|
118 |
|
119 |
+
$this->_request = $request;
|
120 |
+
return $this;
|
121 |
}
|
122 |
|
123 |
/**
|
127 |
*/
|
128 |
public function getShippingRequest()
|
129 |
{
|
130 |
+
return $this->_request;
|
131 |
}
|
132 |
|
133 |
/**
|
137 |
*/
|
138 |
public function request()
|
139 |
{
|
140 |
+
if (!$request = $this->getClient()->CalcPrecoPrazo($this->getParams())) {
|
141 |
+
return false;
|
142 |
+
}
|
143 |
|
144 |
+
if (!$request = $request->CalcPrecoPrazoResult) {
|
145 |
+
return false;
|
146 |
+
}
|
147 |
|
148 |
+
if (!$request = $request->Servicos) {
|
149 |
+
return false;
|
150 |
+
}
|
151 |
|
152 |
+
if (!$request = $request->cServico) {
|
153 |
+
return false;
|
154 |
+
}
|
155 |
|
156 |
$result = array();
|
157 |
|
158 |
+
if (is_array($request)) {
|
159 |
+
foreach ($request as $methodData) {
|
160 |
$result[] = $this->_convertWebserviceValues($methodData);
|
161 |
}
|
162 |
+
} elseif (isset($request->Codigo)) {
|
163 |
$result[] = $this->_convertWebserviceValues($request);
|
164 |
} else {
|
165 |
throw new Exception(Mage::helper('correios')->__('Cannot be possible to estimate shipping from Correios.'));
|
166 |
}
|
167 |
|
168 |
+
return $result;
|
169 |
}
|
170 |
|
171 |
/**
|
175 |
*/
|
176 |
protected function _getHelper()
|
177 |
{
|
178 |
+
return Mage::helper('correios');
|
179 |
}
|
180 |
|
181 |
/**
|
187 |
*/
|
188 |
private function _convertWebserviceValues(stdClass $data)
|
189 |
{
|
190 |
+
$result = new Varien_Object();
|
191 |
+
$result->setCode($data->Codigo);
|
192 |
|
193 |
+
if ($data->Erro != 0) {
|
194 |
$result->setError($data->Erro)
|
195 |
+
->setErrorMessage($data->MsgErro);
|
196 |
|
197 |
return $result;
|
198 |
}
|
199 |
|
200 |
+
$result->setPrice($this->_getHelper()->convertToFloat($data->Valor))
|
201 |
+
->setDeliveryTime($data->PrazoEntrega + intval($this->_getHelper()->getConfigData('add_delivery_time')))
|
202 |
+
->setHomeDelivery($data->EntregaDomiciliar == 'S' ? true : false)
|
203 |
+
->setSaturdayDelivery($data->EntregaSabado == 'S' ? true : false);
|
204 |
|
205 |
return $result;
|
206 |
}
|
app/code/community/Storm/Correios/Model/Catalog/Resource/Setup.php
CHANGED
File without changes
|
app/code/community/Storm/Correios/Model/Source/FreeMethods.php
CHANGED
File without changes
|
app/code/community/Storm/Correios/Model/Source/Methods.php
CHANGED
File without changes
|
app/code/community/Storm/Correios/etc/config.xml
CHANGED
File without changes
|
app/code/community/Storm/Correios/etc/system.xml
CHANGED
File without changes
|
app/code/community/Storm/Correios/sql/correios_setup/mysql4-install-0.1.0.php
CHANGED
File without changes
|
app/etc/modules/Storm_Correios.xml
CHANGED
File without changes
|
app/locale/pt_BR/Storm_Correios.csv
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
"Without contract","Sem contrato"
|
2 |
"With contract","Com contrato"
|
3 |
"Shipping methods","Métodos de entrega"
|
4 |
"Others","Outros"
|
1 |
+
"Without contract","Sem contrato"
|
2 |
"With contract","Com contrato"
|
3 |
"Shipping methods","Métodos de entrega"
|
4 |
"Others","Outros"
|
package.xml
CHANGED
@@ -1,31 +1,30 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>correios</name>
|
4 |
-
<version>1.3.
|
5 |
<stability>stable</stability>
|
6 |
<license>OSL 3.0</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>Módulo de cálculo de frete e prazo de entrega dos Correios com Pac, Sedex, Sedex 10, Sedex Hoje e e-Sedex.</summary>
|
10 |
-
<description>Módulo para efetuar cálculo de frete e prazo de entrega dos Correios
|
11 |
-
As seguintes funções estão disponíves
|
12 |
-

|
13 |
-
*
|
14 |
-
*
|
15 |
-
*
|
16 |
-
*
|
17 |
-
* Possibilidade de adicionar
|
18 |
-
*
|
19 |
-
|
20 |
-

|
|
|
21 |
This module is available only to Brazil.</description>
|
22 |
-
<notes
|
23 |
-
- Método de entrega padrão selecionados na instalação do módulo
|
24 |
-
</notes>
|
25 |
<authors><author><name>Willian</name><user>willsouza</user><email>williancordeirodesouza@gmail.com</email></author></authors>
|
26 |
-
<date>2014-
|
27 |
-
<time>23:
|
28 |
-
<contents><target name="magecommunity"><dir name="Storm"><dir name="Correios"><dir name="Helper"><file name="Data.php" hash="c0344a3cccf20787f115b24cacef68b7"/></dir><dir name="Model"><dir name="Adminhtml"><file name="Observer.php" hash="
|
29 |
<compatible/>
|
30 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
31 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>correios</name>
|
4 |
+
<version>1.3.4</version>
|
5 |
<stability>stable</stability>
|
6 |
<license>OSL 3.0</license>
|
7 |
<channel>community</channel>
|
8 |
<extends/>
|
9 |
<summary>Módulo de cálculo de frete e prazo de entrega dos Correios com Pac, Sedex, Sedex 10, Sedex Hoje e e-Sedex.</summary>
|
10 |
+
<description>Módulo para efetuar cálculo de frete e prazo de entrega dos Correios.<br /> 
|
11 |
+
As seguintes funções estão disponíves:<br /><br />
|
12 |
+
* Entrega com Sedex, Sedex a cobrar, Sedex 10, Sedex hoje, Pac, e-Sedex, e-Sedex prioritário e e-Sedex express.<br />
|
13 |
+
* Confingurações para comerciantes com contrato com os Correios com preço diferenciado.<br />
|
14 |
+
* Rastreador de objeto em tempo real.<br />
|
15 |
+
* Escolha do método de frete grátis inteligente ( segue regras de promoção ).<br />
|
16 |
+
* Possibilidade de adicionar dias ao prazo de entrega.<br /> 
|
17 |
+
* Possibilidade de adicionar taxa de manuseio fixa ou percentual.<br />
|
18 |
+
* Configuração e instalação fácil e intuítiva.<br />
|
19 |
+
<br />
|
20 |
+
Caso tenha dúvida de como instalar e configurar o módulo <a href="https://bitbucket.org/willcs/correios/wiki">acesse nosso Wiki</a>.<br />
|
21 |
+
<hr />
|
22 |
This module is available only to Brazil.</description>
|
23 |
+
<notes>* Correção no cálculo de dimensão dos produtos</notes>
|
|
|
|
|
24 |
<authors><author><name>Willian</name><user>willsouza</user><email>williancordeirodesouza@gmail.com</email></author></authors>
|
25 |
+
<date>2014-05-02</date>
|
26 |
+
<time>23:24:14</time>
|
27 |
+
<contents><target name="magecommunity"><dir name="Storm"><dir name="Correios"><dir name="Helper"><file name="Data.php" hash="c0344a3cccf20787f115b24cacef68b7"/></dir><dir name="Model"><dir name="Adminhtml"><file name="Observer.php" hash="200870678c607ae75bef43f7f5d19569"/></dir><dir name="Carrier"><dir name="Package"><file name="Dimension.php" hash="5e835a94891276aee3286c87668ae957"/></dir><dir name="Shipping"><file name="Tracking.php" hash="97c09a03c9bc77ded9e01099887ecb67"/></dir><file name="Shipping.php" hash="148978df8ff1c28c1769cf7734818800"/><file name="Webservice.php" hash="6223f35a2722f22d15386b2b84237528"/></dir><dir name="Catalog"><dir name="Resource"><file name="Setup.php" hash="833a10b8bc912d3df9818f3b0f86d442"/></dir></dir><dir name="Source"><file name="FreeMethods.php" hash="67646bf270c42fa6fa8b79de336236b3"/><file name="Methods.php" hash="d9118016fe15471f813682385c95a93b"/></dir></dir><dir name="etc"><file name="config.xml" hash="e781224a3dbd9007877e4ab0f710bc0d"/><file name="system.xml" hash="7fc9af5f08e42d25f0fad5b93a1694da"/></dir><dir name="sql"><dir name="correios_setup"><file name="mysql4-install-0.1.0.php" hash="dca339c0e46e4b9d116bc1eea9d09930"/></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Storm_Correios.xml" hash="93aa3a9938657131b77fa2a2e60abd71"/></dir></target><target name="magelocale"><dir name="pt_BR"><file name="Storm_Correios.csv" hash="a6f14dd49a4de226a70939c093cd0755"/></dir></target></contents>
|
28 |
<compatible/>
|
29 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
30 |
</package>
|