/** * Add a rate to the result * * @param Mage_Shipping_Model_Rate_Result_Abstract|Mage_Shipping_Model_Rate_Result $result */ public function append($result) { if ($result instanceof Mage_Shipping_Model_Rate_Result_Abstract) { $this->_rates[] = $result; } elseif ($result instanceof Mage_Shipping_Model_Rate_Result) { $rates = $result->getAllRates(); foreach ($rates as $rate) { $this->append($rate); } } return $this; }
/** * Remove Errors in Case When Rate Exist * * @return Mage_Shipping_Model_Rate_Result */ protected function _removeErrorsIfRateExist() { $rateResultExist = false; $rates = array(); foreach ($this->_result->getAllRates() as $rate) { if (!$rate instanceof Mage_Shipping_Model_Rate_Result_Error) { $rateResultExist = true; $rates[] = $rate; } } if ($rateResultExist) { $this->_result->reset(); $this->_result->setError(false); foreach ($rates as $rate) { $this->_result->append($rate); } } return $this->_result; }