improve externalLog
This commit is contained in:
@@ -32,6 +32,9 @@ class Zh_UspsLabelsOverride extends Zh_UspsLabels
|
|||||||
// If Bridge returns a valid numeric rate, use it.
|
// If Bridge returns a valid numeric rate, use it.
|
||||||
// If it returns FALSE (api error, no token, etc), fall back to old logic.
|
// If it returns FALSE (api error, no token, etc), fall back to old logic.
|
||||||
if ($newRate !== false && $newRate !== null) {
|
if ($newRate !== false && $newRate !== null) {
|
||||||
|
if ($this->getHelper()->getModuleHelper()->getConfig('ADD_EASYPOST_FEE') && $newRate > 0) {
|
||||||
|
$newRate += 0.01;
|
||||||
|
}
|
||||||
return $newRate;
|
return $newRate;
|
||||||
}
|
}
|
||||||
$bridge->externalLog(['calculateRate Failed' => ['params' => $params, 'shipping_cost' => $shipping_cost, 'products' => $products, 'this' => $this]]);
|
$bridge->externalLog(['calculateRate Failed' => ['params' => $params, 'shipping_cost' => $shipping_cost, 'products' => $products, 'this' => $this]]);
|
||||||
|
|||||||
@@ -203,8 +203,11 @@ class Usps_Api_Bridge extends Module
|
|||||||
'postcode' => Tools::getValue('postcode'),
|
'postcode' => Tools::getValue('postcode'),
|
||||||
'id_country' => Tools::getValue('id_country'),
|
'id_country' => Tools::getValue('id_country'),
|
||||||
]]);
|
]]);
|
||||||
|
$destZip = $context->cookie->postcode;
|
||||||
|
$destCountryIso = Country::getIsoById((int)$context->cookie->id_country);
|
||||||
|
|
||||||
if (Tools::getIsset('postcode')) {
|
|
||||||
|
/* if (Tools::getIsset('postcode')) {
|
||||||
$destZip = Tools::getValue('postcode');
|
$destZip = Tools::getValue('postcode');
|
||||||
} elseif (isset($context->cookie->postcode)) {
|
} elseif (isset($context->cookie->postcode)) {
|
||||||
$destZip = $context->cookie->postcode;
|
$destZip = $context->cookie->postcode;
|
||||||
@@ -214,8 +217,8 @@ class Usps_Api_Bridge extends Module
|
|||||||
$destCountryIso = Country::getIsoById((int)Tools::getValue('id_country'));
|
$destCountryIso = Country::getIsoById((int)Tools::getValue('id_country'));
|
||||||
} elseif (isset($context->cookie->id_country)) {
|
} elseif (isset($context->cookie->id_country)) {
|
||||||
$destCountryIso = Country::getIsoById((int)$context->cookie->id_country);
|
$destCountryIso = Country::getIsoById((int)$context->cookie->id_country);
|
||||||
}
|
} */
|
||||||
}
|
} else {
|
||||||
if (!empty($params->id_address_delivery)) {
|
if (!empty($params->id_address_delivery)) {
|
||||||
$address = new Address($params->id_address_delivery);
|
$address = new Address($params->id_address_delivery);
|
||||||
if (Validate::isLoadedObject($address)) {
|
if (Validate::isLoadedObject($address)) {
|
||||||
@@ -243,6 +246,7 @@ class Usps_Api_Bridge extends Module
|
|||||||
]);
|
]);
|
||||||
$destCountryIso = 'US';
|
$destCountryIso = 'US';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (empty($destZip)) {
|
if (empty($destZip)) {
|
||||||
$this->externalLog([
|
$this->externalLog([
|
||||||
@@ -255,7 +259,7 @@ class Usps_Api_Bridge extends Module
|
|||||||
$originZip = $this->getOriginZip($originalModule);
|
$originZip = $this->getOriginZip($originalModule);
|
||||||
// $originZip = substr(preg_replace('/[^0-9]/', '', $originZip), 0, 5);
|
// $originZip = substr(preg_replace('/[^0-9]/', '', $originZip), 0, 5);
|
||||||
// $destZip = substr(preg_replace('/[^0-9]/', '', $destZip), 0, 5);
|
// $destZip = substr(preg_replace('/[^0-9]/', '', $destZip), 0, 5);
|
||||||
$isInternational = ($destCountryIso !== 'US');
|
$isInternational = $destCountryIso !== 'US';
|
||||||
|
|
||||||
// Map Code
|
// Map Code
|
||||||
$newApiClass = $this->mapServiceCodeToApiClass($methodCode, $isInternational);
|
$newApiClass = $this->mapServiceCodeToApiClass($methodCode, $isInternational);
|
||||||
@@ -263,6 +267,7 @@ class Usps_Api_Bridge extends Module
|
|||||||
$this->externalLog([
|
$this->externalLog([
|
||||||
'mapServiceCodeToApiClass()' => 'failed',
|
'mapServiceCodeToApiClass()' => 'failed',
|
||||||
'methodCode' => $methodCode,
|
'methodCode' => $methodCode,
|
||||||
|
'carrierId' => $carrierId,
|
||||||
'isInternational' => $isInternational,
|
'isInternational' => $isInternational,
|
||||||
]);
|
]);
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
Reference in New Issue
Block a user