Guest Posted February 25, 2003 Share Posted February 25, 2003 I need to offer a store pickup (which will be the flat rate), a table rate delivery, and a local delivery option which is different from that regular table rate. Is there a way for me to add this option? In essence, I'd just want two different table rates with different lables. Link to comment Share on other sites More sharing options...
Guest Posted February 25, 2003 Share Posted February 25, 2003 Make a copy a table.php and call it local.php. Then open and change the refernces to "table" to "local". You will also have to do the same thing with the table.php language file located in catalog/includes/languages/english/shipping. Hope this helps. Let me know if you have any questions. -R Link to comment Share on other sites More sharing options...
Guest Posted February 25, 2003 Share Posted February 25, 2003 Great. Are the changes on the Admin side similar? And will there have to be a database alteration? Mark Link to comment Share on other sites More sharing options...
Guest Posted February 25, 2003 Share Posted February 25, 2003 No database changes are needed. As long as the new "local.php" file resides in catalog/includes/modules/shipping, then when you go to Admin, you should see it. When you activate the new "Local" Shipping module, all of the "Local" info is automatically inserted into the MYSQL DB. When you save the copy of table.php as local.php, when you modify the file, just make sure that wherever there is a reference for the word "table", lower or uppercase, change it to either "local" or "LOCAL". Good luck. -R Link to comment Share on other sites More sharing options...
Guest Posted February 25, 2003 Share Posted February 25, 2003 Great! :D It worked. Wonderful suggestion. Thank you Randy for your input. One note for anyone else trying to do the same... It seems that you can't replace ALL instances of TABLE, because some of them are variables for the database TABLE_CONFIGURATION. Besides looking out for this, it worked great. Link to comment Share on other sites More sharing options...
Guest Posted February 25, 2003 Share Posted February 25, 2003 Excellent! Glad it worked for ya! Good Luck. -R Link to comment Share on other sites More sharing options...
Asikami Posted February 27, 2003 Share Posted February 27, 2003 I think that this way could be great for me too. One note for anyone else trying to do the same... It seems that you can't replace ALL instances of TABLE, because some of them are variables for the database TABLE_CONFIGURATION. As being a newbie in PHP, I'm pretty unsure about mentioned changes in code. Could someone tell me the exact parts to replace (or which to leave alone)? Regards, Mika Link to comment Share on other sites More sharing options...
Guest Posted February 27, 2003 Share Posted February 27, 2003 I'll post exactly the files that I'm using. Here's includes/modules/shipping/local.php <?php /* $Id: local.php,v 1.7 2003/02/10 21:53:45 wilt Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2003 osCommerce Released under the GNU General Public License */ class local { var $code, $title, $description, $icon, $enabled; // class constructor function local() { global $order; $this->code = 'local'; $this->title = MODULE_SHIPPING_LOCAL_TEXT_TITLE; $this->description = MODULE_SHIPPING_LOCAL_TEXT_DESCRIPTION; $this->sort_order = MODULE_SHIPPING_LOCAL_SORT_ORDER; $this->icon = ''; $this->tax_class = MODULE_SHIPPING_LOCAL_TAX_CLASS; // BOF: WebMakers.com Added: Free Payments and Shipping if ( tep_get_free_shipper($this->code) ) { $this->enabled = ((MODULE_SHIPPING_LOCAL_STATUS == 'True') ? true : false); } if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_LOCAL_ZONE > 0) ) { $check_flag = false; $check_query = tep_db_query("select zone_id from " . LOCAL_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_SHIPPING_LOCAL_ZONE . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' order by zone_id"); while ($check = tep_db_fetch_array($check_query)) { if ($check['zone_id'] < 1) { $check_flag = true; break; } elseif ($check['zone_id'] == $order->delivery['zone_id']) { $check_flag = true; break; } } if ($check_flag == false) { $this->enabled = false; } } } // class methods function quote($method = '') { global $order, $cart, $shipping_weight, $shipping_num_boxes; if (MODULE_SHIPPING_LOCAL_MODE == 'price') { $order_total = $cart->show_total(); } else { $order_total = $shipping_weight; } $local_cost = split("[:,]" , MODULE_SHIPPING_LOCAL_COST); $size = sizeof($local_cost); for ($i=0, $n=$size; $i<$n; $i+=2) { if ($order_total <= $local_cost[$i]) { $shipping = $local_cost[$i+1]; break; } } if (MODULE_SHIPPING_LOCAL_MODE == 'weight') { $shipping = $shipping * $shipping_num_boxes; } $this->quotes = array('id' => $this->code, 'module' => MODULE_SHIPPING_LOCAL_TEXT_TITLE, 'methods' => array(array('id' => $this->code, 'title' => MODULE_SHIPPING_LOCAL_TEXT_WAY, 'cost' => $shipping + MODULE_SHIPPING_LOCAL_HANDLING))); if ($this->tax_class > 0) { $this->quotes['tax'] = tep_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']); } if (tep_not_null($this->icon)) $this->quotes['icon'] = tep_image($this->icon, $this->title); return $this->quotes; } function check() { if (!isset($this->_check)) { $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_SHIPPING_LOCAL_STATUS'"); $this->_check = tep_db_num_rows($check_query); } return $this->_check; } function install() { tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Enable Local Delivery', 'MODULE_SHIPPING_LOCAL_STATUS', 'True', 'Do you want to offer local delivery?', '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, date_added) values ('Local Delivery Table', 'MODULE_SHIPPING_LOCAL_COST', '25:8.50,50:5.50,10000:0.00', 'The shipping cost is based on the total cost or weight of items. Example: 25:8.50,50:5.50,etc.. Up to 25 charge 8.50, from there to 50 charge 5.50, etc', '6', '0', 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 ('Local Delivery Table', 'MODULE_SHIPPING_LOCAL_MODE', 'weight', 'The shipping cost is based on the order total or the total weight of the items ordered.', '6', '0', 'tep_cfg_select_option(array('weight', 'price'), ', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Handling Fee', 'MODULE_SHIPPING_LOCAL_HANDLING', '0', 'Handling fee for this shipping method.', '6', '0', 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_LOCAL_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, use_function, set_function, date_added) values ('Shipping Zone', 'MODULE_SHIPPING_LOCAL_ZONE', '0', 'If a zone is selected, only enable this shipping method for that zone.', '6', '0', 'tep_get_zone_class_title', 'tep_cfg_pull_down_zone_classes(', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_SHIPPING_LOCAL_SORT_ORDER', '0', 'Sort order of display.', '6', '0', now())"); } function remove() { tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')"); } function keys() { return array('MODULE_SHIPPING_LOCAL_STATUS', 'MODULE_SHIPPING_LOCAL_COST', 'MODULE_SHIPPING_LOCAL_MODE', 'MODULE_SHIPPING_LOCAL_HANDLING', 'MODULE_SHIPPING_LOCAL_TAX_CLASS', 'MODULE_SHIPPING_LOCAL_ZONE', 'MODULE_SHIPPING_LOCAL_SORT_ORDER'); } } ?> And here's includes/launguages/english/modules/shipping/local.php <?php /* $Id: table.php,v 1.1.1.1 2002/11/28 23:22:08 wilt Exp $ The Exchange Project - Community Made Shopping! http://www.theexchangeproject.org Copyright (c) 2000,2001 The Exchange Project Released under the GNU General Public License define('MODULE_SHIPPING_TABLE_TEXT_TITLE', 'Local Delivery'); define('MODULE_SHIPPING_TABLE_TEXT_DESCRIPTION', 'Local Delivery'); define('MODULE_SHIPPING_TABLE_TEXT_WAY', 'Best Way'); define('MODULE_SHIPPING_TABLE_TEXT_WEIGHT', 'Weight'); define('MODULE_SHIPPING_TABLE_TEXT_AMOUNT', 'Amount'); */ define('MODULE_SHIPPING_LOCAL_TEXT_TITLE', 'Local Delivery'); define('MODULE_SHIPPING_LOCAL_TEXT_DESCRIPTION', 'Local Delivery'); define('MODULE_SHIPPING_LOCAL_TEXT_WAY', 'Best Way'); define('MODULE_SHIPPING_LOCAL_TEXT_WEIGHT', 'Weight'); define('MODULE_SHIPPING_LOCAL_TEXT_AMOUNT', 'Amount'); ?> Hope this helps. Mark Link to comment Share on other sites More sharing options...
Asikami Posted February 28, 2003 Share Posted February 28, 2003 Thanks Mark! You've just become my personal hero :D I tried your instructions and first it didn't work after find/replace -modification. Then I tried to change the lines manually and same time I changed the tablename to 5 digits (before there was 7) . After that it worked smoothly. Not sure which one did the trick, but now it works. All the best, Mika Link to comment Share on other sites More sharing options...
Guest Posted February 28, 2003 Share Posted February 28, 2003 Great. I'm glad it's working. And more importantly, I'm glad to have a new personal fan club in Finland! :D Link to comment Share on other sites More sharing options...
greytek Posted April 12, 2003 Share Posted April 12, 2003 I followed the instructions in this post to create a local.php in my modules folder in both includes/modules/shipping and includes/languages/english/modules/shipping. When I did this and went to modules/shipping in my admin screen, all choices except flat rate and table were gone! :shock: No there is no way for me to enable the pickup! when I deleted the local.php files, all my options came back. what could I have done wrong? Greyson Schwing Link to comment Share on other sites More sharing options...
Guest Posted April 12, 2003 Share Posted April 12, 2003 Could you post your local.php file that you created? -R Link to comment Share on other sites More sharing options...
greytek Posted April 12, 2003 Share Posted April 12, 2003 I copied and pasted from the previous post in this thread. <?php /* $Id: local.php,v 1.7 2003/02/10 21:53:45 wilt Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2003 osCommerce Released under the GNU General Public License */ class local { var $code, $title, $description, $icon, $enabled; // class constructor function local() { global $order; $this->code = 'local'; $this->title = MODULE_SHIPPING_LOCAL_TEXT_TITLE; $this->description = MODULE_SHIPPING_LOCAL_TEXT_DESCRIPTION; $this->sort_order = MODULE_SHIPPING_LOCAL_SORT_ORDER; $this->icon = ''; $this->tax_class = MODULE_SHIPPING_LOCAL_TAX_CLASS; // BOF: WebMakers.com Added: Free Payments and Shipping if ( tep_get_free_shipper($this->code) ) { $this->enabled = ((MODULE_SHIPPING_LOCAL_STATUS == 'True') ? true : false); } if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_LOCAL_ZONE > 0) ) { $check_flag = false; $check_query = tep_db_query("select zone_id from " . LOCAL_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_SHIPPING_LOCAL_ZONE . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' order by zone_id"); while ($check = tep_db_fetch_array($check_query)) { if ($check['zone_id'] < 1) { $check_flag = true; break; } elseif ($check['zone_id'] == $order->delivery['zone_id']) { $check_flag = true; break; } } if ($check_flag == false) { $this->enabled = false; } } } // class methods function quote($method = '') { global $order, $cart, $shipping_weight, $shipping_num_boxes; if (MODULE_SHIPPING_LOCAL_MODE == 'price') { $order_total = $cart->show_total(); } else { $order_total = $shipping_weight; } $local_cost = split("[:,]" , MODULE_SHIPPING_LOCAL_COST); $size = sizeof($local_cost); for ($i=0, $n=$size; $i<$n; $i+=2) { if ($order_total <= $local_cost[$i]) { $shipping = $local_cost[$i+1]; break; } } if (MODULE_SHIPPING_LOCAL_MODE == 'weight') { $shipping = $shipping * $shipping_num_boxes; } $this->quotes = array('id' => $this->code, 'module' => MODULE_SHIPPING_LOCAL_TEXT_TITLE, 'methods' => array(array('id' => $this->code, 'title' => MODULE_SHIPPING_LOCAL_TEXT_WAY, 'cost' => $shipping + MODULE_SHIPPING_LOCAL_HANDLING))); if ($this->tax_class > 0) { $this->quotes['tax'] = tep_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']); } if (tep_not_null($this->icon)) $this->quotes['icon'] = tep_image($this->icon, $this->title); return $this->quotes; } function check() { if (!isset($this->_check)) { $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_SHIPPING_LOCAL_STATUS'"); $this->_check = tep_db_num_rows($check_query); } return $this->_check; } function install() { tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Enable Local Delivery', 'MODULE_SHIPPING_LOCAL_STATUS', 'True', 'Do you want to offer local delivery?', '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, date_added) values ('Local Delivery Table', 'MODULE_SHIPPING_LOCAL_COST', '25:8.50,50:5.50,10000:0.00', 'The shipping cost is based on the total cost or weight of items. Example: 25:8.50,50:5.50,etc.. Up to 25 charge 8.50, from there to 50 charge 5.50, etc', '6', '0', 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 ('Local Delivery Table', 'MODULE_SHIPPING_LOCAL_MODE', 'weight', 'The shipping cost is based on the order total or the total weight of the items ordered.', '6', '0', 'tep_cfg_select_option(array('weight', 'price'), ', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Handling Fee', 'MODULE_SHIPPING_LOCAL_HANDLING', '0', 'Handling fee for this shipping method.', '6', '0', 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_LOCAL_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, use_function, set_function, date_added) values ('Shipping Zone', 'MODULE_SHIPPING_LOCAL_ZONE', '0', 'If a zone is selected, only enable this shipping method for that zone.', '6', '0', 'tep_get_zone_class_title', 'tep_cfg_pull_down_zone_classes(', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_SHIPPING_LOCAL_SORT_ORDER', '0', 'Sort order of display.', '6', '0', now())"); } function remove() { tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')"); } function keys() { return array('MODULE_SHIPPING_LOCAL_STATUS', 'MODULE_SHIPPING_LOCAL_COST', 'MODULE_SHIPPING_LOCAL_MODE', 'MODULE_SHIPPING_LOCAL_HANDLING', 'MODULE_SHIPPING_LOCAL_TAX_CLASS', 'MODULE_SHIPPING_LOCAL_ZONE', 'MODULE_SHIPPING_LOCAL_SORT_ORDER'); } } ?> and <?php /* $Id: table.php,v 1.1.1.1 2002/11/28 23:22:08 wilt Exp $ The Exchange Project - Community Made Shopping! http://www.theexchangeproject.org Copyright (c) 2000,2001 The Exchange Project Released under the GNU General Public License define('MODULE_SHIPPING_TABLE_TEXT_TITLE', 'Local Delivery'); define('MODULE_SHIPPING_TABLE_TEXT_DESCRIPTION', 'Local Delivery'); define('MODULE_SHIPPING_TABLE_TEXT_WAY', 'Best Way'); define('MODULE_SHIPPING_TABLE_TEXT_WEIGHT', 'Weight'); define('MODULE_SHIPPING_TABLE_TEXT_AMOUNT', 'Amount'); */ define('MODULE_SHIPPING_LOCAL_TEXT_TITLE', 'Local Delivery'); define('MODULE_SHIPPING_LOCAL_TEXT_DESCRIPTION', 'Local Delivery'); define('MODULE_SHIPPING_LOCAL_TEXT_WAY', 'Best Way'); define('MODULE_SHIPPING_LOCAL_TEXT_WEIGHT', 'Weight'); define('MODULE_SHIPPING_LOCAL_TEXT_AMOUNT', 'Amount'); ?> Greyson Schwing Link to comment Share on other sites More sharing options...
Guest Posted April 12, 2003 Share Posted April 12, 2003 This section of code... if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_LOCAL_ZONE > 0) ) { $check_flag = false; $check_query = tep_db_query("select zone_id from " . LOCAL_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_SHIPPING_LOCAL_ZONE . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' order by zone_id"); should be... if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_LOCAL_ZONE > 0) ) { $check_flag = false; $check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_SHIPPING_LOCAL_ZONE . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' order by zone_id"); Hope that solves it. -R Link to comment Share on other sites More sharing options...
greytek Posted April 13, 2003 Share Posted April 13, 2003 Did not work :( thanks for trying. Any other suggestions? Greyson Schwing Link to comment Share on other sites More sharing options...
Guest Posted April 13, 2003 Share Posted April 13, 2003 I would have to look at it to know anything further. PM me and I see what I can do. -R Link to comment Share on other sites More sharing options...
crshNbrn Posted May 15, 2003 Share Posted May 15, 2003 Does it not depend on whats in the sql db? //if ( tep_get_free_shipper($this->code) ) { $this->enabled = ((MODULE_SHIPPING_LOCAL_STATUS == 'True') ? true : false); //} seemed to fix it for me Regards crshNbrn crshNbrn living on the edge..... Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.