diff --git a/src/Model/Carrier.php b/src/Model/Carrier.php index b4751d1..0ea580d 100644 --- a/src/Model/Carrier.php +++ b/src/Model/Carrier.php @@ -256,12 +256,14 @@ public function processOperatory( } if ($tarifa == null) { - $error = $this->_rateErrorFactory->create(); - $error->setCarrier($this->_code); - $error->setCarrierTitle($this->getConfigData('title') . ' - ' . $operatory->getName()); - $errorMessage = $this->getConfigData('specificerrmsg') ?: $errorMessage; - $error->setErrorMessage($errorMessage); - $rateResult->append($error); + if ($this->getConfigData('showmethod')) { + $error = $this->_rateErrorFactory->create(); + $error->setCarrier($this->_code); + $error->setCarrierTitle($this->getConfigData('title') . ' - ' . $operatory->getName()); + $errorMessage = $this->getConfigData('specificerrmsg') ?: $errorMessage; + $error->setErrorMessage($errorMessage); + $rateResult->append($error); + } return $rateResult; } diff --git a/src/Model/OcaApi.php b/src/Model/OcaApi.php index 9678f2b..bd93a4b 100644 --- a/src/Model/OcaApi.php +++ b/src/Model/OcaApi.php @@ -662,10 +662,10 @@ protected function loadFields($ci, $fields) $item = $ci->getElementsByTagName($field)->item(0); if ($item != null) { // En caso de que sea un array de elementos (como puede ser Servicios) - if ($item->firstChild->nodeType === XML_ELEMENT_NODE) { + if ($item->firstChild != null && $item->firstChild->nodeType === XML_ELEMENT_NODE) { $value = $this->childToArray($item->childNodes); } - if ($item->firstChild->nodeType === XML_TEXT_NODE) { + if ($item->firstChild == null || $item->firstChild->nodeType === XML_TEXT_NODE) { $value = $item->nodeValue; } }