Version Notes
* Adicionada verificação para erros do áreas de risco
Download this release
Release Info
| Developer | Willian |
| Extension | correios |
| Version | 1.3.5 |
| Comparing to | |
| See all releases | |
Code changes from version 1.3.4 to 1.3.5
- app/code/community/Storm/Correios/Helper/Data.php +0 -0
- app/code/community/Storm/Correios/Model/Adminhtml/Observer.php +0 -0
- app/code/community/Storm/Correios/Model/Carrier/Package/Dimension.php +0 -0
- app/code/community/Storm/Correios/Model/Carrier/Shipping.php +6 -2
- app/code/community/Storm/Correios/Model/Carrier/Shipping/Tracking.php +0 -0
- app/code/community/Storm/Correios/Model/Carrier/Webservice.php +26 -5
- 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 +0 -0
- package.xml +5 -5
app/code/community/Storm/Correios/Helper/Data.php
CHANGED
|
File without changes
|
app/code/community/Storm/Correios/Model/Adminhtml/Observer.php
CHANGED
|
File without changes
|
app/code/community/Storm/Correios/Model/Carrier/Package/Dimension.php
CHANGED
|
File without changes
|
app/code/community/Storm/Correios/Model/Carrier/Shipping.php
CHANGED
|
@@ -40,7 +40,7 @@ class Storm_Correios_Model_Carrier_Shipping extends Mage_Shipping_Model_Carrier_
|
|
| 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 |
}
|
|
@@ -293,6 +293,10 @@ class Storm_Correios_Model_Carrier_Shipping extends Mage_Shipping_Model_Carrier_
|
|
| 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());
|
|
@@ -315,7 +319,7 @@ class Storm_Correios_Model_Carrier_Shipping extends Mage_Shipping_Model_Carrier_
|
|
| 315 |
{
|
| 316 |
$freeMethod = $this->getConfigData('free_shipping_method');
|
| 317 |
|
| 318 |
-
if ($method->hasError() || $method->getPrice() <= 0) {
|
| 319 |
return false;
|
| 320 |
}
|
| 321 |
|
| 40 |
}
|
| 41 |
|
| 42 |
foreach ($rates as $rate) {
|
| 43 |
+
if ($rate->hasError() && !$rate->getShowMessage()) {
|
| 44 |
if ($this->_getHelper()->getConfigData('showmethod')) {
|
| 45 |
$this->_appendError($result, sprintf('%s: %s', $this->_getMethodTitle($rate), $rate->getErrorMessage()));
|
| 46 |
}
|
| 293 |
{
|
| 294 |
$title = $this->_getHelper()->getMethodTitle($method->getCode());
|
| 295 |
|
| 296 |
+
if($method->getShowMessage() && $method->hasErrorMessage()) {
|
| 297 |
+
$title .= sprintf(' - %s', $method->getErrorMessage());
|
| 298 |
+
}
|
| 299 |
+
|
| 300 |
if ($includeDeliveryTime) {
|
| 301 |
if ($method->getDeliveryTime() > 1) {
|
| 302 |
return $this->_getHelper()->__('%s (%d working days)', $title, $method->getDeliveryTime());
|
| 319 |
{
|
| 320 |
$freeMethod = $this->getConfigData('free_shipping_method');
|
| 321 |
|
| 322 |
+
if (($method->hasError() && !$method->getShowMessage()) || $method->getPrice() <= 0) {
|
| 323 |
return false;
|
| 324 |
}
|
| 325 |
|
app/code/community/Storm/Correios/Model/Carrier/Shipping/Tracking.php
CHANGED
|
File without changes
|
app/code/community/Storm/Correios/Model/Carrier/Webservice.php
CHANGED
|
@@ -13,6 +13,7 @@ class Storm_Correios_Model_Carrier_Webservice
|
|
| 13 |
protected $_client;
|
| 14 |
protected $_params;
|
| 15 |
protected $_request;
|
|
|
|
| 16 |
|
| 17 |
/**
|
| 18 |
* Performs connection with webservice of Correios
|
|
@@ -190,13 +191,13 @@ class Storm_Correios_Model_Carrier_Webservice
|
|
| 190 |
$result = new Varien_Object();
|
| 191 |
$result->setCode($data->Codigo);
|
| 192 |
|
| 193 |
-
|
|
|
|
| 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)
|
|
@@ -204,4 +205,24 @@ class Storm_Correios_Model_Carrier_Webservice
|
|
| 204 |
|
| 205 |
return $result;
|
| 206 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 207 |
}
|
| 13 |
protected $_client;
|
| 14 |
protected $_params;
|
| 15 |
protected $_request;
|
| 16 |
+
protected $_allowedErrors = array('009','010','011');
|
| 17 |
|
| 18 |
/**
|
| 19 |
* Performs connection with webservice of Correios
|
| 191 |
$result = new Varien_Object();
|
| 192 |
$result->setCode($data->Codigo);
|
| 193 |
|
| 194 |
+
$canShowMessage = $this->_isAllowedError($data->Erro);
|
| 195 |
+
if($data->Erro) {
|
| 196 |
$result->setError($data->Erro)
|
| 197 |
+
->setErrorMessage($data->MsgErro)
|
| 198 |
+
->setShowMessage($canShowMessage);
|
|
|
|
| 199 |
}
|
| 200 |
+
|
| 201 |
$result->setPrice($this->_getHelper()->convertToFloat($data->Valor))
|
| 202 |
->setDeliveryTime($data->PrazoEntrega + intval($this->_getHelper()->getConfigData('add_delivery_time')))
|
| 203 |
->setHomeDelivery($data->EntregaDomiciliar == 'S' ? true : false)
|
| 205 |
|
| 206 |
return $result;
|
| 207 |
}
|
| 208 |
+
|
| 209 |
+
/**
|
| 210 |
+
* Conforme o manual os erros de código 009/010/011, são avisos, não pode recusar o calculo devido a este erro,
|
| 211 |
+
* pois são lugares com Área de Risco para entrega, mas o pacote será enviado e cobrado normalmente, somente o
|
| 212 |
+
* prazo que vai comprometer.
|
| 213 |
+
*
|
| 214 |
+
* Página 15 - Item 3. Códigos e mensagens de erro
|
| 215 |
+
* Manual: http://www.correios.com.br/para-voce/correios-de-a-a-z/pdf/calculador-remoto-de-precos-e-prazos/manual-de-implementacao-do-calculo-remoto-de-precos-e-prazos
|
| 216 |
+
*
|
| 217 |
+
* @param string $code
|
| 218 |
+
* @return bool
|
| 219 |
+
*/
|
| 220 |
+
protected function _isAllowedError($code)
|
| 221 |
+
{
|
| 222 |
+
if(empty($code) || !in_array($code, $this->_allowedErrors)) {
|
| 223 |
+
return false;
|
| 224 |
+
}
|
| 225 |
+
|
| 226 |
+
return true;
|
| 227 |
+
}
|
| 228 |
}
|
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
|
File without changes
|
package.xml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 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>
|
|
@@ -20,11 +20,11 @@ As seguintes funções estão disponíves:<br /><br /&g
|
|
| 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>*
|
| 24 |
<authors><author><name>Willian</name><user>willsouza</user><email>williancordeirodesouza@gmail.com</email></author></authors>
|
| 25 |
-
<date>2014-
|
| 26 |
-
<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="
|
| 28 |
<compatible/>
|
| 29 |
<dependencies><required><php><min>5.2.0</min><max>6.0.0</max></php></required></dependencies>
|
| 30 |
</package>
|
| 1 |
<?xml version="1.0"?>
|
| 2 |
<package>
|
| 3 |
<name>correios</name>
|
| 4 |
+
<version>1.3.5</version>
|
| 5 |
<stability>stable</stability>
|
| 6 |
<license>OSL 3.0</license>
|
| 7 |
<channel>community</channel>
|
| 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>* Adicionada verificação para erros do áreas de risco</notes>
|
| 24 |
<authors><author><name>Willian</name><user>willsouza</user><email>williancordeirodesouza@gmail.com</email></author></authors>
|
| 25 |
+
<date>2014-06-16</date>
|
| 26 |
+
<time>18:06:41</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="1f5f7d410e1012cd7bd57e7638db7a1e"/><file name="Webservice.php" hash="210fad34b9ac774c3f081b2c03684e18"/></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>
|
