Wombie Posted May 1, 2015 Share Posted May 1, 2015 ok I now have a new problem.. I have 4 geo zones, the first one (UK) is working absolutely fine however the second one (Europe) is playing up. I set it up as this:0:8.50,10.01:9.05,25.01:10.55,50.01:11.55,75.01:13.00,100.01:14.30,125.01:15.80,150.01:16.45,175.01:17.65,200.01:26.15,210.01,26.70,225.01:28.20,250.01:29.20,275.01:30.65,300.01:31.95,325.01:33.45,350.01:34.10,375.01:35.30,400.01:43.80,410.01:44.35,425.01:45.85,450.01:46.85,475.01:48.30,500.01:56.80,510.01:57.35,525.01:58.85,550,01:59.85,575.01:61.30,600.01:62.60,625.01:64.10,650.01:64.75,675.01:65.95,700.01:70.60,800.01:78.95,900.01:88.25It works perfectly up until 75.00 and then it suddently starts charging £800. When you then go into the next weight bracket (100.01) it then says that there is no shipping available at all.Any ideas what I've done now? :P Quote Link to comment Share on other sites More sharing options...
burt Posted May 1, 2015 Share Posted May 1, 2015 You need to be more careful, there are multiple mistakes in that list of ratios. Check out 210 and 550 for example. Quote Link to comment Share on other sites More sharing options...
Wombie Posted May 1, 2015 Share Posted May 1, 2015 Ah yes. No errors with the weights it is playing up with though but I guess that could mess it up anyway, I'll recheck everything and try again. Thank you. Quote Link to comment Share on other sites More sharing options...
Wombie Posted May 1, 2015 Share Posted May 1, 2015 Yep that was it, just me being stupid again. All zones working perfectly now, Thank you. Quote Link to comment Share on other sites More sharing options...
GlenPig Posted November 24, 2016 Share Posted November 24, 2016 (edited) Hi Have installed module and all working perfectly. Does anyone know if you can put in maximum weight values instead of just a minimum? If the weight is over 30kg I don't want some delivery options to be available. Many thanks Glen Edited November 24, 2016 by GlenPig Quote Link to comment Share on other sites More sharing options...
GlenPig Posted November 24, 2016 Share Posted November 24, 2016 (edited) . Edited November 24, 2016 by GlenPig Quote Link to comment Share on other sites More sharing options...
♥kymation Posted November 24, 2016 Share Posted November 24, 2016 It's possible to change the calculation method to use maximum values instead of minimum. Try changing this code in includes/modules/shipping.mzmt.php for($i = 0, $n = sizeof ( $table_cost ); $i < $n; $i += 2) { if ($this->order_total >= $table_cost [$i]) { $shipping_factor = $table_cost [$i + 1]; } } to this $shipping_factor = NULL; for($i = $n = sizeof ( $table_cost ); $i > 0; $i -= 2) { if ($this->order_total <= $table_cost [$i]) { $shipping_factor = $table_cost [$i + 1]; break; } } if( $shipping_factor === NULL ) $this->enabled = false; Now build your shipping table using maximum values, with the largest being the maximum you want to ship. I haven't tested this, so it may not work. Try it and let me know. Regards Jim Quote See my profile for a list of my addons and ways to get support. Link to comment Share on other sites More sharing options...
♥kymation Posted November 24, 2016 Share Posted November 24, 2016 (edited) Stupid browser crash. Sorry. Edited November 24, 2016 by kymation Quote See my profile for a list of my addons and ways to get support. Link to comment Share on other sites More sharing options...
GlenPig Posted November 24, 2016 Share Posted November 24, 2016 (edited) It's possible to change the calculation method to use maximum values instead of minimum. Try changing this code in includes/modules/shipping.mzmt.php for($i = 0, $n = sizeof ( $table_cost ); $i < $n; $i += 2) { if ($this->order_total >= $table_cost [$i]) { $shipping_factor = $table_cost [$i + 1]; } } to this $shipping_factor = NULL; for($i = $n = sizeof ( $table_cost ); $i > 0; $i -= 2) { if ($this->order_total <= $table_cost [$i]) { $shipping_factor = $table_cost [$i + 1]; break; } } if( $shipping_factor === NULL ) $this->enabled = false; Now build your shipping table using maximum values, with the largest being the maximum you want to ship. I haven't tested this, so it may not work. Try it and let me know. Regards Jim Hi @@kymation Many thanks for your quick reply. Unfortunately, it doesn't quite work. What I'm trying to achieve is that if the weight is over 30kg the only delivery option available is pellet delivery, otherwise, if it's under 30kg then they can have the delivery options of standard, next day, before 9am and before 12noon. Is MZMT the right module? As it stands, your code above is showing the delivery price for the 30kg+ when the product in the checkout is under 30kg. The values in MZMT looks like 29.99:4.125,9999999:50.00 Many thanks Edited November 24, 2016 by GlenPig Quote Link to comment Share on other sites More sharing options...
♥kymation Posted November 24, 2016 Share Posted November 24, 2016 Your table is wrong. It needs to be 29.99:4.125 Then the shipping cost will be 4.125 for anything under 30.00 and no shipping will be available over that. If it still doesn't work with that table, tell me what it's doing and I'll take another look. Regards Jim Quote See my profile for a list of my addons and ways to get support. Link to comment Share on other sites More sharing options...
GlenPig Posted November 28, 2016 Share Posted November 28, 2016 Hi @kymation Many thanks once again for your help. Unfortunately when I make those changes, all delivery options are coming up as £0.00. As you will see in the attached screenshots, the order is under 30kg so I would have thought all the various delivery options should have a value. Also, if they are £0.00 shouldn't they not be visible too? Many thanks Glen Quote Link to comment Share on other sites More sharing options...
♥kymation Posted November 28, 2016 Share Posted November 28, 2016 Sorry, there must be a bug in that code. I'll see if I can find some time to debug it. Don't hold your breath. Regards Jim Quote See my profile for a list of my addons and ways to get support. Link to comment Share on other sites More sharing options...
ecommunlimited Posted November 28, 2016 Share Posted November 28, 2016 @@GlenPig For your statement "Also, if they are £0.00 shouldn't they not be visible too?" the fix is below. I had the same problem and Rainer fixed it for me for a small fee. Below the codeare examples of tables that work. They are pound:cost not kgs. Hopefully this helps. <?php/* $Id: mzmt.php, v2.1a 20140125 Kymation Exp $ $Portions From: mzmt.php,v 1.000 2004-10-29 Josh Dechant Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2014 osCommerce Protions Copyright (c) 2004 Josh Dechant Released under the GNU General Public License*/ class mzmt { var $version = '2.1a'; var $code = ''; var $title = ''; var $description = ''; var $icon = ''; var $enabled = false; var $num_tables = 0; var $num_geozones = 0; var $delivery_geozone = 0; var $geozone_mode = 'weight'; var $order_total = 0; var $languages_array = array(); var $quotes = array(); //// // Set up all of the default values available at this time function mzmt() { global $order; $this->code = 'mzmt'; $this->sort_order = @MODULE_SHIPPING_MZMT_SORT_ORDER; $this->tax_class = @MODULE_SHIPPING_MZMT_TAX_CLASS; $this->enabled = ( ( @MODULE_SHIPPING_MZMT_STATUS == 'True' ) ? true : false ); // When the language file has been included if( defined( 'MODULE_SHIPPING_MZMT_TEXT_TITLE' ) ) { $this->title = MODULE_SHIPPING_MZMT_TEXT_TITLE; $this->description = MODULE_SHIPPING_MZMT_TEXT_DESCRIPTION; } // Second pass and later, when the number of geo zones and tables have been set if( defined( 'MODULE_SHIPPING_MZMT_NUMBER_GEOZONES' ) ) { $this->num_geozones = MODULE_SHIPPING_MZMT_NUMBER_GEOZONES; $this->num_tables = MODULE_SHIPPING_MZMT_NUMBER_TABLES; 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; } } } } // Set the languages_array to the current store languages $this->get_languages(); } //// // Get a quote or all quotes for a geo zone function quote( $method = '' ) { global $order, $shipping_weight, $shipping_num_boxes, $language; // determine the mode first, so that $weight_string can be prevented from displaying if the mode isn't "weight" $this->determineTableMethod ( constant ( 'MODULE_SHIPPING_MZMT_GEOZONE_' . $this->delivery_geozone . '_MODE' ) ); $combined_quote_weight = $shipping_num_boxes * $shipping_weight; $weight_string = ''; // weight is not displayed if the weight unit entry is left blank or the mode is not weight if( tep_not_null( MODULE_SHIPPING_MZMT_WEIGHT_UNITS ) && $this->geozone_mode == 'weight' ) { $weight_string = ' : ' . $combined_quote_weight . ' ' . MODULE_SHIPPING_MZMT_WEIGHT_UNITS; } $this->quotes = array ( 'id' => $this->code, 'module' => constant ( 'MODULE_SHIPPING_MZMT_GEOZONE_' . $this->delivery_geozone . '_TEXT_TITLE_' . strtoupper( $language ) ), 'methods' => array () ); if ( $method != '' ) { // Single quote $table_number = substr ( $method, 5 ); $shipping = $this->determineShipping ( preg_split ( "/[:,]/", constant ( 'MODULE_SHIPPING_MZMT_GEOZONE_' . $this->delivery_geozone . '_TABLE_' . $table_number ) ) ); if ( $shipping > 0 ) { // hide shipping if quote is zero BEGIN $this->quotes ['methods'] [] = array ( 'id' => 'table' . $table_number, 'title' => constant ( 'MODULE_SHIPPING_MZMT_GEOZONE_' . $this->delivery_geozone . '_TABLE_' . $table_number . '_TEXT_WAY_' . strtoupper( $language ) ) . $weight_string, 'cost' => $shipping + constant ( 'MODULE_SHIPPING_MZMT_GEOZONE_' . $this->delivery_geozone . '_HANDLING' ) ); } // hide shipping if quote is zero END } else { // All applicable quotes for( $table_number = 1; $table_number <= $this->num_tables; $table_number ++ ) { if (! tep_not_null ( constant ( 'MODULE_SHIPPING_MZMT_GEOZONE_' . $this->delivery_geozone . '_TABLE_' . $table_number ) )) continue; $shipping = $this->determineShipping ( preg_split ( "/[:,]/", constant ( 'MODULE_SHIPPING_MZMT_GEOZONE_' . $this->delivery_geozone . '_TABLE_' . $table_number ) ) ); if ( $shipping > 0 ) { // hide shipping if quote is zero BEGIN $this->quotes ['methods'] [] = array ( 'id' => 'table' . $table_number, 'title' => constant ( 'MODULE_SHIPPING_MZMT_GEOZONE_' . $this->delivery_geozone . '_TABLE_' . $table_number . '_TEXT_WAY_' . strtoupper( $language ) ) . $weight_string, 'cost' => $shipping + constant ( 'MODULE_SHIPPING_MZMT_GEOZONE_' . $this->delivery_geozone . '_HANDLING' ) ); } // hide shipping if quote is zero END } } // If shipping is set as taxable, add the appropriate tax if ($this->tax_class > 0) { $this->quotes ['tax'] = tep_get_tax_rate ( $this->tax_class, $order->delivery ['country'] ['id'], $order->delivery ['zone_id'] ); } // Add the icon if there is one if (tep_not_null ( constant ( 'MODULE_SHIPPING_MZMT_GEOZONE_' . $this->delivery_geozone . '_ICON' ) )) $this->quotes ['icon'] = tep_image ( DIR_WS_ICONS . constant ( 'MODULE_SHIPPING_MZMT_GEOZONE_' . $this->delivery_geozone . '_ICON' ), $this->title ); return $this->quotes; } // function quote //// // Return the module status function check() { if (! isset ( $this->_check ) ) { $check_query = tep_db_query ( "select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_SHIPPING_MZMT_STATUS'" ); $this->_check = tep_db_num_rows ( $check_query ); } return $this->_check; } //// // Second pass of the initial edit, or the Update box has been checked. // This method is executed by modified code in admin/modules.php // It adds the Configuration table entries for the number of // Zones and Tables set in the first pass, and modifies // existing entries to allow for later updates. function update( $vars_array ) { // Check that we are actually in the second stage install process or later if( ( is_array( $vars_array ) && array_key_exists( 'MODULE_SHIPPING_MZMT_NUMBER_GEOZONES', $vars_array ) && $vars_array['MODULE_SHIPPING_MZMT_NUMBER_GEOZONES'] > 0 && ( array_key_exists( 'MODULE_SHIPPING_MZMT_NUMBER_TABLES', $vars_array ) && $vars_array['MODULE_SHIPPING_MZMT_NUMBER_TABLES'] > 0 ) ) ) { $this->num_geozones = $vars_array['MODULE_SHIPPING_MZMT_NUMBER_GEOZONES']; $this->num_tables = $vars_array['MODULE_SHIPPING_MZMT_NUMBER_TABLES']; // Add, remove, or modify the database entries for the selected number of Zones/Tables $this->zones_tables( $vars_array ); // This part is only done on the second pass of the initial install if( $vars_array['MODULE_SHIPPING_MZMT_UPDATE_ZONES_TABLES'] != 'True' ) { // Modify these two entries to add an update warning message // Update must be run if the first two are changed as they make changes to the number of geo zones/tables $sql_data_array[] = array( 'configuration_key' => 'MODULE_SHIPPING_MZMT_NUMBER_GEOZONES', 'configuration_array' => array( 'configuration_description' => 'The number of shipping geo zones you want to use. ' . MODULE_SHIPPING_MZMT_UPDATE_WARNING ) ); $sql_data_array[] = array( 'configuration_key' => 'MODULE_SHIPPING_MZMT_NUMBER_TABLES', 'configuration_array' => array( 'configuration_description' => 'The number of shipping tables per geo zone. ' . MODULE_SHIPPING_MZMT_UPDATE_WARNING ) ); // Remove the second install message and replace it with the update checkbox $sql_data_array[] = array( 'configuration_key' => 'MODULE_SHIPPING_MZMT_UPDATE_ZONES_TABLES', 'configuration_array' => array( 'configuration_title' => 'Update', 'configuration_description' => 'Check if you want to change the number of geo zones or tables. <span style="color:red;"><b>WARNING:</b> This will remove all of the settings below.</span>', 'configuration_value' => '', 'set_function' => 'tep_cfg_mzmt_update( ', 'use_function' => '' ) ); // Use the above arrays to update the configuration table with the tables etc. foreach( $sql_data_array as $configuration_data ) { tep_db_perform( TABLE_CONFIGURATION, $configuration_data['configuration_array'], 'update', "configuration_key = '" . $configuration_data['configuration_key'] . "'"); } } // if( $vars_array } // if( array_key_exists } // function update //// // Update existing, add new, and/or remove unwanted zones/tables function zones_tables( $vars_array ) { // Check whether an update has been requested // This is always the case for the first pass if( ! array_key_exists( 'MODULE_SHIPPING_MZMT_UPDATE_ZONES_TABLES', $vars_array ) || ( array_key_exists( 'MODULE_SHIPPING_MZMT_UPDATE_ZONES_TABLES', $vars_array ) && $vars_array ['MODULE_SHIPPING_MZMT_UPDATE_ZONES_TABLES'] == 'True' ) ) { // loop an arbitrary number of times, breaking out when we are done for( $zone = 1; $zone < 999; $zone ++ ) { switch (true) { case (! array_key_exists ( 'MODULE_SHIPPING_MZMT_GEOZONE_' . $zone . '_ID', $vars_array ) && $zone <= $this->num_geozones) : // If the Zone does not exist, and we have less than the selected number of zones, we add the Zone 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 ('<hr />Geo Zone " . $zone . "', 'MODULE_SHIPPING_MZMT_GEOZONE_" . $zone . "_ID', '', 'Enable this method for the following geo zone.', '6', '0', 'tep_get_zone_class_title', 'tep_cfg_pull_down_geozones(', now())" ); 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 ('Geo Zone " . $zone . " Table Mode', 'MODULE_SHIPPING_MZMT_GEOZONE_" . $zone . "_MODE', 'weight', 'The shipping cost is based on the total weight, total price, or total count of the items ordered.', '6', '0', 'tep_cfg_select_option(array(\'weight\', \'price\', \'count\'), ', now())" ); tep_db_query ( "insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Geo Zone " . $zone . " Table Icon', 'MODULE_SHIPPING_MZMT_GEOZONE_" . $zone . "_ICON', '', 'The icon of the shipping method. Leave blank if none.', '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 ('Geo Zone " . $zone . " Handling Fee', 'MODULE_SHIPPING_MZMT_GEOZONE_" . $zone . "_HANDLING', '0', 'Handling Fee for this geo zone.', '6', '0', now())" ); foreach ( $this->languages_array as $language ) { $lang = '_' . strtoupper ( $language ); $language_name = ucfirst ( $language ); tep_db_query ( "insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Geo Zone " . $zone . " Table Title in " . $language_name . "', 'MODULE_SHIPPING_MZMT_GEOZONE_" . $zone . "_TEXT_TITLE" . $lang . "', '', 'The title of the shipping method in " . $language_name . ".', '6', '0', now())" ); } // Update the tables for this zone $this->update_tables ( $vars_array, $zone ); break; case (array_key_exists ( 'MODULE_SHIPPING_MZMT_GEOZONE_' . $zone . '_ID', $vars_array ) && $zone <= $this->num_geozones) : // The Zone data exists, and we are still within the selected number of zones, // so we just need to fix the Tables (if required) $this->update_tables ( $vars_array, $zone ); break; case (array_key_exists ( 'MODULE_SHIPPING_MZMT_GEOZONE_' . $zone . '_ID', $vars_array ) && $zone > $this->num_geozones) : // The zone data exists and we no longer want it, so remove the entries tep_db_query ( "delete from " . TABLE_CONFIGURATION . " where configuration_key like 'MODULE_SHIPPING_MZMT_GEOZONE_" . $zone . "%'" ); $this->update_tables ( $vars_array, $zone ); break; default : case (! array_key_exists ( 'MODULE_SHIPPING_MZMT_GEOZONE_' . $zone . '_ID', $vars_array ) && $zone > $this->num_geozones) : // The zone does not already exist and we do not need it. We're done here. // Break out of the loop and return. break 2; } } } } // function zones_tables //// // Update existing, add new, and/or remove unwanted tables // Done here so that we don't have to repeat this code multiple times in the zones_tables() method function update_tables( $vars_array, $zone ) { // loop an arbitrary number of times, breaking out when we are done for( $tables = 1; $tables < 999; $tables ++ ) { switch( true ) { case ( ! array_key_exists( 'MODULE_SHIPPING_MZMT_GEOZONE_' . $zone . '_TABLE_' . $tables, $vars_array ) && $tables <= $this->num_tables ) : // The table does not already exist and we need to create it tep_db_query ( "insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Geo Zone " . $zone . " Shipping Table " . $tables . "', 'MODULE_SHIPPING_MZMT_GEOZONE_" . $zone . "_TABLE_" . $tables . "', '', 'Shipping table " . $tables . " for this geo zone', '6', '0', now())" ); foreach( $this->languages_array as $language ) { $lang = '_' . strtoupper( $language ); $language_name = ucfirst( $language ); tep_db_query ( "insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Geo Zone " . $zone . " Shipping Table " . $tables . " Name', 'MODULE_SHIPPING_MZMT_GEOZONE_" . $zone . "_TABLE_" . $tables . "_TEXT_WAY" . $lang . "', '', 'Shipping table " . $tables . " name for this geo zone in " . $language_name . "', '6', '0', now())" ); } break; case ( array_key_exists( 'MODULE_SHIPPING_MZMT_GEOZONE_' . $zone . '_TABLE_' . $tables, $vars_array ) && $tables <= $this->num_tables ) : // The table already exists and we only need to update it // The normal update process handles this, so nothering to do here break; case ( array_key_exists( 'MODULE_SHIPPING_MZMT_GEOZONE_' . $zone . '_TABLE_' . $tables, $vars_array ) && $tables > $this->num_tables ) : // The table already exists and we no longer want it, so remove the entries tep_db_query ( "delete from " . TABLE_CONFIGURATION . " where configuration_key like 'MODULE_SHIPPING_MZMT_GEOZONE_" . $zone . "_TABLE_" . $tables . "%'" ); break; default : case ( ! array_key_exists( 'MODULE_SHIPPING_MZMT_GEOZONE_' . $zone . '_TABLE_' . $tables, $vars_array ) && $tables > $this->num_tables ) : // The table does not already exist and we do not need it. We're done here. // Break out of the loop and quit. break 2; } // switch( true ) } // for( $tables = 1 } // function update_tables //// // Initial install 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 ( 'Module Version', 'MODULE_SHIPPING_MZMT_VERSION', '" . $this->version . "', 'The version of this module that you are running', '6', '0', 'tep_cfg_disabled(', now() ) "); tep_db_query ( "insert into " . TABLE_CONFIGURATION . " ( configuration_key, configuration_group_id, sort_order, use_function, set_function ) values ( 'MODULE_SHIPPING_MZMT_LANGUAGE_FILE_TEST', '6', '0', 'tep_cfg_mzmt_language_file_check', 'tep_cfg_do_nothing(' ) "); tep_db_query ( "insert into " . TABLE_CONFIGURATION . " ( configuration_key, configuration_group_id, sort_order, use_function, set_function ) values ( 'MODULE_SHIPPING_MZMT_MODULE_MODS_TEST', '6', '0', 'tep_cfg_mzmt_modules_mod_test', 'tep_cfg_do_nothing(' ) "); 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 Multi-Geo Zone Multi-Table Shipping', 'MODULE_SHIPPING_MZMT_STATUS', 'True', 'Do you want to offer multi-region multi-table 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_MZMT_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 ('Prefix', 'MODULE_SHIPPING_MZMT_PREFIX', 'shp', 'Use only geo zones that start with this string. Leave blank to show all geo zones, including tax zones.', '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 ('Weight Units', 'MODULE_SHIPPING_MZMT_WEIGHT_UNITS', 'lbs.', 'Show these units after the weight. If blank, no weight will be shown.', '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 ('Sort Order', 'MODULE_SHIPPING_MZMT_SORT_ORDER', '0', 'Sort order of display.', '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 ('Number of Geo Zones', 'MODULE_SHIPPING_MZMT_NUMBER_GEOZONES', '0', 'The number of shipping geo zones you want to use.', '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 ('Number of Tables/Geo Zone', 'MODULE_SHIPPING_MZMT_NUMBER_TABLES', '0', 'The number of shipping tables per geo zone.', '6', '0', now())" ); tep_db_query ( "insert into " . TABLE_CONFIGURATION . " ( configuration_key, configuration_value, configuration_group_id, sort_order, use_function, set_function ) values ( 'MODULE_SHIPPING_MZMT_UPDATE_ZONES_TABLES', 'True', '6', '0', 'tep_cfg_mzmt_warning_second_install', 'tep_cfg_do_nothing(' ) "); // The remaining configuration values will be added by the Update function once the numbers of geo zones and tables are known. } //// // Uninstall function remove() { tep_db_query ( "delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode ( "', '", $this->keys () ) . "')" ); } //// // Keys match the database configuration table's configuration_key field function keys() { $keys = array (); $keys [] = 'MODULE_SHIPPING_MZMT_VERSION'; $keys [] = 'MODULE_SHIPPING_MZMT_LANGUAGE_FILE_TEST'; $keys [] = 'MODULE_SHIPPING_MZMT_MODULE_MODS_TEST'; $keys [] = 'MODULE_SHIPPING_MZMT_STATUS'; $keys [] = 'MODULE_SHIPPING_MZMT_TAX_CLASS'; $keys [] = 'MODULE_SHIPPING_MZMT_PREFIX'; $keys [] = 'MODULE_SHIPPING_MZMT_WEIGHT_UNITS'; $keys [] = 'MODULE_SHIPPING_MZMT_SORT_ORDER' ; $keys [] = 'MODULE_SHIPPING_MZMT_NUMBER_GEOZONES'; $keys [] = 'MODULE_SHIPPING_MZMT_NUMBER_TABLES'; $keys [] = 'MODULE_SHIPPING_MZMT_UPDATE_ZONES_TABLES'; for( $zone = 1; $zone <= $this->num_geozones; $zone ++ ) { $keys [] = 'MODULE_SHIPPING_MZMT_GEOZONE_' . $zone . '_ID'; $keys [] = 'MODULE_SHIPPING_MZMT_GEOZONE_' . $zone . '_MODE'; $keys [] = 'MODULE_SHIPPING_MZMT_GEOZONE_' . $zone . '_ICON'; foreach( $this->languages_array as $language ) { $lang = strtoupper( $language ); $keys [] = 'MODULE_SHIPPING_MZMT_GEOZONE_' . $zone . '_TEXT_TITLE_' . $lang; } $keys [] = 'MODULE_SHIPPING_MZMT_GEOZONE_' . $zone . '_HANDLING'; for( $tables = 1; $tables <= $this->num_tables; $tables ++ ) { $keys [] = 'MODULE_SHIPPING_MZMT_GEOZONE_' . $zone . '_TABLE_' . $tables; foreach( $this->languages_array as $language ) { $lang = strtoupper( $language ); $keys [] = 'MODULE_SHIPPING_MZMT_GEOZONE_' . $zone . '_TABLE_' . $tables . '_TEXT_WAY_' . $lang; } } } return $keys; } //// // Get an array of installed languages function get_languages() { if( !class_exists( 'language' ) ) { include_once DIR_WS_CLASSES . 'language.php'; } $language_class = new language; $languages = $language_class->catalog_languages; foreach( $languages as $this_language ) { $this->languages_array[$this_language['id']] = $this_language['directory']; } } //// // Set the correct order total value for the selected shipping basis function determineTableMethod($geozone_mode) { global $total_count, $shipping_weight; $this->geozone_mode = $geozone_mode; if ($this->geozone_mode == 'price') { // when mode is 'price', use $this->getShippableTotal() (function further below) to get "order_total". Shipping cost will be adjusted accordingly when there are virtual products in a mixed cart. $this->order_total = $this->getShippableTotal(); } elseif ($this->geozone_mode == 'count') { // when mode is 'count', use $this->getNumberOfItems() (function further below) to get "order_total". Shipping cost will be adjusted accordingly when there are virtual products in a mixed cart. $this->order_total = $this->getNumberOfItems(); } else { $this->order_total = $shipping_weight; } return true; } //// // Return the shipping cost based on the table function determineShipping( $table_cost ) { global $shipping_num_boxes; for($i = 0, $n = sizeof ( $table_cost ); $i < $n; $i += 2) { // Shipping prices are calculated using the maximum values from the shipping tables. (same as the zone and table shipping modules) if ($this->order_total <= $table_cost [$i]) { $shipping_factor = $table_cost [$i + 1]; break; } } if (substr_count ( $shipping_factor, '%' ) > 0) { $shipping = ((($this->order_total * 10) / 10) * ((str_replace ( '%', '', $shipping_factor )) / 100)); } else { $shipping = str_replace ( '$', '', $shipping_factor ); } if ($this->geozone_mode == 'weight') { $shipping = $shipping * $shipping_num_boxes; } return $shipping; } //// // Check if the current zone matches one of the geo zones we have set up here function getGeoZoneID( $country_id, $zone_id ) { // Set the SQL for thegeo zone prefix if any. $prefix_sql = ''; if( MODULE_SHIPPING_MZMT_PREFIX != '' ) { $prefix_sql = " and LOWER(gz.geo_zone_name) like '" . strtolower( MODULE_SHIPPING_MZMT_PREFIX ) . "%'"; } // Check for a Geo Zone that explicity includes the country & specific zone (useful for splitting countries with zones up) $zone_query = tep_db_query ( "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 . "'" . $prefix_sql ); if (tep_db_num_rows ( $zone_query )) { $zone = tep_db_fetch_array ( $zone_query ); return $zone ['geo_zone_id']; } else { // No luck… Now check for a Geo Zone for the country and "All Zones" of the country. $zone_query = tep_db_query ( "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)" . $prefix_sql ); if (tep_db_num_rows ( $zone_query )) { $zone = tep_db_fetch_array ( $zone_query ); return $zone ['geo_zone_id']; } else { return false; } } } // when the shopping cart contains mixed content calculate the cart total price of physical items, for shipping tables "based on price" - (excludes virtual items) function getShippableTotal() { global $order, $cart, $currencies; $order_total = $cart->show_total(); if ($order->content_type == 'mixed') { $order_total = 0; for ($i=0, $n=sizeof($order->products); $i<$n; $i++) { $order_total += $currencies->calculate_price($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty']); if (isset($order->products[$i]['attributes'])) { reset($order->products[$i]['attributes']); while (list($option, $value) = each($order->products[$i]['attributes'])) { $virtual_check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad where pa.products_id = '" . (int)$order->products[$i]['id'] . "' and pa.options_values_id = '" . (int)$value['value_id'] . "' and pa.products_attributes_id = pad.products_attributes_id"); $virtual_check = tep_db_fetch_array($virtual_check_query); if ($virtual_check['total'] > 0) { $order_total -= $currencies->calculate_price($order->products[$i]['final_price'], $order->products[$i]['tax'], $order->products[$i]['qty']); } } } } } return $order_total; } // when the shopping cart contains mixed content calculate the number of physical items, for shipping tables "based on the number of items" - (excludes virtual items) function getNumberOfItems() { global $order, $total_count; $number_of_items = $total_count; if ($order->content_type == 'mixed') { $number_of_items = 0; for ($i=0, $n=sizeof($order->products); $i<$n; $i++) { $number_of_items += $order->products[$i]['qty']; if (isset($order->products[$i]['attributes'])) { reset($order->products[$i]['attributes']); while (list($option, $value) = each($order->products[$i]['attributes'])) { $virtual_check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD . " pad where pa.products_id = '" . (int)$order->products[$i]['id'] . "' and pa.options_values_id = '" . (int)$value['value_id'] . "' and pa.products_attributes_id = pad.products_attributes_id"); $virtual_check = tep_db_fetch_array($virtual_check_query); if ($virtual_check['total'] > 0) { $number_of_items -= $order->products[$i]['qty']; } } } } } return $number_of_items; } } // class /// // Function (not a method!) generates a pulldown menu filled with the available Geo Zones if( ! function_exists( 'tep_cfg_pull_down_geozones' ) ) { function tep_cfg_pull_down_geozones( $zone_class_id, $key = '' ) { $name = ( ( $key ) ? 'configuration[' . $key . ']' : 'configuration_value' ); $zone_class_array = array ( array ( 'id' => '0', 'text' => 'Rest of the World' ) ); $zone_class_query_raw = " select geo_zone_id, geo_zone_name from " . TABLE_GEO_ZONES . " where LOWER(geo_zone_name) like '" . strtolower( MODULE_SHIPPING_MZMT_PREFIX ) . "%' order by geo_zone_name "; $zone_class_query = tep_db_query( $zone_class_query_raw ); while( $zone_class = tep_db_fetch_array ( $zone_class_query ) ) { $zone_class_array [] = array ( 'id' => $zone_class ['geo_zone_id'], 'text' => $zone_class ['geo_zone_name'] ); } return tep_draw_pull_down_menu( $name, $zone_class_array, $zone_class_id ); } } //// // Check whether admin/modules.php has been modified/replaced if( !function_exists( 'tep_cfg_mzmt_modules_mod_test' ) ) { function tep_cfg_mzmt_modules_mod_test() { $filename = DIR_FS_ADMIN . 'modules.php'; if( file_exists( $filename ) ) { // Read the file into an array, one line per element $file_array = file( $filename ); // Step through the file and check for a match with the selected code foreach ($file_array as $line) { // Check if the line matches one of the lines that should be removed if( trim( $line ) == '$module->update( $HTTP_POST_VARS[\'configuration\'] );' ) { // The critical line exists, so return success and quit return '<div style="margin-top:-2em;">' . tep_image( DIR_WS_ICONS . 'tick.gif', '', '16', '16', 'style="vertical-align:middle;"' ) . ' <span style="vertical-align:middle; font-weight:bold;">' . MODULE_SHIPPING_MZMT_MODULES . '</span></div>'; break; } } } else { // The file was not found, so return an error return '<div style="margin-top:-2em;">' . tep_image( DIR_WS_ICONS . 'cross.gif', '', '16', '16', 'style="vertical-align:middle;"' ) . ' <span style="vertical-align:middle; font-weight:bold; color:red;">' . MODULE_SHIPPING_MZMT_MODULES_MISSING . '</span></div>'; } // if( file_exists // The lines were not found in the file, so return an error message return '<div style="margin-top:-2em;">' . tep_image( DIR_WS_ICONS . 'cross.gif', '', '16', '16', 'style="vertical-align:middle;"' ) . ' <span style="vertical-align:middle; font-weight:bold; color:red;">' . MODULE_SHIPPING_MZMT_MODULES_NOT_MODIFIED . '</span></div>'; } // function tep_cfg_mzmt_modules_mod_test } // if( !function_exists //// // Check whether the language file for this module exists // We should only need to check the Admin language, so that is taken from $language if (!function_exists('tep_cfg_mzmt_language_file_check')) { function tep_cfg_mzmt_language_file_check() { global $language; $language_file = DIR_FS_CATALOG . DIR_WS_LANGUAGES . $language . '/modules/shipping/mzmt.php'; if (file_exists($language_file) && is_file($language_file)) { return '<div style="margin-top:-1em;">' . tep_image(DIR_WS_ICONS . 'tick.gif', '', '16', '16', 'style="vertical-align:middle;"') . ' <span style="vertical-align:middle; font-weight:bold;">' . MODULE_SHIPPING_MZMT_LANGUAGE_FILE_FOUND . '</span></div>'; return; } // if( file_exists // The language file was not found, so return an error message return '<div style="margin-top:-1em;">' . tep_image(DIR_WS_ICONS . 'cross.gif', '', '16', '16', 'style="vertical-align:middle;"') . ' <span style="vertical-align:middle; font-weight:bold; color:red;">' . MODULE_SHIPPING_MZMT_LANGUAGE_FILE_MISSING . '</span></div>'; } // function tep_cfg_mzmt_language_file_check } // if( !function_exists //// // Show a warning message about second install step // This function is used only in the initial install, // it is removed the first time the module is edited. if (!function_exists('tep_cfg_mzmt_warning_second_install')) { function tep_cfg_mzmt_warning_second_install() { return '<div style="margin-top:-1em;">' . tep_image(DIR_WS_IMAGES . 'ms_info.png', '', '16', '16', 'style="vertical-align:middle;"') . ' <span style="vertical-align:middle; font-weight:bold;">' . MODULE_SHIPPING_MZMT_TEXT_EXPLAIN_SECOND_STEP . '</span></div>'; } } //// // Selector for the Update function // Can be set to True, but is reset to False once Update runs if( !function_exists( 'tep_cfg_mzmt_update' ) ) { function tep_cfg_mzmt_update( $key_value, $key ) { $string = ''; $select_array = array( 0 => 'True', 1 => 'False' ); for ($i=0, $n=sizeof($select_array); $i<$n; $i++) { $name = ((tep_not_null($key)) ? 'configuration[' . $key . ']' : 'configuration_value'); if( $select_array[$i] != 'False' ) { $string .= '<input type="checkbox" name="' . $name . '" value="' . $select_array[$i] . '" /> '; $string .= $select_array[$i]; } } return $string; } } //// // Function to show a disabled entry if( !function_exists( 'tep_cfg_disabled' ) ) { function tep_cfg_disabled( $value ) { return tep_draw_input_field( 'configuration_value', $value, ' disabled' ); } } //// // Prevent input boxes showing for the output-only test functions if (!function_exists('tep_cfg_do_nothing')) { function tep_cfg_do_nothing() { return ''; } }?> ========================================================================================== PrefixShpWeight Unitslbs.Sort Order0Number of Geo Zones3Number of Tables/Geo Zone2UpdateGeo Zone 1Shp: United States: 48Geo Zone 1 Table ModeweightGeo Zone 1 Table IconGeo Zone 1 Table Title in EnglishShippingGeo Zone 1 Handling Fee0Geo Zone 1 Shipping Table 11:4.99,2:7.59,3:8.39,4:9.19,5:9.99,6:10.79,7:11.59,8:12.39,9:13.19,10:13.99Geo Zone 1 Shipping Table 1 NameEconomyGeo Zone 1 Shipping Table 21:8.99,2:9.99,3:10.49,4:10.99,5:11.49,6:11.99,7:12.49,8:12.99,9:13.49,10:13.99, 11:14.39,12:14.79,13:15.19,14:15.59,15:15.99,16:16.39,17:16.79,18:17.19,19:17.59,20:17.99, 21:18.39,22:18.79,23:19.19,24:19.59,25:19.99,26:20.39,27:20.79,28:21.19,29:21.59,30:21.99, 31:22.39,32:22.79,33:23.19,34:23.59,35:23.99,36:24.39,37:24.79,38:25.19,39:25.59,40:25.99, 41:26.39,42:26.79,43:27.19,44:27.59,45:27.99,46:28.39,47:28.79,48:29.19,49:29.59,50:29.99, 51:30.39,52:30.79,53:31.19,54:31.59,55:31.99,56:32.39,57:32.79,58:33.19,59:33.59,60:33.99, 61:34.39,62:34.79,63:35.19,64:35.59,65:35.99,66:36.39,67:36.79,68:37.19,69:37.59,70:37.99, 71:38.39,72:38.79,73:39.19,74:39.59,75:39.99,76:40.39,77:40.79,78:41.19,79:41.59,80:41.99, 81:42.39,82:42.79,83:43.19,84:43.59,85:43.99,86:44.39,87:44.79,88:45.19,89:45.59,90:45.99, 91:46.39,92:46.79,93:47.19,94:47.59,95:47.99,96:48.39,97:48.79,98:49.19,99:49.59,100:49.99, 101:50.39,102:50.79,103:51.19,104:51.59,105:51.99,106:52.39,107:52.79,108:53.19,109:53.59,110:53.99, 111:54.39,112:54.79,113:55.19,114:55.59,115:55.99,116:56.39,117:56.79,118:57.19,119:57.59,120:57.99, 121:58.39,122:58.79,123:59.19,124:59.59,125:59.99,126:60.39,127:60.79,128:61.19,129:61.59,130:61.99, 131:62.39,132:62.79,133:63.19,134:63.59,135:63.99,136:64.39,137:64.79,138:65.19,139:65.59,140:65.99, 141:66.39,142:66.79,143:67.19,144:67.59,145:67.99,146:68.39,147:68.79,148:69.19,149:69.59,150:69.99Geo Zone 1 Shipping Table 2 NameStandard GroundGeo Zone 2Shp: United States: OHGeo Zone 2 Table ModeweightGeo Zone 2 Table IconGeo Zone 2 Table Title in EnglishShippingGeo Zone 2 Handling Fee0Geo Zone 2 Shipping Table 11:4.99,2:7.59,3:8.39,4:9.19,5:9.99,6:10.79,7:11.59,8:12.39,9:13.19,10:13.99Geo Zone 2 Shipping Table 1 NameEconomyGeo Zone 2 Shipping Table 21:8.99,2:9.99,3:10.49,4:10.99,5:11.49,6:11.99,7:12.49,8:12.99,9:13.49,10:13.99, 11:14.39,12:14.79,13:15.19,14:15.59,15:15.99,16:16.39,17:16.79,18:17.19,19:17.59,20:17.99, 21:18.39,22:18.79,23:19.19,24:19.59,25:19.99,26:20.39,27:20.79,28:21.19,29:21.59,30:21.99, 31:22.39,32:22.79,33:23.19,34:23.59,35:23.99,36:24.39,37:24.79,38:25.19,39:25.59,40:25.99, 41:26.39,42:26.79,43:27.19,44:27.59,45:27.99,46:28.39,47:28.79,48:29.19,49:29.59,50:29.99, 51:30.39,52:30.79,53:31.19,54:31.59,55:31.99,56:32.39,57:32.79,58:33.19,59:33.59,60:33.99, 61:34.39,62:34.79,63:35.19,64:35.59,65:35.99,66:36.39,67:36.79,68:37.19,69:37.59,70:37.99, 71:38.39,72:38.79,73:39.19,74:39.59,75:39.99,76:40.39,77:40.79,78:41.19,79:41.59,80:41.99, 81:42.39,82:42.79,83:43.19,84:43.59,85:43.99,86:44.39,87:44.79,88:45.19,89:45.59,90:45.99, 91:46.39,92:46.79,93:47.19,94:47.59,95:47.99,96:48.39,97:48.79,98:49.19,99:49.59,100:49.99, 101:50.39,102:50.79,103:51.19,104:51.59,105:51.99,106:52.39,107:52.79,108:53.19,109:53.59,110:53.99, 111:54.39,112:54.79,113:55.19,114:55.59,115:55.99,116:56.39,117:56.79,118:57.19,119:57.59,120:57.99, 121:58.39,122:58.79,123:59.19,124:59.59,125:59.99,126:60.39,127:60.79,128:61.19,129:61.59,130:61.99, 131:62.39,132:62.79,133:63.19,134:63.59,135:63.99,136:64.39,137:64.79,138:65.19,139:65.59,140:65.99, 141:66.39,142:66.79,143:67.19,144:67.59,145:67.99,146:68.39,147:68.79,148:69.19,149:69.59,150:69.99Geo Zone 2 Shipping Table 2 NameStandard GroundGeo Zone 3Shp: United States: AK & HIGeo Zone 3 Table ModeweightGeo Zone 3 Table IconGeo Zone 3 Table Title in EnglishShippingGeo Zone 3 Handling Fee0Geo Zone 3 Shipping Table 11:14.99,2:17.59,3:18.39,4:19.19,5:19.99,6:20.79,7:21.59,8:22.39,9:23.19,10:23.99Geo Zone 3 Shipping Table 1 NameEconomyGeo Zone 3 Shipping Table 21:18.99,2:19.99,3:20.49,4:20.99,5:21.49,6:21.99,7:22.49,8:22.99,9:23.49,10:23.99, 11:24.39,12:24.79,13:25.19,14:25.59,15:25.99,16:26.39,17:26.79,18:27.19,19:27.59,20:27.99, 21:28.39,22:28.79,23:29.19,24:29.59,25:29.99,26:30.39,27:30.79,28:31.19,29:31.59,30:31.99, 31:32.39,32:32.79,33:33.19,34:33.59,35:33.99,36:34.39,37:34.79,38:35.19,39:35.59,40:35.99, 41:36.39,42:36.79,43:37.19,44:37.59,45:37.99,46:38.39,47:38.79,48:39.19,49:39.59,50:39.99, 51:40.39,52:40.79,53:41.19,54:41.59,55:41.99,56:42.39,57:42.79,58:43.19,59:43.59,60:43.99, 61:44.39,62:44.79,63:45.19,64:45.59,65:45.99,66:46.39,67:46.79,68:47.19,69:47.59,70:47.99, 71:48.39,72:48.79,73:49.19,74:49.59,75:49.99,76:50.39,77:50.79,78:51.19,79:51.59,80:51.99, 81:52.39,82:52.79,83:53.19,84:53.59,85:53.99,86:54.39,87:54.79,88:55.19,89:55.59,90:55.99, 91:56.39,92:56.79,93:57.19,94:57.59,95:57.99,96:58.39,97:58.79,98:59.19,99:59.59,100:59.99, 101:60.39,102:60.79,103:61.19,104:61.59,105:61.99,106:62.39,107:62.79,108:63.19,109:63.59,110:63.99, 111:64.39,112:64.79,113:65.19,114:65.59,115:65.99,116:66.39,117:66.79,118:67.19,119:67.59,120:67.99, 121:68.39,122:68.79,123:69.19,124:69.59,125:69.99,126:70.39,127:70.79,128:71.19,129:71.59,130:71.99, 131:72.39,132:72.79,133:73.19,134:73.59,135:73.99,136:74.39,137:74.79,138:75.19,139:75.59,140:75.99, 141:76.39,142:76.79,143:77.19,144:77.59,145:77.99,146:78.39,147:78.79,148:79.19,149:79.59,150:79.99Geo Zone 3 Shipping Table 2 NameStandard Take care Bill Quote Link to comment Share on other sites More sharing options...
shoshoni Posted December 7, 2016 Share Posted December 7, 2016 Excellent contribution - thank you very much. Quote Link to comment Share on other sites More sharing options...
shoshoni Posted December 7, 2016 Share Posted December 7, 2016 (edited) ...duplicate post... Edited December 7, 2016 by shoshoni Quote Link to comment Share on other sites More sharing options...
Psytanium Posted August 28, 2017 Share Posted August 28, 2017 Hello, I installed and using this module on 2.3.4 and everything seems working fine, but i notice duplicates in the database, when I open phpmyadmin and check the configuration table, there is 7 duplicate entries of those configuration: 7 x MODULE_SHIPPING_MZMT_GEOZONE_1_ID 7 x MODULE_SHIPPING_MZMT_GEOZONE_1_HANDLING 7 x MODULE_SHIPPING_MZMT_GEOZONE_1_TABLE_1 7 x MODULE_SHIPPING_MZMT_GEOZONE_1_TABLE_1_TEXT_WAY_EN... 7 x MODULE_SHIPPING_MZMT_GEOZONE_1_ICON 7 x MODULE_SHIPPING_MZMT_GEOZONE_1_MODE 7 x MODULE_SHIPPING_MZMT_GEOZONE_1_TEXT_TITLE_ENGLISH is this something normal ? or I should look for the problem and fix it ? It's always 7 duplicates even if I change the number of geozones and tables. Thank you Quote Link to comment Share on other sites More sharing options...
Psytanium Posted August 28, 2017 Share Posted August 28, 2017 (edited) and i can't understand whats the difference with or without UPDATE check box. The notice msg say " This will remove all of the settings below " but nothing is removed, which is something good of course. I tried modifying the number of geozones with or without UPDATE, the data are preserved, nothing lost in both cases. Edited August 28, 2017 by Psytanium Quote Link to comment Share on other sites More sharing options...
allaboutwicker Posted October 10, 2017 Share Posted October 10, 2017 Does anyone know if this will work on a 2.3.4 BS site? Quote Link to comment Share on other sites More sharing options...
♥Dan Cole Posted October 10, 2017 Share Posted October 10, 2017 31 minutes ago, allaboutwicker said: Does anyone know if this will work on a 2.3.4 BS site? I'm using it on GOLD....I don't remember if I had to make any changes to get it to work but not much has changed on the admin side of things so it should be fine as it. Dan Quote Need help? See this thread and provide the information requested. Is your version of osC up to date? You'll find the latest osC community version (CE Phoenix) here. Link to comment Share on other sites More sharing options...
allaboutwicker Posted October 10, 2017 Share Posted October 10, 2017 Very good! I will work on trying to install it then shortly and confirm if it will work. Thanks! Quote Link to comment Share on other sites More sharing options...
allaboutwicker Posted October 11, 2017 Share Posted October 11, 2017 I was able to install this on my modified 2.3.4 BS site with using the sql file for 48 US Continental states, but I need to break those out into 3 zones so I have the Northeastern US states in one, middle states in another and then the Western states in 3rd zone. I thought I could use the sql for the 48 states and change it to include only the states I wanted in each zone, but I must be doing something wrong with my code? Can anyone give me a clue what I am doing wrong here? Here is original sql file for all the 48 states: INSERT INTO `geo_zones` VALUES ('', 'Shp: United States: 48', 'United States: Continental 48 states', NULL, now()); INSERT INTO `zones_to_geo_zones` VALUES ('', 223, 1, last_insert_id(), NULL, now()), ('', 223, 4, last_insert_id(), NULL, now()), ('', 223, 5, last_insert_id(), NULL, now()), ('', 223, 12, last_insert_id(), NULL, now()), ('', 223, 13, last_insert_id(), NULL, now()), ('', 223, 14, last_insert_id(), NULL, now()), ('', 223, 15, last_insert_id(), NULL, now()), ('', 223, 16, last_insert_id(), NULL, now()), ('', 223, 18, last_insert_id(), NULL, now()), ('', 223, 19, last_insert_id(), NULL, now()), ('', 223, 22, last_insert_id(), NULL, now()), ('', 223, 23, last_insert_id(), NULL, now()), ('', 223, 24, last_insert_id(), NULL, now()), ('', 223, 25, last_insert_id(), NULL, now()), ('', 223, 26, last_insert_id(), NULL, now()), ('', 223, 27, last_insert_id(), NULL, now()), ('', 223, 28, last_insert_id(), NULL, now()), ('', 223, 29, last_insert_id(), NULL, now()), ('', 223, 31, last_insert_id(), NULL, now()), ('', 223, 32, last_insert_id(), NULL, now()), ('', 223, 33, last_insert_id(), NULL, now()), ('', 223, 34, last_insert_id(), NULL, now()), ('', 223, 35, last_insert_id(), NULL, now()), ('', 223, 36, last_insert_id(), NULL, now()), ('', 223, 37, last_insert_id(), NULL, now()), ('', 223, 38, last_insert_id(), NULL, now()), ('', 223, 39, last_insert_id(), NULL, now()), ('', 223, 40, last_insert_id(), NULL, now()), ('', 223, 41, last_insert_id(), NULL, now()), ('', 223, 42, last_insert_id(), NULL, now()), ('', 223, 43, last_insert_id(), NULL, now()), ('', 223, 44, last_insert_id(), NULL, now()), ('', 223, 45, last_insert_id(), NULL, now()), ('', 223, 47, last_insert_id(), NULL, now()), ('', 223, 48, last_insert_id(), NULL, now()), ('', 223, 49, last_insert_id(), NULL, now()), ('', 223, 51, last_insert_id(), NULL, now()), ('', 223, 53, last_insert_id(), NULL, now()), ('', 223, 54, last_insert_id(), NULL, now()), ('', 223, 55, last_insert_id(), NULL, now()), ('', 223, 56, last_insert_id(), NULL, now()), ('', 223, 57, last_insert_id(), NULL, now()), ('', 223, 58, last_insert_id(), NULL, now()), ('', 223, 59, last_insert_id(), NULL, now()), ('', 223, 61, last_insert_id(), NULL, now()), ('', 223, 62, last_insert_id(), NULL, now()), ('', 223, 63, last_insert_id(), NULL, now()), ('', 223, 64, last_insert_id(), NULL, now()), ('', 223, 65, last_insert_id(), NULL, now()); and here is my sql code for to attempt to add just the Northeastern states: INSERT INTO `geo_zones` VALUES ('', 'Shp: United States: NE', 'NE United States', NULL, now()); INSERT INTO `zones_to_geo_zones` VALUES ('', 223, 14, last_insert_id(), NULL, now()), ('', 223, 15, last_insert_id(), NULL, now()), ('', 223, 29, last_insert_id(), NULL, now()), ('', 223, 31, last_insert_id(), NULL, now()), ('', 223, 32, last_insert_id(), NULL, now()), ('', 223, 40, last_insert_id(), NULL, now()), ('', 223, 41, last_insert_id(), NULL, now()), ('', 223, 43, last_insert_id(), NULL, now()), ('', 223, 44, last_insert_id(), NULL, now()), ('', 223, 47, last_insert_id(), NULL, now()), ('', 223, 51, last_insert_id(), NULL, now()), ('', 223, 53, last_insert_id(), NULL, now()), ('', 223, 59, last_insert_id(), NULL, now()), ('', 223, 61, last_insert_id(), NULL, now()), ('', 223, 63, last_insert_id(), NULL, now()); Thanks for any advice. Quote Link to comment Share on other sites More sharing options...
♥Dan Cole Posted October 12, 2017 Share Posted October 12, 2017 @allaboutwicker Leslie....do you have the three zones defined? It looks like your query is writing the information back to the same zone ie 223....I assume each of your zones should have a different ID and if so you'll need to reference the different zone numbers in your queries that inserts the data. I hope that makes sense. Dan Quote Need help? See this thread and provide the information requested. Is your version of osC up to date? You'll find the latest osC community version (CE Phoenix) here. Link to comment Share on other sites More sharing options...
♥kymation Posted October 12, 2017 Share Posted October 12, 2017 @allaboutwicker I advise you to not modify the database directly unless you have a very complete understanding of the osCommerce database architecture. Instead of modifying the database, you should be creating your zones in your store's Admin and then populating those zones with the correct states. This is much less dangerous than modifying the database like you are trying to do. I hope that you have a backup of your database without these changes that you can restore to. Regards Jim Quote See my profile for a list of my addons and ways to get support. Link to comment Share on other sites More sharing options...
allaboutwicker Posted October 12, 2017 Share Posted October 12, 2017 (edited) @kymationHi Jim, Thanks for your advice. I do not fully understand the database as you said. I do have a backup of my database before I made any changes. I cannot remember doing a restore of my database or if I did it was a long time ago and not sure of best method to do so. Should I do it through phpmyadmin in my cpanel or is there a better way? I have read to go into the database and click to check all tables and drop, then import the database sql file of old database. Is this correct? Edited October 12, 2017 by allaboutwicker Quote Link to comment Share on other sites More sharing options...
♥kymation Posted October 12, 2017 Share Posted October 12, 2017 (edited) That's probably the best way to do it. osCommerce has a restore function, but if given a choice I would do it through phpMyAdmin. Note that you will lose any changes made after your backup was made. I hope this wasn't a live shop. Regards Jim Edited October 12, 2017 by kymation Quote See my profile for a list of my addons and ways to get support. 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.