/** * Do remote request for and handle errors * * @return Mage_Shipping_Model_Rate_Result */ protected function _getQuotes() { $this->_result = Mage::getModel('shipping/rate_result'); $allowedMethods = explode(',', $this->getConfigData('allowed_methods')); if (in_array(self::RATE_REQUEST_SMARTPOST, $allowedMethods)) { $response = $this->_doRatesRequest(self::RATE_REQUEST_SMARTPOST); $preparedSmartpost = $this->_prepareRateResponse($response); $this->_result->append($preparedSmartpost); } $response = $this->_doRatesRequest(self::RATE_REQUEST_GENERAL); $preparedGeneral = $this->_prepareRateResponse($response); if ($this->_result->getError() && $preparedGeneral->getError()) { return $this->_result->getError(); } $this->_result->append($preparedGeneral); $this->_removeErrorsIfRateExist(); return $this->_result; }
/** * Do remote request for and handle errors * * @return Mage_Shipping_Model_Rate_Result */ protected function _getQuotes() { $this->_result = Mage::getModel('shipping/rate_result'); // make separate request for Smart Post method $allowedMethods = explode(',', $this->getConfigData('allowed_methods')); if (in_array(self::RATE_REQUEST_SMARTPOST, $allowedMethods)) { $response = $this->_doRatesRequest(self::RATE_REQUEST_SMARTPOST); $preparedSmartpost = $this->_prepareRateResponse($response); if (!$preparedSmartpost->getError()) { $this->_result->append($preparedSmartpost); } } // make general request for all methods $response = $this->_doRatesRequest(self::RATE_REQUEST_GENERAL); $preparedGeneral = $this->_prepareRateResponse($response); if (!$preparedGeneral->getError() || $this->_result->getError() && $preparedGeneral->getError()) { $this->_result->append($preparedGeneral); } return $this->_result; }