tigergirl Posted April 10, 2009 Posted April 10, 2009 Hi, I'd like to add a shipping option which will allow the customer to be charged a maximum shipping cost of say £5.00 if they spend over £60 on products. I'd like to keep the ot_shipping module for free shipping over £100. I'm using [CONTRIB] UK Royal Mail & Overseas Shipping Methods as well and want to keep that in place for lower value orders. I've seen sites with a message on the basket saying "spend £x.xx to qualify for free shipping" - not essential for now but would be nice to do! I have tried searching but can't find anything suitable. Anyone able to help or recommend a contrib? Many thanks Tigergirl Quote I'm feeling lucky today......maybe someone will answer my post! I do try and answer a simple post when I can just to give something back. ------------------------------------------------ PM me? - I'm not for hire
tigergirl Posted April 10, 2009 Author Posted April 10, 2009 Hi, RM modules do currently disappear when free shipping kicks in at >£100.00 Think it would be good to alter ot_shipping. Had a look at ot_shipping but not sure how to code this Small recode of ot_shipping to kick in a 5 charge if >=60 AND <100 I found Contrib ot_shipping enhancement but it does not look right in admin and does not switch off RM modules which is disapointing. It has CCGV mods in the file which I do not have so it maybe hasn't been coded well. I removed it for now. I'll have a look at the clubosc page later if I get this up and running. Can you help? Thanks Tigergirl Quote I'm feeling lucky today......maybe someone will answer my post! I do try and answer a simple post when I can just to give something back. ------------------------------------------------ PM me? - I'm not for hire
tigergirl Posted May 20, 2009 Author Posted May 20, 2009 I managed to find a contribution for a shipping module that seems like it mostly does the job (after trying many other things) One thing left to fix - can't get it to switch off if order total is less than £60. I'm trying to use this code: if ($order->info['total'] < 60) { // If total ship cart price is below £60 do not show this shipping method $this->enabled = false; } But I think I'm putting it in the wrong place - DOH! Here's the file inc/mod/shipping/eco.php: <?php /* $Id: eco.php,v 1.27 2003/02/05 22:41:52 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2003 osCommerce Released under the GNU General Public License */ class eco { var $code, $title, $description, $icon, $enabled; // class constructor function eco() { global $order; $this->code = 'eco'; $this->title = MODULE_SHIPPING_ECO_TEXT_TITLE; $this->description = MODULE_SHIPPING_ECO_TEXT_DESCRIPTION; $this->sort_order = MODULE_SHIPPING_ECO_SORT_ORDER; $this->icon = ''; $this->tax_class = MODULE_SHIPPING_ECO_TAX_CLASS; $this->enabled = ((MODULE_SHIPPING_ECO_STATUS == 'True') ? true : false); if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_ECO_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_ECO_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_ECO_MODE == 'price') { $order_total = $cart->show_total(); } else { $order_total = $shipping_weight; } $eco_cost = split("[:,]" , MODULE_SHIPPING_ECO_COST); $size = sizeof($eco_cost); for ($i=0, $n=$size; $i<$n; $i+=2) { if ($order_total <= $eco_cost[$i]) { $shipping = $eco_cost[$i+1]; break; } } if (MODULE_SHIPPING_ECO_MODE == 'weight') { $shipping = $shipping * $shipping_num_boxes; } $this->quotes = array('id' => $this->code, 'module' => MODULE_SHIPPING_ECO_TEXT_TITLE, 'methods' => array(array('id' => $this->code, 'title' => MODULE_SHIPPING_ECO_TEXT_WAY, 'cost' => $shipping + MODULE_SHIPPING_ECO_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_ECO_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 Table Method', 'MODULE_SHIPPING_ECO_STATUS', 'True', 'Do you want to offer 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, date_added) values ('Shipping Table', 'MODULE_SHIPPING_ECO_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 ('Table Method', 'MODULE_SHIPPING_ECO_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_ECO_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_ECO_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_ECO_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_ECO_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_ECO_STATUS', 'MODULE_SHIPPING_ECO_COST', 'MODULE_SHIPPING_ECO_MODE', 'MODULE_SHIPPING_ECO_HANDLING', 'MODULE_SHIPPING_ECO_TAX_CLASS', 'MODULE_SHIPPING_ECO_ZONE', 'MODULE_SHIPPING_ECO_SORT_ORDER'); } } ?> Please can someone tell me where to insert my code? Or the correct way to code it? I'm sure that's easy peasy - just not for me :( The contrib is Shipping prices by order total if anyone else wants to use Thanks so much Tigergirl Quote I'm feeling lucky today......maybe someone will answer my post! I do try and answer a simple post when I can just to give something back. ------------------------------------------------ PM me? - I'm not for hire
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.
Note: Your post will require moderator approval before it will be visible.