Search code examples
magentomagento-1.7magento-1.8magento-1.6

Restrict countries for shipping in magento


I have multi store website in magento. In one of my website I want to restrict the countries that I can make shipping. But the payment can be received from anywhere of the world. I have tried

system --> configuration --> web --> general

And

system --> configuration --> shipping method --> specify country

but the problem is that in checkout page, I want to show all countries name in the dropdown list of billing information and I want to show only a specific country, eg: India in the dropdown list of shipping information. Is there any way to do so? Any help would be great full... Thank you.


Solution

  • From Class : abstract class

    Mage_Checkout_Block_Onepage_Abstract
    

    public function getCountryHtmlSelect($type)

    $select = $this->getLayout()->createBlock('core/html_select')
                ->setName($type.'[country_id]')
                ->setId($type.':country_id')
                ->setTitle(Mage::helper('checkout')->__('Country'))
                ->setClass('validate-select')
                ->setValue($countryId)
                ->setOptions($this->getCountryOptions());
    

    So setOptions($this->getCountryOptions() is responsible for that drop down list of shipping countries. Here you place is $type is equal to shipping then call $this->getShippingCountryOptions() follow this by writing your own code for this function refering to function getCountryOptions() code.

    Note : Do not touch core files. This is just a guideline.