Peper Posted June 14, 2013 Share Posted June 14, 2013 I'm trying to update a delivery option file thats got 2 x depreciated functions but is failing terribly. It seems easy enough to replace the function but is not working correctly Lines 36 and 69 needs updating Any help will be appreciated <?php /* $Id: dly.php,v 1.2 2004/11/18 16:29:56 ChBu Exp $ Released under the GNU General Public License */ class dlyc { var $code, $title, $description, $icon, $enabled; // class constructor function dlyc() { global $order; $this->code = 'dlyc'; $this->title = MODULE_SHIPPING_DLYC_TEXT_TITLE; $this->description = MODULE_SHIPPING_DLYC_TEXT_DESCRIPTION; $this->tax_class = MODULE_SHIPPING_DLYC_TAX_CLASS; $this->sort_order = MODULE_SHIPPING_DLYC_SORT_ORDER; $this->icon = DIR_WS_ICONS . 'shipping_dly.gif'; // To remove icon change this line to: $this->icon = ''; $this->enabled = MODULE_SHIPPING_DLYC_STATUS; // Beg Minimum Order Total required to activate module $this->min_order = MODULE_SHIPPING_DLYC_MINIMUM_ORDER_TOTAL; if ( ($order->info['total']) < ($this->min_order) ) { $this->enabled = false; } // End Minimum Order Total required to activate module if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_DLYC_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_DLYC_ZONE . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' order by zone_id"); //$city=split (',',MODULE_SHIPPING_DLYC_CITY); $zip_up = MODULE_SHIPPING_DLYC_CITY; $zip_up = strtoupper($zip_up); $zip_up = str_replace (' ', '', $zip_up); $city = split (',', $zip_up); $order->delivery['city'] = strtoupper($order->delivery['city']); $order->delivery['city'] = str_replace (' ', '', $order->delivery['city']); while ($check = tep_db_fetch_array($check_query)) { if ($check['zone_id'] < 1) { if ((in_array($order->delivery['city'],$city )) or (MODULE_SHIPPING_DLYC_CITY=='')) $check_flag = true; break; } elseif ($check['zone_id'] == $order->delivery['zone_id']) { if ((in_array($order->delivery['city'],$city )or (MODULE_SHIPPING_DLYC_CITY==''))) $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_DLYC_MODE == 'price') { $order_total = $cart->show_total(); } else { $order_total = $shipping_weight; } $table_cost = split("[:,]" , MODULE_SHIPPING_DLYC_COST); $shipping_rate = 0; $size = sizeof($table_cost); for ($i=0, $n=$size; $i<$n; $i+=2) { if ($order_total <= $table_cost[$i]) { $shipping_rate = $table_cost[$i+1]; break; } } if (MODULE_SHIPPING_DLYC_MODE == 'weight') { $shipping_rate = $shipping_rate * $shipping_num_boxes; } $this->quotes = array('id' => $this->code, 'module' => MODULE_SHIPPING_DLYC_TEXT_TITLE, 'methods' => array(array('id' => $this->code, 'title' => MODULE_SHIPPING_DLYC_TEXT_WAY, 'cost' => $shipping_rate))); if (tep_not_null($this->icon)) $this->quotes['icon'] = tep_image($this->icon, $this->title); if ($this->tax_class > 0) { $this->quotes['tax'] = tep_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']); } 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_DLYC_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, date_added) values ('Enable City Delivery', 'MODULE_SHIPPING_DLYC_STATUS', '1', 'Do you want to offer City Delivery?', '6', '5', now())"); // BOF Determine if costs table is based on price or weight 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 ('Delivery Cost Method', 'MODULE_SHIPPING_DLYC_MODE', 'weight', 'The delivery cost is based on the order total or the total weight of the items ordered.', '6', '2', 'tep_cfg_select_option(array(\'weight\', \'price\'), ', now())"); // EOF Determine if costs table is based on price or weight 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 Cost', 'MODULE_SHIPPING_DLYC_COST', '25:8.50,50:5.50,10000:0.00', 'The delivery 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. Be aware: The Handling fee will NOT be added.', '6', '4', 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_DLYC_TAX_CLASS', '0', 'Use the following Tax Class on the Shipping Fee.', '6', '6', 'tep_get_tax_class_title', 'tep_cfg_pull_down_tax_classes(', now())"); // Beg Minimum Order Total required to activate module tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Minimum Order Total', 'MODULE_SHIPPING_DLYC_MINIMUM_ORDER_TOTAL', '0.00', 'What is the Minimum Order Total required for this option to be activated.', '6', '7', now())"); // End Minimum Order Total required to activate module tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Maximum Local Delivery Distance', 'MODULE_SHIPPING_DLYC_MAX_LOCAL_DISTANCE', '12 Km', 'What is the Maximum Local delivery distance which you will travel to deliver orders. [ ie. 12 Km ]', '6', '10', now())"); // Begin City tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('City', 'MODULE_SHIPPING_DLYC_CITY', '', 'Only enable this shipping method for these cities. Separate with comma if several, empty if all.', '6', '7', now())"); // End City 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_DLYC_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_DLYC_SORT_ORDER', '3', '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_DLYC_STATUS', // Begin costs method 'MODULE_SHIPPING_DLYC_MODE', // End cost method 'MODULE_SHIPPING_DLYC_COST', 'MODULE_SHIPPING_DLYC_TAX_CLASS', // Beg Minimum Order Total required to activate module 'MODULE_SHIPPING_DLYC_MINIMUM_ORDER_TOTAL', // End Minimum Order Total required to activate module 'MODULE_SHIPPING_DLYC_MAX_LOCAL_DISTANCE', // Begin City 'MODULE_SHIPPING_DLYC_CITY', // End City 'MODULE_SHIPPING_DLYC_SORT_ORDER', 'MODULE_SHIPPING_DLYC_ZONE'); } } ?> Quote Getting the Phoenix off the ground Link to comment Share on other sites More sharing options...
Peper Posted June 14, 2013 Author Share Posted June 14, 2013 Solved, thanks Burt - line 36 changed to $city = preg_split ('/,/', $zip_up); line 69 changed to $table_cost = preg_split("/[:,]/" , MODULE_SHIPPING_DLYC_COST); felix-swiss 1 Quote Getting the Phoenix off the ground 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.