i guess i have to try to reinstall the whole zencart and see if it works... it is a lot of work to add inn all the data again... but a man got to do what a man got to do... :lamo:
Printable View
i guess i have to try to reinstall the whole zencart and see if it works... it is a lot of work to add inn all the data again... but a man got to do what a man got to do... :lamo:
The each() error reported in query_factory is only a symptom of something being requested incorrectly somewhere else in the code. And, without writing a ton of debug code to find out what query is bringing back bad data etc, it's incredibly difficult to track down those particular problems. As such there's no "quick" solution ... hence the lack of responses to your posts.
I'm not so sure you need to re-install the whole cart. You probably have just put a new file in the wrong place or have some unexpected blanks in your settings for the module.
I haven't used the module myself, so cannot comment on it much ... but I've observed that many use it without problems.
Rather than re-installing and losing customization work and data, perhaps installing a fresh copy of Zen Cart in another folder would suffice? then re-apply the mod to that install. make sure it works. Then start comparing differences between working and busted sites ...and resolve issues that way.
I have installed other modules.
Zone Rates
Group Pricing Per Item
swedish language
mabe it is a conflikt with some of the modules... ill try and remove them if i figre out how... :cool:
I dont know what happened. But it seems like it is working perfectly now...
There is a God :cool:
Same problem here...
i made 46 Geo zones and 1 table for each geo zone.
I have 49 Geo Zone and 1 table or each zone.
When i order something from an adress in Geo Zone 1, 2 and 3 everything works fine, but when i order something from an adress from 4 and up it wont work.
This is the error i get when i order from an adress in Geo Zone 5:
I did change the number of Geo Zone before i installed the module in admin module shipping.Code:Warning: constant() [function.constant[/URL]]: Couldn't find constant MODULE_SHIPPING_MZMT_GEOZONE_5_TEXT_TITLE in /home/purityfa/public_html/ehandel/includes/modules/shipping/mzmt.php on line 67
Warning: constant() [function.constant]: Couldn't find constant MODULE_SHIPPING_MZMT_GEOZONE_5_TABLE_1_TEXT_WAY in /home/purityfa/public_html/ehandel/includes/modules/shipping/mzmt.php on line 125
Warning: constant() [function.constant]: Couldn't find constant MODULE_SHIPPING_MZMT_GEOZONE_5_ICON in /home/purityfa/public_html/ehandel/includes/modules/shipping/mzmt.php on line 134
This is the table i use in Geo Zone 5:
I have not set a table for all 49 Geo Zone's yet, but i dont belive that will give this error.Code:1:77,4:80,6:97,11:106,16:130,40:137,60:152,80:169,100:182,150:247,200:296,250:343,300:393,350:438,400:484,450:529,500:570,550:614,600:660,650:705,700:745,750:792,800:836,850:879,900:922,950:961,1000:1006
I tryed to reduce the Geo Zones to 10. Reinstalled the module and entered the table to all zones. No luck. Still gives the same error.
Is this a bug or shall i keep tring to get this to work?
Wuld love a hint on what to do to fix this... :cool:
This is how my mzmt.php file is:
I have now set Geo zone to 50 with one table each...Code:<?php
//
// +----------------------------------------------------------------------+
// |zen-cart Open Source E-commerce |
// +----------------------------------------------------------------------+
// | Copyright (c) 2004 Josh Dechant |
// | |
// | Portions Copyright (c) 2004 The zen-cart developers |
// | |
// | http://www.zen-cart.com/index.php |
// | |
// | Portions Copyright (c) 2003 osCommerce |
// +----------------------------------------------------------------------+
// | This source file is subject to version 2.0 of the GPL license, |
// | that is bundled with this package in the file LICENSE, and is |
// | available through the world-wide-web at the following url: |
// | http://www.zen-cart.com/license/2_0.txt. |
// | If you did not receive a copy of the zen-cart license and are unable |
// | to obtain it through the world-wide-web, please send a note to |
// | [email protected] so we can mail you a copy immediately. |
// +----------------------------------------------------------------------+
// $Id: mzmt.php,v 1.101 2004-10-31 Josh Dechant Exp $
//
class mzmt {
var $code, $title, $description, $icon, $enabled, $num_zones, $num_tables, $delivery_geozone, $order_total;
function mzmt() {
global $order;
$this->code = 'mzmt';
$this->title = MODULE_SHIPPING_MZMT_TEXT_TITLE;
$this->description = MODULE_SHIPPING_MZMT_TEXT_DESCRIPTION;
$this->sort_order = MODULE_SHIPPING_MZMT_SORT_ORDER;
$this->tax_class = MODULE_SHIPPING_MZMT_TAX_CLASS;
$this->tax_basis = MODULE_SHIPPING_MZMT_TAX_BASIS;
$this->num_geozones = MODULE_SHIPPING_MZMT_NUMBER_GEOZONES;
$this->num_tables = MODULE_SHIPPING_MZMT_NUMBER_TABLES;
// disable only when entire cart is free shipping
if (zen_get_shipping_enabled($this->code)) {
$this->enabled = ((MODULE_SHIPPING_MZMT_STATUS == 'True') ? true : false);
}
if ($this->enabled == true) {
$this->enabled = false;
for ($n=1; $n<=$this->num_geozones; $n++) {
if ( ((int)constant('MODULE_SHIPPING_MZMT_GEOZONE_' . $n . '_ID') > 0) && ((int)constant('MODULE_SHIPPING_MZMT_GEOZONE_' . $n . '_ID') == $this->getGeoZoneID($order->delivery['country']['id'], $order->delivery['zone_id'])) ) {
$this->enabled = true;
$this->delivery_geozone = $n;
break;
} elseif ( ((int)constant('MODULE_SHIPPING_MZMT_GEOZONE_' . $n . '_ID') == 0) && ($n == (int)$this->num_geozones) ) {
$this->enabled = true;
$this->delivery_geozone = $n;
break;
}
}
}
}
// class methods
function quote($method = '') {
global $order, $shipping_weight, $shipping_num_boxes, $template;
$this->quotes = array('id' => $this->code,
'module' => constant('MODULE_SHIPPING_MZMT_GEOZONE_' . $this->delivery_geozone . '_TEXT_TITLE'),
'methods' => array());
$geozone_mode = $this->determineTableMethod(constant('MODULE_SHIPPING_MZMT_GEOZONE_' . $this->delivery_geozone . '_MODE'));
if ($method) {
$j = substr($method, 5);
$shipping = $this->determineShipping(split("[:,]" , constant('MODULE_SHIPPING_MZMT_GEOZONE_' . $this->delivery_geozone . '_TABLE_' . $j)));
if ($geozone_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,2) . TEXT_SHIPPING_WEIGHT . ')';
break;
default:
$show_box_weight = ' (' . $shipping_num_boxes . ' x ' . number_format($shipping_weight,2) . TEXT_SHIPPING_WEIGHT . ')';
break;
}
}
$this->quotes['methods'][] = array('id' => 'table' . $j,
'title' => constant('MODULE_SHIPPING_MZMT_GEOZONE_' . $this->delivery_geozone . '_TABLE_' . $j . '_TEXT_WAY') . $show_box_weight,
'cost' => $shipping + constant('MODULE_SHIPPING_MZMT_GEOZONE_' . $this->delivery_geozone . '_HANDLING'));
} else {
for ($j=1; $j<=$this->num_tables; $j++) {
if (!zen_not_null(constant('MODULE_SHIPPING_MZMT_GEOZONE_' . $this->delivery_geozone . '_TABLE_' . $j))) continue;
$shipping = $this->determineShipping(split("[:,]" , constant('MODULE_SHIPPING_MZMT_GEOZONE_' . $this->delivery_geozone . '_TABLE_' . $j)));
if ($geozone_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,2) . TEXT_SHIPPING_WEIGHT . ')';
break;
default:
$show_box_weight = ' (' . $shipping_num_boxes . ' x ' . number_format($shipping_weight,2) . TEXT_SHIPPING_WEIGHT . ')';
break;
}
}
$this->quotes['methods'][] = array('id' => 'table' . $j,
'title' => constant('MODULE_SHIPPING_MZMT_GEOZONE_' . $this->delivery_geozone . '_TABLE_' . $j . '_TEXT_WAY') . $show_box_weight,
'cost' => $shipping + constant('MODULE_SHIPPING_MZMT_GEOZONE_' . $this->delivery_geozone . '_HANDLING'));
}
}
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(constant('MODULE_SHIPPING_MZMT_GEOZONE_' . $this->delivery_geozone . '_ICON'))) $this->quotes['icon'] = zen_image($template->get_template_dir(constant('MODULE_SHIPPING_MZMT_GEOZONE_' . $this->delivery_geozone . '_ICON'), DIR_WS_TEMPLATE, $current_page_base,'images/icons'). '/' . constant('MODULE_SHIPPING_MZMT_GEOZONE_' . $this->delivery_geozone . '_ICON'), $this->title);
return $this->quotes;
}
function check() {
global $db;
if (!isset($this->_check)) {
$check_query = $db->Execute("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_SHIPPING_MZMT_STATUS'");
$this->_check = $check_query->RecordCount();
}
return $this->_check;
}
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 MultiRegion MultiTable Method', 'MODULE_SHIPPING_MZMT_STATUS', 'True', 'Do you want to offer multi-region multi-table 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, use_function, set_function, date_added) values ('Tax Class', 'MODULE_SHIPPING_MZMT_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_MZMT_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_MZMT_SORT_ORDER', '0', 'Sort order of display.', '6', '0', now())");
for ($n=1; $n<=$this->num_geozones; $n++) {
$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 ('<hr />Geo Zone $n', 'MODULE_SHIPPING_MZMT_GEOZONE_{$n}_ID', '', 'Enable this for the following geo zone.', '6', '0', 'zen_get_zone_class_title', '_cfg_pull_down_geozones(', 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 ('Geo Zone $n Table Method', 'MODULE_SHIPPING_MZMT_GEOZONE_{$n}_MODE', 'weight', 'The shipping cost is based on the total weight, total price, or total count of the items ordered.', '6', '0', 'zen_cfg_select_option(array(\'weight\', \'price\', \'count\'), ', now())");
for ($j=1; $j<=$this->num_tables; $j++) {
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Geo Zone $n Shipping Table $j', 'MODULE_SHIPPING_MZMT_GEOZONE_{$n}_TABLE_{$j}', '', 'Shipping table $j for this geo zone', '6', '0', now())");
}
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Geo Zone $n Handling Fee', 'MODULE_SHIPPING_MZMT_GEOZONE_{$n}_HANDLING', '0', 'Handling Fee for this shipping geo zone', '6', '0', now())");
}
}
function remove() {
global $db;
$db->Execute("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
}
function keys() {
$keys = array('MODULE_SHIPPING_MZMT_STATUS', 'MODULE_SHIPPING_MZMT_TAX_CLASS', 'MODULE_SHIPPING_MZMT_TAX_BASIS', 'MODULE_SHIPPING_MZMT_SORT_ORDER');
for ($n=1; $n<=$this->num_geozones; $n++) {
$keys[] = 'MODULE_SHIPPING_MZMT_GEOZONE_' . $n . '_ID';
$keys[] = 'MODULE_SHIPPING_MZMT_GEOZONE_' . $n . '_MODE';
$keys[] = 'MODULE_SHIPPING_MZMT_GEOZONE_' . $n . '_HANDLING';
for ($j=1; $j<=$this->num_tables; $j++) {
$keys[] = 'MODULE_SHIPPING_MZMT_GEOZONE_' . $n . '_TABLE_' . $j;
}
}
return $keys;
}
function determineTableMethod($geozone_mode) {
global $total_count, $shipping_weight;
switch ($geozone_mode) {
case 'price':
if (method_exists($_SESSION['cart'], 'free_shipping_prices')) {
$this->order_total = $_SESSION['cart']->show_total() - $_SESSION['cart']->free_shipping_prices();
} else {
$this->order_total = $_SESSION['cart']->show_total();
}
break;
case 'count':
if (method_exists($_SESSION['cart'], 'free_shipping_items')) {
$this->order_total = $total_count - $_SESSION['cart']->free_shipping_items();
} else {
$this->order_total = $total_count;
}
break;
case 'weight':
$this->order_total = $shipping_weight;
break;
}
return $geozone_mode;
}
function determineShipping($table_cost) {
for ($i=0, $n=sizeof($table_cost); $i<$n; $i+=2) {
if ($this->order_total >= $table_cost[$i]) {
$shipping_factor = $table_cost[$i+1];
}
}
if (substr_count($shipping_factor, '%') > 0) {
$shipping = ((($this->order_total*10)/10)*((str_replace('%', '', $shipping_factor))/100));
} else {
$shipping = str_replace('$', '', $shipping_factor);
}
return $shipping;
}
function getGeoZoneID($country_id, $zone_id) {
global $db;
// First, check for a Geo Zone that explicity includes the country & specific zone (useful for splitting countries with zones up)
$zone = $db->Execute("select gz.geo_zone_id from " . TABLE_GEO_ZONES . " gz left join " . TABLE_ZONES_TO_GEO_ZONES . " ztgz on (gz.geo_zone_id = ztgz.geo_zone_id) where ztgz.zone_country_id = '" . (int)$country_id . "' and ztgz.zone_id = '" . (int)$zone_id . "' and LOWER(gz.geo_zone_name) like 'shp%'");
if ($zone->RecordCount() > 0) {
return $zone->fields['geo_zone_id'];
} else {
// No luck⦠Now check for a Geo Zone for the country and "All Zones" of the country.
$zone = $db->Execute("select gz.geo_zone_id from " . TABLE_GEO_ZONES . " gz left join " . TABLE_ZONES_TO_GEO_ZONES . " ztgz on (gz.geo_zone_id = ztgz.geo_zone_id) where ztgz.zone_country_id = '" . (int)$country_id . "' and (ztgz.zone_id = '0' or ztgz.zone_id is NULL) and LOWER(gz.geo_zone_name) like 'shp%'");
if ($zone->RecordCount() > 0) {
return $zone->fields['geo_zone_id'];
} else {
return false;
}
}
}
}
function _cfg_pull_down_geozones($zone_class_id, $key = '') {
global $db;
$name = (($key) ? 'configuration[' . $key . ']' : 'configuration_value');
$zone_class_array = array(array('id' => '0', 'text' => 'Rest of the World'));
$zone_class = $db->Execute("select geo_zone_id, geo_zone_name from " . TABLE_GEO_ZONES . " where LOWER(geo_zone_name) like 'shp%' order by geo_zone_name");
while (!$zone_class->EOF) {
$zone_class_array[] = array('id' => $zone_class->fields['geo_zone_id'],
'text' => $zone_class->fields['geo_zone_name']);
$zone_class->MoveNext();
}
return zen_draw_pull_down_menu($name, $zone_class_array, $zone_class_id);
}
?>
I dont understand much php, but it seems that when i sett the Geo zone to a number that is Higher than 3, it still acts like it is only 3 Geo Zones.
When i order something from Geozone 4 and up i get the same error. The errormessage change the number ekual to the zone.
this is from Geozone4:
Code:Warning: constant() [function.constant]: Couldn't find constant MODULE_SHIPPING_MZMT_GEOZONE_4_TEXT_TITLE in /home/purityfa/public_html/ehandel/includes/modules/shipping/mzmt.php on line 67
Warning: constant() [function.constant]: Couldn't find constant MODULE_SHIPPING_MZMT_GEOZONE_4_TABLE_1_TEXT_WAY in /home/purityfa/public_html/ehandel/includes/modules/shipping/mzmt.php on line 125
Warning: constant() [function.constant]: Couldn't find constant MODULE_SHIPPING_MZMT_GEOZONE_4_ICON in /home/purityfa/public_html/ehandel/includes/modules/shipping/mzmt.php on line 134
i figured it out...
I dont know if it is a bug or that the module is not that userfriendly, but when the users change the Geo Zone number, it is not changing the mzmt.php language file. This must be done manualy.
this is the default variables:
Here is only the 3 default Geozones defined. I figured out that i must add the codes to each Geozone manualy...Code:define('MODULE_SHIPPING_MZMT_GEOZONE_1_TEXT_TITLE', 'United Parcel Service (UPS)');
define('MODULE_SHIPPING_MZMT_GEOZONE_1_ICON', 'shipping_ups.gif');
define('MODULE_SHIPPING_MZMT_GEOZONE_1_TABLE_1_TEXT_WAY', 'Ground');
define('MODULE_SHIPPING_MZMT_GEOZONE_1_TABLE_2_TEXT_WAY', 'Second Day');
define('MODULE_SHIPPING_MZMT_GEOZONE_1_TABLE_3_TEXT_WAY', 'Next Day');
define('MODULE_SHIPPING_MZMT_GEOZONE_2_TEXT_TITLE', '');
define('MODULE_SHIPPING_MZMT_GEOZONE_2_ICON', '');
define('MODULE_SHIPPING_MZMT_GEOZONE_2_TABLE_1_TEXT_WAY', '');
define('MODULE_SHIPPING_MZMT_GEOZONE_2_TABLE_2_TEXT_WAY', '');
define('MODULE_SHIPPING_MZMT_GEOZONE_2_TABLE_3_TEXT_WAY', '');
define('MODULE_SHIPPING_MZMT_GEOZONE_3_TEXT_TITLE', '');
define('MODULE_SHIPPING_MZMT_GEOZONE_3_ICON', '');
define('MODULE_SHIPPING_MZMT_GEOZONE_3_TABLE_1_TEXT_WAY', '');
define('MODULE_SHIPPING_MZMT_GEOZONE_3_TABLE_2_TEXT_WAY', '');
define('MODULE_SHIPPING_MZMT_GEOZONE_3_TABLE_3_TEXT_WAY', '');
I must say that i am a bit proud over myself that i actually found this out of my own... :smartass:
There is no instructions in the readme file or anywhere else in the forums about this that i have found... but wait... now it is... :cool:
okey... now i got this new error suddenly:
Starting to get frustrated.... :cool:Code:Warning: Variable passed to each() is not an array or object in /home/purityfa/public_html/ehandel/includes/classes/db/mysql/query_factory.php on line 114
Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/purityfa/public_html/ehandel/includes/classes/db/mysql/query_factory.php:114) in /home/purityfa/public_html/ehandel/includes/functions/sessions.php on line 108
Warning: Cannot modify header information - headers already sent by (output started at /home/purityfa/public_html/ehandel/includes/classes/db/mysql/query_factory.php:114) in /home/purityfa/public_html/ehandel/includes/init_includes/init_templates.php on line 78