5

I had overwriten the shipping Model , I need a carrier rates from the carrier codes for the further calculation in model class.

Thanks in advanced.

closed as unclear what you're asking by David Manners, Matthias Zeis, Keyul Shah, Fabian Schmengler, Wojtek Naruniec Mar 1 '15 at 11:48

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

6

Try this code

$cart = Mage::getSingleton('checkout/cart');
$address = $cart->getQuote()->getShippingAddress();
$shipping = Mage::getModel('shipping/shipping');        
    $result=$shipping->collectRatesByAddress($address)->getResult();
    $newrates = array();
    $newrateCodes = array();
    $shippingRates=$result->getAllRates();
    foreach ($shippingRates as $rate) {
        if ($rate instanceof Mage_Shipping_Model_Rate_Result_Error) {
            $errors[$rate->getCarrierTitle()] = 1;
        } else {
            $k = $rate->getCarrierTitle().' - '.$rate->getMethodTitle();
            $k = $rate->getCarrier() . '_' . $rate->getMethod();

            if ($address->getFreeShipping()) {
                $price = 0;
            } else {
                $price = $rate->getPrice();
            }

            if ($price) {
                $price = Mage::helper('tax')->getShippingPrice($price, false, $address);
            }

            $newrates[$k] = $price;
            $newrateCodes[$k] = $rate->getCarrier() . '_' . $rate->getMethod();
        }
    }

Not the answer you're looking for? Browse other questions tagged or ask your own question.