Jump to content


Corporate Sponsors


Latest News: (loading..)

- - - - -

Shipping Rates for Different Zones


  • You cannot reply to this topic
13 replies to this topic

#1 shingmunriver

  • Community Member
  • 25 posts
  • Real Name:J Cheng

Posted 24 May 2011, 11:03

The 2.3.1 version presets shipping zone (except "Zone Rates") to be "none" or "Florida".

Supposedly, I want to sell goods to customers in three zones, e.g. Hong Kong, China/Macau, and overseas countries, how do I set up these shipping (postage or courier cost) rates for customers to apply? I did manage to set up the zone 1 shipping rate for Hong Kong, but was unable to set up those for zone 2 and zone 3.

I examined "oscommerce-2.3.1/catalog/includes/modules/shipping/", but could not find out how to create such a setup! Can somebody help!

Edited by shingmunriver, 24 May 2011, 11:05.


#2 FIMBLE

  • Community Member
  • 6,567 posts
  • Real Name:Nic
  • Gender:Male

Posted 25 May 2011, 13:18

you would need to set them up as a Zone, in admin >> Localizations >> Zones
You can view the current Florida set up to see how to add a new one.
Regards
Nic
Sometimes you're the dog and sometimes the lamp post

My Contributions

#3 shingmunriver

  • Community Member
  • 25 posts
  • Real Name:J Cheng

Posted 25 May 2011, 16:18

Hello Nic,

I'll try to reset the zones with your guides.

Thanks.

JC

#4 shingmunriver

  • Community Member
  • 25 posts
  • Real Name:J Cheng

Posted 26 May 2011, 10:52

Hi Nic,

I still could not figure out how to create the three zones for shipping charges.

All I can set up is a "Table Rate Module", which is very useful, but charges as applicable to different shipping zones remain essential if marketing is global.

Is it possible for me to set up three table-rate modules for zones? If possible, how to create them?

Regards,

JC

#5 MartinLass

  • Community Member
  • 7 posts

Posted 11 June 2011, 23:07

I was looking for the same answers. I'm surprised that nobody here seemed able to answer this. But I finally found it. It's simple. Open up your zones.php file (catalog/includes/modules/shipping/zones.php or similar location), and all the instructions and answers are there in the initial comments.

Enjoy!

#6 MartinLass

  • Community Member
  • 7 posts

Posted 12 June 2011, 00:06

Having said this, now I'm having a problem... Having set the zones.php code to use two shipping zones, when I go to the Admin/Modules/Shipping panel and click on "zone shipping," there are three new boxes at the bottom, but without headings, and anything entered is not saved. I suspect that this is for Zone 2 shipping parameters, as Zone 1 parameters are also three boxes (above this). Zone 1 is working fine.

Anybody encountered this? Any solution? I've even manually entered new geo_zones in the database, which then come up under some zone pull-down menus, but which have no effect on the zone shipping module. And when I then set the number of zones in zones.php, it throws an error, i.e. it can't find the data for the extra zone.

--Martin

View PostMartinLass, on 11 June 2011, 23:07, said:

I was looking for the same answers. I'm surprised that nobody here seemed able to answer this. But I finally found it. It's simple. Open up your zones.php file (catalog/includes/modules/shipping/zones.php or similar location), and all the instructions and answers are there in the initial comments.

Enjoy!


#7 MartinLass

  • Community Member
  • 7 posts

Posted 12 June 2011, 00:44

Okay... here's what I did to correct this zone shipping glitch. I went into the database and inserted three new rows/entries in the configuration section.

The existing/default Zone 1 rows in the configuration section of the database are "Zone 1 Countries", "Zone 1 Shipping Table", and "Zone 1 Handling Fee". (Lines 262, 263, and 264 in my database, but may be different in yours?)

By selecting each of these in turn and clicking "edit," I could view each entry at a glance. I copied down all the relevant parameters for each. (I did NOT edit and save these, though... it was just for viewing and copying.)

Then I inserted three new rows that were identical to the existing three rows EXCEPT:
--I used new ids: 265, 266, and 267 respectively... may be different for you, but I suspect that these ids must follow sequentially from the existing/default three Zone 1 rows. Be careful not to try to create rows with ids identical to existing ones!
--I changed each instance in the text parameters of "Zone 1" to "Zone 2". BE CAREFUL WITH THE configuration_key PARAMETER. ONLY EDIT THE NUMBER AT THE END. Zones.php needs this to be correct!
--I changed the country parameter (Shipping Countries row) to suit, the zones I wanted for Zone 2 (Shipping Table row), and the handling fee for Zone 2 (Handling Fee row).

NOTE: For those who are not MySQL savvy, you MUST enter the Date Added and Date Modified fields, and the Date Modified field MUST be later than the Date Added field.

I then updated zones.php to include 2 zones (see the instructions in the actual zone.php file).

When I then went to the Admin Panel and went to Module/Shipping and clicked on Zone Rates, the new Zone 2 rates were there! I could now edit these settings from here. And it worked in practice when placing orders for each of these zones!

Enjoy!

--Martin

#8 glaso

  • Community Member
  • 2 posts
  • Real Name:German Laso

Posted 13 June 2011, 23:01

Hi,

Anybody knows if this plugin could be used for zones within a country instead of countries. I won't be shipping internationally, but I wan't to have different rates depending on the city. I created 15 different regions within my country, but can't figure out how to use those regions to determine the shipping rate.

Thanks!!

#9 NEWPRob

  • Community Member
  • 17 posts
  • Real Name:Rob

Posted 25 June 2011, 21:47

View PostMartinLass, on 12 June 2011, 00:44, said:

Okay... here's what I did to correct this zone shipping glitch. I went into the database and inserted three new rows/entries in the configuration section.

The existing/default Zone 1 rows in the configuration section of the database are "Zone 1 Countries", "Zone 1 Shipping Table", and "Zone 1 Handling Fee". (Lines 262, 263, and 264 in my database, but may be different in yours?)

By selecting each of these in turn and clicking "edit," I could view each entry at a glance. I copied down all the relevant parameters for each. (I did NOT edit and save these, though... it was just for viewing and copying.)

Then I inserted three new rows that were identical to the existing three rows EXCEPT:
--I used new ids: 265, 266, and 267 respectively... may be different for you, but I suspect that these ids must follow sequentially from the existing/default three Zone 1 rows. Be careful not to try to create rows with ids identical to existing ones!
--I changed each instance in the text parameters of "Zone 1" to "Zone 2". BE CAREFUL WITH THE configuration_key PARAMETER. ONLY EDIT THE NUMBER AT THE END. Zones.php needs this to be correct!
--I changed the country parameter (Shipping Countries row) to suit, the zones I wanted for Zone 2 (Shipping Table row), and the handling fee for Zone 2 (Handling Fee row).

NOTE: For those who are not MySQL savvy, you MUST enter the Date Added and Date Modified fields, and the Date Modified field MUST be later than the Date Added field.

I then updated zones.php to include 2 zones (see the instructions in the actual zone.php file).

When I then went to the Admin Panel and went to Module/Shipping and clicked on Zone Rates, the new Zone 2 rates were there! I could now edit these settings from here. And it worked in practice when placing orders for each of these zones!

Enjoy!

--Martin

Thanks Martin! Exactly what I was looking for. I just opened each zone 1 row in phpmyadmin, changed the ID and selected "save as new row"

#10 kamranashraf

  • Community Member
  • 4 posts
  • Real Name:kamran ashraf

Posted 24 January 2012, 05:47

you need to uninstall zone module and then replace the zone file with orignel oscommerce zones.php then modify file and install the module also first enable zone methode set to false then remove it and then replace the file modify the zones.php as mentioned above and then install it the easiest methode i found is when you fresh install the oscommerce by default zones module isnt install so then you may modify the zonez.php and install you ,ll see all the changes,

#11 geoffreywalton

  • Community Sponsor
  • 7,731 posts
  • Real Name:Geoffrey Walton
  • Gender:Male
  • Location:Norfolk, UK (close to the centre of the universe)

Posted 24 January 2012, 12:41

View Postglaso, on 13 June 2011, 23:01, said:

Hi,

Anybody knows if this plugin could be used for zones within a country instead of countries. I won't be shipping internationally, but I wan't to have different rates depending on the city. I created 15 different regions within my country, but can't figure out how to use those regions to determine the shipping rate.

Thanks!!

Zones only works by country code, you could copy the table rates code as many times as you like for zones in a country.

(It does require each copy to be edited and renamed to make them unique, but there are several explanations on how to do this in the forum.)

Cheers

G

PS As the previous post say if you edit the number of zones you must remove the moduke and re-install. It is amazing the number of people that don't read and follow all of the installation / amendment instructions. :-)

Edited by geoffreywalton, 24 January 2012, 12:43.

Need help installing add ons/contributions, cleaning a hacked site or a bespoke development, check my profile

Virus Threat Scanner
My Contributions
Basic install answers.
Click here for Contributions / Add Ons.
UK your site.
Site Move.
Basic design info.

For links mentioned in old answers that are no longer here follow this link Useful Threads.

If this post was useful, click the Like This button over there ======>>>>>.

#12 Asomaro

  • Community Member
  • 3 posts
  • Real Name:simon

Posted 07 March 2012, 19:35

Hi Martin,

I hope you or perhaps another user can help me.

I need to add a second zone but I am stumped with how to change the config files as you suggested. I too have made the change to the zone.php file but the 2nd zone has no content and as you said, I cannot save anything (the boxes are there but no text).

So I tried to follow what you had said, but I think I am looking in the wrong places. Can you give me a bit more detail about how to:
a) Find the right .php file to add the 3 lines that you suggested
B) more detail on exactly how to add the lines to allow the "text" to show up.

I'm a bit new at this so please be gentle with me!

The actual code in my zone.php file looks like this (it does not go as high as line 262 so that is why I think I'm looking in the wrong place...)


*/

class zones {
var $code, $title, $description, $enabled, $num_zones;

// class constructor
function zones() {
$this->code = 'zones';
$this->title = MODULE_SHIPPING_ZONES_TEXT_TITLE;
$this->description = MODULE_SHIPPING_ZONES_TEXT_DESCRIPTION;
$this->sort_order = MODULE_SHIPPING_ZONES_SORT_ORDER;
$this->icon = '';
$this->tax_class = MODULE_SHIPPING_ZONES_TAX_CLASS;
$this->enabled = ((MODULE_SHIPPING_ZONES_STATUS == 'True') ? true : false);

// CUSTOMIZE THIS SETTING FOR THE NUMBER OF ZONES NEEDED
$this->num_zones = 2;
}

// class methods
function quote($method = '') {
global $order, $shipping_weight, $shipping_num_boxes;

$dest_country = $order->delivery['country']['iso_code_2'];
$dest_zone = 0;
$error = false;

for ($i=1; $i<=$this->num_zones; $i++) {
$countries_table = constant('MODULE_SHIPPING_ZONES_COUNTRIES_' . $i);
$country_zones = preg_split("/[,]/", $countries_table);
if (in_array($dest_country, $country_zones)) {
$dest_zone = $i;
break;
}
}

if ($dest_zone == 0) {
$error = true;
} else {
$shipping = -1;
$zones_cost = constant('MODULE_SHIPPING_ZONES_COST_' . $dest_zone);

$zones_table = preg_split("/[:,]/" , $zones_cost);
$size = sizeof($zones_table);
for ($i=0; $i<$size; $i+=2) {
if ($shipping_weight <= $zones_table[$i]) {
$shipping = $zones_table[$i+1];
$shipping_method = MODULE_SHIPPING_ZONES_TEXT_WAY . ' ' . $dest_country . ' : ' . $shipping_weight . ' ' . MODULE_SHIPPING_ZONES_TEXT_UNITS;
break;
}
}

if ($shipping == -1) {
$shipping_cost = 0;
$shipping_method = MODULE_SHIPPING_ZONES_UNDEFINED_RATE;
} else {
$shipping_cost = ($shipping * $shipping_num_boxes) + constant('MODULE_SHIPPING_ZONES_HANDLING_' . $dest_zone);
}
}

$this->quotes = array('id' => $this->code,
'module' => MODULE_SHIPPING_ZONES_TEXT_TITLE,
'methods' => array(array('id' => $this->code,
'title' => $shipping_method,
'cost' => $shipping_cost)));

if ($this->tax_class > 0) {
$this->quotes['tax'] = tep_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
}

if (tep_not_null($this->icon)) $this->quotes['icon'] = tep_image($this->icon, $this->title);

if ($error == true) $this->quotes['error'] = MODULE_SHIPPING_ZONES_INVALID_ZONE;

return $this->quotes;
}

function check() {
if (!isset($this->_check)) {
$check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_SHIPPING_ZONES_STATUS'");
$this->_check = tep_db_num_rows($check_query);
}
return $this->_check;
}

function install() {
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Enable Zones Method', 'MODULE_SHIPPING_ZONES_STATUS', 'True', 'Do you want to offer zone rate shipping?', '6', '0', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Tax Class', 'MODULE_SHIPPING_ZONES_TAX_CLASS', '0', 'Use the following tax class on the shipping fee.', '6', '0', 'tep_get_tax_class_title', 'tep_cfg_pull_down_tax_classes(', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_SHIPPING_ZONES_SORT_ORDER', '0', 'Sort order of display.', '6', '0', now())");
for ($i = 1; $i <= $this->num_zones; $i++) {
$default_countries = '';
if ($i == 1) {
$default_countries = 'US,CA';
}
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Zone " . $i ." Countries', 'MODULE_SHIPPING_ZONES_COUNTRIES_" . $i ."', '" . $default_countries . "', 'Comma separated list of two character ISO country codes that are part of Zone " . $i . ".', '6', '0', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Zone " . $i ." Shipping Table', 'MODULE_SHIPPING_ZONES_COST_" . $i ."', '3:8.50,7:10.50,99:20.00', 'Shipping rates to Zone " . $i . " destinations based on a group of maximum order weights. Example: 3:8.50,7:10.50,... Weights less than or equal to 3 would cost 8.50 for Zone " . $i . " destinations.', '6', '0', now())");
tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Zone " . $i ." Handling Fee', 'MODULE_SHIPPING_ZONES_HANDLING_" . $i."', '0', 'Handling Fee for this shipping zone', '6', '0', now())");
}
}

function remove() {
tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
}

function keys() {
$keys = array('MODULE_SHIPPING_ZONES_STATUS', 'MODULE_SHIPPING_ZONES_TAX_CLASS', 'MODULE_SHIPPING_ZONES_SORT_ORDER');

for ($i=1; $i<=$this->num_zones; $i++) {
$keys[] = 'MODULE_SHIPPING_ZONES_COUNTRIES_' . $i;
$keys[] = 'MODULE_SHIPPING_ZONES_COST_' . $i;
$keys[] = 'MODULE_SHIPPING_ZONES_HANDLING_' . $i;
}

return $keys;
}
}
?>

Cheers,

Simon

View PostMartinLass, on 12 June 2011, 00:44, said:

Okay... here's what I did to correct this zone shipping glitch. I went into the database and inserted three new rows/entries in the configuration section.

The existing/default Zone 1 rows in the configuration section of the database are "Zone 1 Countries", "Zone 1 Shipping Table", and "Zone 1 Handling Fee". (Lines 262, 263, and 264 in my database, but may be different in yours?)

By selecting each of these in turn and clicking "edit," I could view each entry at a glance. I copied down all the relevant parameters for each. (I did NOT edit and save these, though... it was just for viewing and copying.)

Then I inserted three new rows that were identical to the existing three rows EXCEPT:
--I used new ids: 265, 266, and 267 respectively... may be different for you, but I suspect that these ids must follow sequentially from the existing/default three Zone 1 rows. Be careful not to try to create rows with ids identical to existing ones!
--I changed each instance in the text parameters of "Zone 1" to "Zone 2". BE CAREFUL WITH THE configuration_key PARAMETER. ONLY EDIT THE NUMBER AT THE END. Zones.php needs this to be correct!
--I changed the country parameter (Shipping Countries row) to suit, the zones I wanted for Zone 2 (Shipping Table row), and the handling fee for Zone 2 (Handling Fee row).

NOTE: For those who are not MySQL savvy, you MUST enter the Date Added and Date Modified fields, and the Date Modified field MUST be later than the Date Added field.

I then updated zones.php to include 2 zones (see the instructions in the actual zone.php file).

When I then went to the Admin Panel and went to Module/Shipping and clicked on Zone Rates, the new Zone 2 rates were there! I could now edit these settings from here. And it worked in practice when placing orders for each of these zones!

Enjoy!

--Martin


#13 Asomaro

  • Community Member
  • 3 posts
  • Real Name:simon

Posted 09 March 2012, 12:12

Is anyone able to clarify please? (See my post above!)

Any help would be much appreciated.

Cheers,

#14 Asomaro

  • Community Member
  • 3 posts
  • Real Name:simon

Posted 12 March 2012, 08:48

Nudge! Any pointers to resolving this would be much appreciated.

Cheers,