Thanks for the update that this worked for you ... :smile:
Printable View
Thanks for the update that this worked for you ... :smile:
I downloaded this mod to create zone table rates I need 5 zones.
It shows in admin I have zone table rates and its yellow. On the right column it only has shipping zone 1.
I have my zone definitions set up and it has all the states of Australia in there.
1.How can I rename that? to say NSW for example.
2.Also how can I add more shipping zones on? I thought it automatically took the zone definitions and added the shipping zones accordingly.
Uninstall it and Install it *after* you make your Zone Definitions ... then they will all have a setting on the Zones Table Rate zonetable module ...
I'm trying to use this module on ZC 1.5.5a, but it's giving me some headaches - has anyone experienced anything similar and would be able to help?
I have 5 zones configured, module is set to "Taxable Goods", which is 12% for BC, Canada. All calculations on site work fine, but when I got to PayPal, problems begin. Here are some screenshots with explanations.
My cart contents and shipping costs:
Attachment 16745
I get to PayPal and numbers are slightly different, but that's OK - I understand PayPal shows the tax line for products and adds tax to shipping cost - the end total is fine, it matches what I had in Zen Cart.
Attachment 16746
So far, everything's good. Now, I hit the "Pay Now" button and here's where the problem begins. PayPal is processing the payment, everything goes through and I'm taken back to my checkout_success page. However, I was charged a different amount - shipping tax was deducted and I didn't pay for shipping tax. Here's the order in admin:
Attachment 16747
I checked my PayPal account and I was billed the amount without shipping tax ($193.94). I placed several different orders with the same modules and settings, and each time was the same: subtotal+shipping+total_tax was sent to PayPal, but I end up paying subtotal+subtotal_tax+shipping.
I tried using flat module and that one worked fine - I paid exactly what I was seeing in Zen Cart.
Can anyone shed some light here - what am I missing?
Here's the zonetable.php module I'm using (with a few minor adjustments):
Code:<?php
/**
* @package shippingMethod
* @copyright Copyright 2003-2005 Zen Cart Development Team
* @copyright Portions Copyright 2003 osCommerce
* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
* @version $Id: zonetable.php 4184 2007-08-17 03:36:36Z surf7.net $
*/
/**
* Enter description here...
*
*/
class zonetable extends base {
/**
* Enter description here...
*
* @var unknown_type
*/
var $code;
/**
* Enter description here...
*
* @var unknown_type
*/
var $title;
/**
* Enter description here...
*
* @var unknown_type
*/
var $description;
/**
* Enter description here...
*
* @var unknown_type
*/
var $icon;
/**
* Enter description here...
*
* @var unknown_type
*/
var $enabled;
/**
* Enter description here...
*
* @return zonetable
*/
var $num_zones;
/**
* Enter description here...
*
* @return zonetable
*/
var $dest_zone;
/**
* Enter description here...
*
* @return zonetable
*/
function __construct() {
global $order, $db;
//$geozones = $db->Execute("SELECT * FROM " . TABLE_GEO_ZONES);
//$this->num_zones = $geozones->RecordCount();
$this->num_zones = 5;
$this->code = 'zonetable';
$this->title = MODULE_SHIPPING_ZONETABLE_TEXT_TITLE;
$this->description = MODULE_SHIPPING_ZONETABLE_TEXT_DESCRIPTION;
$this->sort_order = MODULE_SHIPPING_ZONETABLE_SORT_ORDER;
$this->icon = '';
$this->tax_class = MODULE_SHIPPING_ZONETABLE_TAX_CLASS;
$this->tax_basis = MODULE_SHIPPING_ZONETABLE_TAX_BASIS;
// disable only when entire cart is free shipping
if (zen_get_shipping_enabled($this->code)) {
$this->enabled = ((MODULE_SHIPPING_ZONETABLE_STATUS == 'True') ? true : false);
}
if ($this->enabled == true) {
$this->dest_zone = 0;
for ($i = 1; $i <= $this->num_zones; $i++) {
if ((int) constant('MODULE_SHIPPING_ZONETABLE_ZONE_' . $i) > 0) {
$check = $db->Execute("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . constant('MODULE_SHIPPING_ZONETABLE_ZONE_' . $i) . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' order by zone_id");
while (!$check->EOF) {
if ($check->fields['zone_id'] < 1) {
$this->dest_zone = $i;
break;
} elseif ($check->fields['zone_id'] == $order->delivery['zone_id']) {
$this->dest_zone = $i;
break;
}
$check->MoveNext();
} // end while
} // END if ((int)constant('MODULE_SHIPPING_ZONETABLE_ZONE_' . $i) > 0)
} // END for ($i=1; $i<=$this->num_zones; $i++)
if ($this->dest_zone < 1) {
$this->enabled = false;
}
} // END if ($this->enabled == true)
}
// END function zonetable()
/**
* Enter description here...
*
* @param unknown_type $method
* @return unknown
*/
function quote($method = '') {
global $order, $shipping_weight, $shipping_num_boxes, $total_count, $db;
// shipping adjustment
switch (MODULE_SHIPPING_ZONETABLE_MODE) {
case ('price'):
$order_total = $_SESSION['cart']->show_total() - $_SESSION['cart']->free_shipping_prices();
break;
case ('weight'):
$order_total = $shipping_weight;
break;
case ('item'):
$order_total = $total_count - $_SESSION['cart']->free_shipping_items();
break;
}
$table_cost = preg_split("/[:,]/", constant('MODULE_SHIPPING_ZONETABLE_COST_' . $this->dest_zone));
$size = sizeof($table_cost);
for ($i = 0, $n = $size; $i < $n; $i+=2) {
if (round($order_total, 9) <= $table_cost[$i]) {
$shipping = $table_cost[$i + 1];
break;
}
}
if (MODULE_SHIPPING_ZONETABLE_MODE == 'weight') {
$shipping = $shipping * $shipping_num_boxes;
// show boxes if weight
switch (SHIPPING_BOX_WEIGHT_DISPLAY) {
case (0):
$show_box_weight = '';
break;
case (1):
$show_box_weight = ' (' . $shipping_num_boxes . ' ' . TEXT_SHIPPING_BOXES . ')';
break;
case (2):
$show_box_weight = ' (' . number_format($shipping_weight * $shipping_num_boxes, 2) . TEXT_SHIPPING_WEIGHT . ')';
break;
default:
$show_box_weight = ' (' . $shipping_num_boxes . ' x ' . number_format($shipping_weight, 2) . TEXT_SHIPPING_WEIGHT . ')';
break;
}
}
$get_gzn = $db->Execute("select geo_zone_name from " . TABLE_GEO_ZONES . " where geo_zone_id = '" . constant('MODULE_SHIPPING_ZONETABLE_ZONE_' . $this->dest_zone) . "' LIMIT 1");
while (!$get_gzn->EOF) {
$gzn = $get_gzn->fields['geo_zone_name'];
$get_gzn->MoveNext();
}
$this->quotes = array('id' => $this->code,
'module' => MODULE_SHIPPING_ZONETABLE_TEXT_TITLE . $show_box_weight,
'methods' => array(array('id' => $this->code,
'title' => MODULE_SHIPPING_ZONETABLE_TEXT_WAY . $gzn,
'cost' => $shipping + constant('MODULE_SHIPPING_ZONETABLE_HANDLING_' . $this->dest_zone))));
if ($this->tax_class > 0) {
$this->quotes['tax'] = zen_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
}
if (zen_not_null($this->icon))
$this->quotes['icon'] = zen_image($this->icon, $this->title);
return $this->quotes;
}
/**
* Enter description here...
*
* @return unknown
*/
function check() {
global $db;
if (!isset($this->_check)) {
$check_query = $db->Execute("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_SHIPPING_ZONETABLE_STATUS'");
$this->_check = $check_query->RecordCount();
}
return $this->_check;
}
/**
* Enter description here...
*
*/
function install() {
global $db;
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Table Method', 'MODULE_SHIPPING_ZONETABLE_STATUS', 'True', 'Do you want to offer zonetable rate shipping?', '6', '0', 'zen_cfg_select_option(array(\'True\', \'False\'), ', now())");
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Table Method', 'MODULE_SHIPPING_ZONETABLE_MODE', 'weight', 'The shipping cost is based on the order total or the total weight of the items ordered or the total number of items orderd.', '6', '0', 'zen_cfg_select_option(array(\'weight\', \'price\', \'item\'), ', now())");
$db->Execute("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_ZONETABLE_TAX_CLASS', '0', 'Use the following tax class on the shipping fee.', '6', '0', 'zen_get_tax_class_title', 'zen_cfg_pull_down_tax_classes(', now())");
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Tax Basis', 'MODULE_SHIPPING_ZONETABLE_TAX_BASIS', 'Shipping', 'On what basis is Shipping Tax calculated. Options are<br />Shipping - Based on customers Shipping Address<br />Billing Based on customers Billing address<br />Store - Based on Store address if Billing/Shipping Zone equals Store zone', '6', '0', 'zen_cfg_select_option(array(\'Shipping\', \'Billing\', \'Store\'), ', now())");
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_SHIPPING_ZONETABLE_SORT_ORDER', '0', 'Sort order of display.', '6', '0', now())");
for ($i = 1; $i <= $this->num_zones; $i++) {
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Shipping Zone " . $i . "', 'MODULE_SHIPPING_ZONETABLE_ZONE_" . $i . "', '0', 'If a zone is selected, only enable this shipping method for that zone.', '6', '0', 'zen_get_zone_class_title', 'zen_cfg_pull_down_zone_classes(', now())");
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Zone " . $i . " Shipping Table', 'MODULE_SHIPPING_ZONETABLE_COST_" . $i . "', '25:8.50,50:5.50,10000:0.00', 'The shipping cost is based on the total cost or weight of items or count of the items. Example: 25:8.50,50:5.50,etc.. Up to 25 charge 8.50, from there to 50 charge 5.50, etc', '6', '0', 'zen_cfg_textarea(', now())");
$db->Execute("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_ZONETABLE_HANDLING_" . $i . "', '0', 'Handling fee for this shipping method.', '6', '0', now())");
}
}
/**
* Enter description here...
*
*/
function remove() {
global $db;
$db->Execute("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
}
/**
* Enter description here...
*
* @return unknown
*/
function keys() {
$keys = array('MODULE_SHIPPING_ZONETABLE_STATUS', 'MODULE_SHIPPING_ZONETABLE_MODE', 'MODULE_SHIPPING_ZONETABLE_TAX_CLASS', 'MODULE_SHIPPING_ZONETABLE_TAX_BASIS', 'MODULE_SHIPPING_ZONETABLE_SORT_ORDER');
for ($i = 1; $i <= $this->num_zones; $i++) {
$keys[] = 'MODULE_SHIPPING_ZONETABLE_ZONE_' . $i;
$keys[] = 'MODULE_SHIPPING_ZONETABLE_COST_' . $i;
$keys[] = 'MODULE_SHIPPING_ZONETABLE_HANDLING_' . $i;
}
return $keys;
}
}
?>
Hi. I'm currently upgrading my site from 1.5.3 to 1.5.5b.
I rely on the zones table rate shipping module, where I divide the states into eastern and western states, and have a graduated shipping cost based on the weight.
I noticed that the code for the other shipping modules has changed significantly, and I wonder if there are any recent updates to this module to keep things up to date with 1.5.5b. I didn't see any updates in the addons site since 2007, but perhaps some have been made and posted in this thread. I apologize if I didn't see it here, but there are 31 pages, and I might have missed it. I did do a search for "1.5.5" and for "zip" but didn't see anything.
I want to make sure that my site is up to date with all the latest security.
I do have another site that is running 1.5.5a, and this module is installed and seems to be working fine, but I just want to make sure I'm not introducing any security problems or other types of problems.
Thanks in advance for any help!
I am upgrading from PHP 5.x to 7.0.27
and Zen Cart 1.5.4 to 1.5.5f (attempting to follow the official upgrade procedure since I have several add-ons)
I've used this shipping rate zonetable add-on successfully since about 2010(yeah!) for two simple price zones USA-Mainland and AK-HI-Canada.
In the process of testing the upgrade caught this debug error:As best as I can tell, this add-on hasn't been modified since 2007, but has definitely worked with my previous version of PHP. I looked thru previous postings and did not see this specific error mentioned.Code:Uncaught Error: Call to undefined function split()...in ..../includes/modules/shipping/zonetable.php:124
If other relatively non-techie users have the same issue, this is what worked for me to fix it. (nope, I don't really understand what I'm doing, I just looked at post #304 above for code differences around (my) line 124.
around line 124 of /includes/modules/shipping/zonetable.php
As an aside - it appears that there hasn't been activity on this add-on for a couple years. Are users preferring a different solution now? Perhaps the "Table Rate Clone"?Code:$table_cost = split("[:,]" , constant('MODULE_SHIPPING_ZONETABLE_COST_' . $this->dest_zone));
to
$table_cost = preg_split("/[:,]/" , constant('MODULE_SHIPPING_ZONETABLE_COST_' . $this->dest_zone));
What settings are you using?
Hi Ajeh
I'm so new at this forum, I don't know how to tell if your question is to me or not. If not, sorry for responding.
I'm using the same zonetable settings that had worked without throwing an error previously, so assumed the error had to do with the PHP change from 5.x to 7.
If you are asking about PHP setting ... Yikes! i wouldn't even know where to look!
If you are asking about the zonetable settings:
This is the only shipping module I have activated (all others "red" with no sortorder), and the zonetable sort order is 3.
Table Method
price
Tax Class
--none--
Tax Basis
Shipping
Sort Order
3
Shipping Zone 1
USA-Mainland
Zone 1 Shipping Table
20:7.00,30:8.00,40:9.00,50:10.00,60:11.00,150:12.00,200:13.00,300:14.00,400:15.0 0,500:18.00,600:19.50,800:22.50,900:25.00,10000:100.00
Zone 1 Handling Fee
0
Shipping Zone 2
Canada-HI-AK
Zone 2 Shipping Table
20:10.50,30:12.00,40:13.50,50:15.00,60:16.50,150:18.00,200:19.50,300:21.00,400:2 2.50,500:46.00,10000:150.00
Zone 2 Handling Fee
0
Check and see if removing the blank spaces works ...
Hmmm
The blanks in my post must have been created with my lazy copy-paste from the display window for that module. When I click on the configuration as if I were to edit it, those blanks aren't there in the actual data. Good idea tho' -- I've noticed in your posts what a great eye you have for details, and definitely appreciate your input.
I looked up the "split: vs "preg_split" this afternoon in the PHP manual, and it says that split has been deprecated/removed in V7. That's about all I understood about that article tho'. So, maybe that's why the "preg_split: version seems to be working in my environment and "split" didn't.
Thanks!