Zen Follower
- Join Date:
- Jul 2009
- Posts:
- 159
- Plugin Contributions:
- 0
Adding 2 more flat rate shipping modules
That worked. I wasn't sure if there were any exceptions to the flatxxx rule.
Thanks for your time and help.
Views: 25,174
Zen Follower
That worked. I wasn't sure if there were any exceptions to the flatxxx rule.
Thanks for your time and help.
Oba-san
You are most welcome ... thanks for the update that this is now working for you ... :smile:
Linda McGrath
If you have to think ... you haven't been zenned ...
Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here
Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!
New Zenner
Thanks fairestcape, your clone works perfect. The only thing i did different to your guide is because i'm using version 1.3.9h.
I duplicate both files flat.php and rename to the one i needs from the /languages/... and modules/... and left it in it (same) folder instead of create new folders /FLATONE/.... or /FLATTWO/...
I did it this way, cause i think version 1.3.9h is different. And everything works fine.
:clap:
Thanks heaps.
New Zenner
This is a really useful walkthrough - many thanks.
So what happens when you want to duplicate the "table" shipping method, there are the words "table" used in the PHP code itself so for anyone like myself who isn't sure if its calling for the filename or drawing a table or doing something else in the particular line of code....
I had the same problem with duplicating table shipping due to the different tables - I downloaded the "duplicatetable" add-on but it had a few differences from the 1.5 version of table.php so I rewrote it for 1.5:
My duplicated table is "tableone" - includes/modules/shipping/tableone.php
<?php
/**
* @package shippingMethod
* @copyright Copyright 2003-2009 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: table.php 14498 2009-10-01 20:16:16Z ajeh $
*/
/**
* Enter description here...
*
*/
class tableone 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 table
*/
function tableone() {
global $order, $db;
$this->code = 'tableone';
$this->title = MODULE_SHIPPING_TABLEONE_TEXT_TITLE;
$this->description = MODULE_SHIPPING_TABLEONE_TEXT_DESCRIPTION;
$this->sort_order = MODULE_SHIPPING_TABLEONE_SORT_ORDER;
$this->icon = '';
$this->tax_class = MODULE_SHIPPING_TABLEONE_TAX_CLASS;
$this->tax_basis = MODULE_SHIPPING_TABLEONE_TAX_BASIS;
// disable only when entire cart is free shipping
if (zen_get_shipping_enabled($this->code)) {
$this->enabled = ((MODULE_SHIPPING_TABLEONE_STATUS == 'True') ? true : false);
}
if ($this->enabled) {
// check MODULE_SHIPPING_TABLEONE_HANDLING_METHOD is in
$check_query = $db->Execute("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_SHIPPING_TABLEONE_HANDLING_METHOD'");
if ($check_query->EOF) {
$db->Execute("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Handling Per Order or Per Box', 'MODULE_SHIPPING_TABLEONE_HANDLING_METHOD', 'Order', 'Do you want to charge Handling Fee Per Order or Per Box?', '6', '0', 'zen_cfg_select_option(array(\'Order\', \'Box\'), ', now())");
}
}
if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_TABLEONE_ZONE > 0) ) {
$check_flag = false;
$check = $db->Execute("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_SHIPPING_TABLEONE_ZONE . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' order by zone_id");
while (!$check->EOF) {
if ($check->fields['zone_id'] < 1) {
$check_flag = true;
break;
} elseif ($check->fields['zone_id'] == $order->delivery['zone_id']) {
$check_flag = true;
break;
}
$check->MoveNext();
}
if ($check_flag == false) {
$this->enabled = false;
}
}
}
/**
* Enter description here...
*
* @param unknown_type $method
* @return unknown
*/
function quote($method = '') {
global $order, $shipping_weight, $shipping_num_boxes, $total_count;
// shipping adjustment
switch (MODULE_SHIPPING_TABLEONE_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;
}
$order_total_amount = $_SESSION['cart']->show_total() - $_SESSION['cart']->free_shipping_prices() ;
$table_cost = preg_split("/[:,]/" , MODULE_SHIPPING_TABLEONE_COST);
$size = sizeof($table_cost);
for ($i=0, $n=$size; $i<$n; $i+=2) {
if (round($order_total,9) <= $table_cost[$i]) {
if (strstr($table_cost[$i+1], '%')) {
$shipping = ($table_cost[$i+1]/100) * $order_total_amount;
} else {
$shipping = $table_cost[$i+1];
}
break;
}
}
if (MODULE_SHIPPING_TABLEONE_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;
}
}
$this->quotes = array('id' => $this->code,
'module' => MODULE_SHIPPING_TABLEONE_TEXT_TITLE . $show_box_weight,
'methods' => array(array('id' => $this->code,
'title' => MODULE_SHIPPING_TABLEONE_TEXT_WAY,
'cost' => $shipping + (MODULE_SHIPPING_TABLEONE_HANDLING_METHOD == 'Box' ? MODULE_SHIPPING_TABLEONE_HANDLING * $shipping_num_boxes : MODULE_SHIPPING_TABLEONE_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($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_TABLEONE_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_TABLEONE_STATUS', 'True', 'Do you want to offer 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, set_function, date_added) values ('Shipping Table', 'MODULE_SHIPPING_TABLEONE_COST', '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<br />You can also use percentage amounts, such 25:8.50,35:5%,40:9.50,10000:7% to charge a percentage value of the Order Total', '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, set_function, date_added) values ('Table Method', 'MODULE_SHIPPING_TABLEONE_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, date_added) values ('Handling Fee', 'MODULE_SHIPPING_TABLEONE_HANDLING', '0', 'Handling fee for this shipping method.', '6', '0', 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 ('Handling Per Order or Per Box', 'MODULE_SHIPPING_TABLEONE_HANDLING_METHOD', 'Order', 'Do you want to charge Handling Fee Per Order or Per Box?', '6', '0', 'zen_cfg_select_option(array(\'Order\', \'Box\'), ', 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_TABLEONE_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_TABLEONE_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, use_function, set_function, date_added) values ('Shipping Zone', 'MODULE_SHIPPING_TABLEONE_ZONE', '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, date_added) values ('Sort Order', 'MODULE_SHIPPING_TABLEONE_SORT_ORDER', '0', 'Sort order of display.', '6', '0', now())");
}
/**
* Enter description here...
*
*/
function remove() {
global $db;
$db->Execute("delete from " . TABLE_CONFIGURATION . " where configuration_key like 'MODULE\_SHIPPING\_TABLE\_%'");
}
/**
* Enter description here...
*
* @return unknown
*/
function keys() {
return array('MODULE_SHIPPING_TABLEONE_STATUS', 'MODULE_SHIPPING_TABLEONE_COST', 'MODULE_SHIPPING_TABLEONE_MODE', 'MODULE_SHIPPING_TABLEONE_HANDLING', 'MODULE_SHIPPING_TABLEONE_HANDLING_METHOD', 'MODULE_SHIPPING_TABLEONE_TAX_CLASS', 'MODULE_SHIPPING_TABLEONE_TAX_BASIS', 'MODULE_SHIPPING_TABLEONE_ZONE', 'MODULE_SHIPPING_TABLEONE_SORT_ORDER');
}
}
?>
Simply replace tableone with yourtable and TABLEONE with YOURTABLE - the other tables in the php won't be affected.
For completeness, the language file in includes/languages/english/modules/shipping/tableone.php (which is just a straight find and replace job)
<?php
//
// +----------------------------------------------------------------------+
// |zen-cart Open Source E-commerce |
// +----------------------------------------------------------------------+
// | Copyright (c) 2003 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: table.php 1969 2005-09-13 06:57:21Z drbyte $
//
define('MODULE_SHIPPING_TABLEONE_TEXT_TITLE', 'Table Rate');
define('MODULE_SHIPPING_TABLEONE_TEXT_DESCRIPTION', 'Table Rate');
define('MODULE_SHIPPING_TABLEONE_TEXT_WAY', 'Best Way');
define('MODULE_SHIPPING_TABLEONE_TEXT_WEIGHT', 'Weight');
define('MODULE_SHIPPING_TABLEONE_TEXT_AMOUNT', 'Amount');
?>
Hopefully this will save someone half an hour or so :)
Oba-san
You missed this line:
$db->Execute("delete from " . TABLE_CONFIGURATION . " where configuration_key like 'MODULE\_SHIPPING\_TABLE\_%'");
Linda McGrath
If you have to think ... you haven't been zenned ...
Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here
Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!
New Zenner
Which line is that? I'm sure I caught them all... it's working on my site anyway!
Oba-san
function remove() {
global $db;
$db->Execute("delete from " . TABLE_CONFIGURATION . " where configuration_key like 'MODULE\_SHIPPING\_TABLE\_%'");
}
You do not want to remove all keys with:
MODULES_SHIPPING_TABLE_
You want to remove keys with:
MODULES_SHIPPING_TABLEONE_
so that too needs to reflect the change ...
Linda McGrath
If you have to think ... you haven't been zenned ...
Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here
Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!
New Zenner
aha, that makes sense - that was the part where the duplicatetable add-on couldn't help me because that part of the code was completely different for the earlier version of table.php... I guess I never would've noticed unless I uninstalled it!
Thanks, Ajeh.
So for anyone who wants to use the code I posted above, you'll need to replace this line
$db->Execute("delete from " . TABLE_CONFIGURATION . " where configuration_key like 'MODULE\_SHIPPING\_TABLE\_%'");
with this one:
$db->Execute("delete from " . TABLE_CONFIGURATION . " where configuration_key like 'MODULE\_SHIPPING\_TABLEONE\_%'");
Oba-san
Thanks for posting the update that was needed ... :smile:
Linda McGrath
If you have to think ... you haven't been zenned ...
Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here
Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!
New Zenner
Augh! I too am in hell for my "unique" shipping situation.
Simply put, 90% of my store's items are FREE SHIPPING. So, they all have 0 specified in weight and are using FREE SHIPPING. However, I have a section in my store for shoes. Each pair is $14 with a $6 domestic shipping charge that I need to specify for all shoes. International shipping is available on these items but at a different rate than the $6.
I was hoping that the tutorial by the OP of this threaad would help me, but my stuff still wont show up.
For me, I created a folder called "flatshoes".
In includes/languages/english/modules/shipping/, I created a file called flatshoes.php with the following code:
<?php
//
// +----------------------------------------------------------------------+
// |zen-cart Open Source E-commerce |
// +----------------------------------------------------------------------+
// | Copyright (c) 2003 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: flatshoes.php 1969 2005-09-13 06:57:21Z drbyte $
//
define('MODULE_SHIPPING_ZONEFLATSHOES_TEXT_TITLE', 'Flat Rate - Shoes');
define('MODULE_SHIPPING_ZONEFLATSHOES_TEXT_DESCRIPTION', 'flat rate for our fourteen dollar shoes');
define('MODULE_SHIPPING_ZONEFLATSHOES_TEXT_WAY', 'Best Way');
?>
for my flatshoes/includes/modules/shipping/flatshoes.php file, the code looks like:
<?php
//
// +----------------------------------------------------------------------+
// |zen-cart Open Source E-commerce |
// +----------------------------------------------------------------------+
// | 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: zoneflatshoes.php 1969 2007-08-19 06:57:21Z surf7.net $
//
class zoneflatshoes {
var $code, $title, $description, $icon, $enabled, $num_zones, $dest_zone;
// class constructor
function zoneflatshoes() {
global $order, $db;
$geozones = $db->Execute("SELECT * FROM " . TABLE_GEO_ZONES);
$this->num_zones = $geozones->RecordCount();
$this->code = 'zoneflatshoes';
$this->title = MODULE_SHIPPING_ZONEFLATSHOES_TEXT_TITLE;
$this->description = MODULE_SHIPPING_ZONEFLATSHOES_TEXT_DESCRIPTION;
$this->sort_order = MODULE_SHIPPING_ZONEFLATSHOES_SORT_ORDER;
$this->icon = '';
$this->tax_class = MODULE_SHIPPING_ZONEFLATSHOES_TAX_CLASS;
$this->tax_basis = MODULE_SHIPPING_ZONEFLATSHOES_TAX_BASIS;
// disable only when entire cart is free shipping
if (zen_get_shipping_enabled($this->code)) {
$this->enabled = ((MODULE_SHIPPING_ZONEFLATSHOES_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_ZONEFLATSHOES_ZONE_' . $i) > 0) {
$check = $db->Execute("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . constant('MODULE_SHIPPING_ZONEFLATSHOES_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 if ((int)constant('MODULE_SHIPPING_ZONEFLATSHOES_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 zoneflatshoes()
// class methods
function quote($method = '') {
global $order, $db;
$get_gzn = $db->Execute("select geo_zone_name from " . TABLE_GEO_ZONES . " where geo_zone_id = '" . constant('MODULE_SHIPPING_ZONEFLATSHOES_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_ZONEFLATSHOES_TEXT_TITLE,
'methods' => array(array('id' => $this->code,
'title' => MODULE_SHIPPING_ZONEFLATSHOES_TEXT_WAY . $gzn,
'cost' => constant('MODULE_SHIPPING_ZONEFLATSHOES_COST_' . $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;
}
function check() {
global $db;
if (!isset($this->_check)) {
$check_query = $db->Execute("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_SHIPPING_ZONEFLATSHOES_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 Flat Shipping', 'MODULE_SHIPPING_ZONEFLATSHOES_STATUS', 'True', 'Do you want to offer flatshoes 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_ZONEFLATSHOESSHOES_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_ZONEFLATSHOES_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_ZONEFLATSHOES_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_ZONEFLATSHOES_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, date_added) values ('Zone " . $i . " Shipping Cost', 'MODULE_SHIPPING_ZONEFLATSHOES_COST_" . $i . "', '5.00', 'The shipping cost for all orders using this shipping method.', '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_ZONEFLATSHOES_STATUS', 'MODULE_SHIPPING_ZONEFLATSHOES_TAX_CLASS', 'MODULE_SHIPPING_ZONEFLATSHOES_TAX_BASIS', 'MODULE_SHIPPING_ZONEFLATSHOES_SORT_ORDER');
for ($i=1; $i<=$this->num_zones; $i++) {
$keys[] = 'MODULE_SHIPPING_ZONEFLATSHOES_ZONE_' . $i;
$keys[] = 'MODULE_SHIPPING_ZONEFLATSHOES_COST_' . $i;
}
return $keys;
}
}
?>
One thing that seems "off" is that when I did the find/replace process on this file with words "flat" and "FLAT", it seems that some of the code above has ZONEFLATSHOES. Im wondering if that is the problem..
Simply put, even after adding these two flatshoes.php files in the appropriate locations, I am still not able to see it when I go to the Shipping Module in admin.
Im currently using Zencart 1.5. Before my upgrade, I did not have any desire to set this up, so I know this has nothing to do with the 1.3.9h>1.5.0 upgrade borking it.
New Zenner
After I clone the Flat Rate module, the checkout page shows multiple fieldsets. Each has a legend (e.g Flat Rate), and then a single option under the legend. How can I get all the options to appear in one fieldset, or at least eliminate the legends?
Oba-san
You might look at the Git repository for Zen Cart v1.6
http://www.zen-cart.com/showthread.php?200316-Zen-Cart-GitHub-Repository
and find the various entries for CHANGE-452 from February and May 2013
and snag the file:
/includes/modules/shipping/storepickup.php
That can be configured for Multiple Locations with/without Price ...
With a little creative configuration and text settings, you could problem make it work the way you need it ...
Or ... you can try to use it as a model for creating your own Multiple Flat Rate ...
Linda McGrath
If you have to think ... you haven't been zenned ...
Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here
Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!
Zen Follower
Great tips here. Worked perfect. Thanks :smile:
New Zenner
If anyone gets this far in the thread...because the OP's (excellent) tutorial doesn't work...
Don't forget to set the permissions of the php files to 644!
It wasn't working for me, then I remembered that my permissions on my newly uploaded files were still 600, so they wouldn't show up in the admin panel.
Oba-san
Thanks for the update ... I have never had new files load with 600 vs 644 but that is good to point out something that does not often occur on uploading a new file ... :smile:
Linda McGrath
If you have to think ... you haven't been zenned ...
Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here
Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!
Tell staff why this post should be reviewed.