Guest Christine from gecko Gully Posted March 1, 2010 Share Posted March 1, 2010 In the Shipping By Weight module, you can have up to four zones within which postage is calculated. But if a customer wants shipping to a country that is not specified in one of the zones, they get an "over weight" message and cannot purchase. I did a similar tweak for Shipping By Category, but now a client wants to use Shipping By Weight. So what I have done is use the first one, two or three zones for specific countries, then the last one has "RW" (for "Rest of the World") in the countries field. The customers uses this RW zone to specify the postage rates that will apply if a customer buys from a country that is not specified in one of the other zones. Then I have changed the code in modules/shipping/By_Weight/calc.php as follows: Look for the following code: // build array of ISO Codes $zones['1'] = explode(",",str_replace(" ","",strtoupper($module['zone1Countries']))); $zones['2'] = explode(",",str_replace(" ","",strtoupper($module['zone2Countries']))); $zones['3'] = explode(",",str_replace(" ","",strtoupper($module['zone3Countries']))); $zones['4'] = explode(",",str_replace(" ","",strtoupper($module['zone4Countries']))); After it, insert the following: $defaultZone = 0; if ($module['zone1Countries'] == "RW") { $defaultZone = 1; } if ($module['zone2Countries'] == "RW") { $defaultZone = 2; } if ($module['zone3Countries'] == "RW") { $defaultZone = 3; } if ($module['zone4Countries'] == "RW") { $defaultZone = 4; } Also, look for the following code: // find the country foreach ($zones as $key => $value){ foreach($zones[$key] as $no => $iso){ if($iso == $countryISO){ $shipZone = $key; } } } And after that, insert the following: if ($shipZone == 0) { $shipZone = $defaultZone; } Once again, I am using this forum as a good place to store my notes on how I am doing this, in case I have to do it again! Christine http://www.geckogully.com/websites Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.