Magento – cart shipping & tax automatic estimation – one country

cartshipping

we are plan to ship only to one default country – so the question is, how to change
Magento CE 1.8 cart Estimate Shipping and Tax block – to automatically show (calculate) all shipping methods. By default Magento requires to fill post code – but we will ship only with one country – so the price for any post code is the same.

Any hints how to force Magento to show automatically estimation without filling post code ?

Thank You

Best Answer

You can:

1) copy file app\code\core\Mage\Checkout\Block\Cart\Shipping.php in the app\code\local\Mage\Checkout\Block\Cart\Shipping.php

2) define method

protected function _getQuote()
{
    return Mage::getSingleton('checkout/cart')->getQuote();
}

3) in the function getEstimateRates add

$this->_getQuote()->getShippingAddress()
        ->setCountryId($country)
        ->setCity($city)
        ->setPostcode($postcode)
        ->setRegionId($regionId)
        ->setRegion($region)
        ->setCollectShippingRates(true);
$this->_getQuote()->save();

where $country and other variables are you pre-defined values.

4) copy the template app\design\frontend\base\default\template\checkout\cart\shipping.phtml into your custom theme and adjust if if needed.

Related Topic