Originally Posted by
Ch4iS
To those who ship internationally, how do you limit to which countries you ship to? I am currently shipping to Australia only now (Quoting NZ manually) and want to limit international shipping to NZ only for now.
This is usually done via the use of the zone definitions. However because the use of zones is counter intuitive in relation to the way the ozpost module functions (and the fact that it caused no end of support questions when people did try to use them) I dropped support for this quite some time ago, way back in version#1 I believe. As such, the ozpost module only 'knows' of two zones, Australia and the rest of the world.
Apparently, no one has missed this functionality (until now),
It wouldn't be too difficult to modify the ozpost module to include a line or two containing a list of country codes that you wish to allow, and have the module disable itself for any countries not listed.
With V3.1.3 ozpost, line #134 reads:
Code:
$this->enabled = ((MODULE_SHIPPING_OZPOST_STATUS == 'True') ? true : false);
After this line, you can insert something like:
Code:
$allowed_countries = array("AU", "NZ", "GB", US") ;
$this->enabled =false ;
if(in_array($order->delivery['country']['iso_code_2'], $allowed_countries)) $this->enabled = true ;
Important: I've not actually tried this code, and the example may contain syntax or other errors. It can also be done in many other ways, such as:
Code:
$this->enabled =false ;
if($order->delivery['country']['iso_code_2']) == "AU") $this->enabled = true ;
if($order->delivery['country']['iso_code_2']) == "NZ") $this->enabled = true ;
if($order->delivery['country']['iso_code_2']) == "US") $this->enabled = true ;
... etc, etc, etc....
Basically, the key is in manipulating the "$this->enabled" variable. If this is set to 'true' the module will be active, if it gets set to 'false' the module will be inactive. By initially setting it to 'false', and then setting it to 'true' for the countries you wish to allow should work well in your case.
Another merchant may wish to take the opposite approach, and set $this->enabled = true as the default, and then setting it to false for the countries they wish to dissallow.
Cheers
Rod
Bookmarks