RudyC Posted June 18, 2007 Share Posted June 18, 2007 Hey guys, I'm writing a shipping module and have uploaded the files to the relevant places: catalog\includes\languages\english\modules\shipping\sservices.php catalog\includes\modules\shipping\sservices.php It's a basic module which has 1-10kg rates, including handing fees and packaging rate per kg. The problem is that I cannot see the module in the list of shipping modules on the admin page. It just refuses to show up. Can any1 else try installing it or possibly look at the code? I cannot find any errors in it??? Thanks RudyC Here's the file: catalog\includes\modules\shipping\sservices.php <?php /* $Id: sservices.php,v 1.0 2007/06/08 RudyC Exp $ Catalog Side / Includes / Modules / Shipping osCommerce, Open Source E-Commerce Solutions [url="http://www.oscommerce.com"]http://www.oscommerce.com[/url] Copyright © 2007 RudyC for osCommerce Released under the GNU General Public License */ class speedservices { var $code, $title, $description, $enabled; // constructor function speedservices() { $this->code = 'speedservices'; $this->title = MODULE_SHIPPING_SA_SPEEDSERVICES_TEXT_TITLE; $this->description = MODULE_SHIPPING_SA_SPEEDSERVICES_TEXT_DESCRIPTION; $this->sort_order = MODULE_SHIPPING_SA_SPEEDSERVICES_SORT_ORDER; $this->icon = ''; $this->tax_class = MODULE_SHIPPING_SA_SPEEDSERVICES_TAX_CLASS; $this->enabled = ((MODULE_SHIPPING_SA_SPEEDSERVICES_STATUS == 'True') ? true : false); } function quote($method = '') { global $order, $shipping_weight; $error = false; $dest_country = $order->delivery['country']['iso_code_2']; if ($dest_country != 'ZA') { return false; } //if the weight is greater than 10kgs then they need to contact us to arrange for a delivery if ($shipping_weight > MODULE_SHIPPING_SA_SPEEDSERVICES_MAX_WEIGHT) { $this->quotes = array('id' => $this->code, 'module' => MODULE_SHIPPING_SA_SPEEDSERVICES_TEXT_TITLE, 'methods' => array(array('title' => $this->quotes['error']))); $this->quotes['error'] = $shipping_weight . ' ' . MODULE_SHIPPING_SA_SPEEDSERVICES_TEXT_UNITS . ' ' . MODULE_SHIPPING_SA_SPEEDSERVICES_EXCEEDED_WEIGHT . ' ' . MODULE_SHIPPING_SA_SPEEDSERVICES_MAX_WEIGHT . ' ' . MODULE_SHIPPING_SA_SPEEDSERVICES_TEXT_UNITS; return $this->quotes; } if ($shipping_weight <= MODULE_SHIPPING_SA_SPEEDSERVICES_MAX_WEIGHT) { $shipping_cost = 0; $shipping_method = ''; $order_total = $order->info['total']; if (($shipping_weight > 0) && ($shipping_weight <= 1000)) { $shipping_cost += MODULE_SHIPPING_SA_SPEEDSERVICES_1KG_RATE; $shipping_cost += MODULE_SHIPPING_SA_SPEEDSERVICES_1KG_PACKAGING_COST; } if (($shipping_weight > 1000) && ($shipping_weight <= 2000)) { $shipping_cost += MODULE_SHIPPING_SA_SPEEDSERVICES_2KG_RATE; $shipping_cost += MODULE_SHIPPING_SA_SPEEDSERVICES_2KG_PACKAGING_COST; } if (($shipping_weight > 2000) && ($shipping_weight <= 3000)) { $shipping_cost += MODULE_SHIPPING_SA_SPEEDSERVICES_3KG_RATE; $shipping_cost += MODULE_SHIPPING_SA_SPEEDSERVICES_3KG_PACKAGING_COST; } if (($shipping_weight > 3000) && ($shipping_weight <= 4000)) { $shipping_cost += MODULE_SHIPPING_SA_SPEEDSERVICES_4KG_RATE; $shipping_cost += MODULE_SHIPPING_SA_SPEEDSERVICES_4KG_PACKAGING_COST; } if (($shipping_weight > 4000) && ($shipping_weight <= 5000)) { $shipping_cost += MODULE_SHIPPING_SA_SPEEDSERVICES_5KG_RATE; $shipping_cost += MODULE_SHIPPING_SA_SPEEDSERVICES_5KG_PACKAGING_COST; } if (($shipping_weight > 5000) && ($shipping_weight <= 6000)) { $shipping_cost += MODULE_SHIPPING_SA_SPEEDSERVICES_6KG_RATE; $shipping_cost += MODULE_SHIPPING_SA_SPEEDSERVICES_6KG_PACKAGING_COST; } if (($shipping_weight > 6000) && ($shipping_weight <= 7000)) { $shipping_cost += MODULE_SHIPPING_SA_SPEEDSERVICES_7KG_RATE; $shipping_cost += MODULE_SHIPPING_SA_SPEEDSERVICES_7KG_PACKAGING_COST; } if (($shipping_weight > 7000) && ($shipping_weight <= 8000)) { $shipping_cost += MODULE_SHIPPING_SA_SPEEDSERVICES_8KG_RATE; $shipping_cost += MODULE_SHIPPING_SA_SPEEDSERVICES_8KG_PACKAGING_COST; } if (($shipping_weight > 8000) && ($shipping_weight <= 9000)) { $shipping_cost += MODULE_SHIPPING_SA_SPEEDSERVICES_9KG_RATE; $shipping_cost += MODULE_SHIPPING_SA_SPEEDSERVICES_9KG_PACKAGING_COST; } if (($shipping_weight > 9000) && ($shipping_weight <= 10000)) { $shipping_cost += MODULE_SHIPPING_SA_SPEEDSERVICES_10KG_RATE; $shipping_cost += MODULE_SHIPPING_SA_SPEEDSERVICES_10KG_PACKAGING_COST; } $shipping_cost += MODULE_SHIPPING_SA_SPEEDSERVICES_HANDLING_FEE; $shipping_method .= MODULE_SHIPPING_SA_SPEEDSERVICES_TEXT_WAY . ' ' . $shipping_weight . ' ' . MODULE_SHIPPING_SA_SPEEDSERVICES_TEXT_UNITS . ' - ' . MODULE_SHIPPING_SA_SPEEDSERVICES_TEXT_DELIVERYTIME; } $this->quotes = array( 'id' => $this->code, 'module' => MODULE_SHIPPING_SA_SPEEDSERVICES_TEXT_TITLE, 'methods' => array( array( # 'id' => $this->code, 'id' => $method, 'title' => $shipping_method, 'cost' => $shipping_cost))); 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); if ($error == true) $this->quotes['error'] = MODULE_SHIPPING_SA_SPEEDSERVICES_INVALID_ZONE; 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_SA_SPEEDSERVICES_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 SA Speed Services Post', 'MODULE_SHIPPING_SA_SPEEDSERVICES_STATUS', 'True', 'Do you want to offer South African Speed Services (Counter to Counter) 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 ('Sort order of display.', 'MODULE_SHIPPING_SA_SPEEDSERVICES_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '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_SA_SPEEDSERVICES_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 ('1kg Shipping Rate', 'MODULE_SHIPPING_SA_SPEEDSERVICES_1KG_RATE', '49.16', '1kg base rate. Example: 49.16', '6', '5', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('1kg packaging cost', 'MODULE_SHIPPING_SA_SPEEDSERVICES_1KG_PACKAGING_COST', '0', '1kg packaging rate. Example: 4', '6', '5', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('2kg Shipping Rate', 'MODULE_SHIPPING_SA_SPEEDSERVICES_2KG_RATE', '68.64', '2kg base rate. Example: 68.64', '6', '5', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('2kg packaging cost', 'MODULE_SHIPPING_SA_SPEEDSERVICES_2KG_PACKAGING_COST', '0', '2kg packaging rate. Example: 5', '6', '5', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('3kg Shipping Rate', 'MODULE_SHIPPING_SA_SPEEDSERVICES_3KG_RATE', '83.62', '3kg base rate. Example: 83.62', '6', '5', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('3kg packaging cost', 'MODULE_SHIPPING_SA_SPEEDSERVICES_3KG_PACKAGING_COST', '0', '3kg packaging rate. Example: 6', '6', '5', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('4kg Shipping Rate', 'MODULE_SHIPPING_SA_SPEEDSERVICES_4KG_RATE', '104.96', '4kg base rate. Example: 104.96', '6', '5', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('4kg packaging cost', 'MODULE_SHIPPING_SA_SPEEDSERVICES_4KG_PACKAGING_COST', '0', '4kg packaging rate. Example: 4', '6', '5', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('5kg Shipping Rate', 'MODULE_SHIPPING_SA_SPEEDSERVICES_5KG_RATE', '125.73', '5kg base rate. Example: 125.73', '6', '5', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('5kg packaging cost', 'MODULE_SHIPPING_SA_SPEEDSERVICES_5KG_PACKAGING_COST', '0', '5kg packaging rate. Example: 5', '6', '5', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('6kg Shipping Rate', 'MODULE_SHIPPING_SA_SPEEDSERVICES_6KG_RATE', '147.66', '5kg base rate. Example: 147.66', '6', '5', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('6kg packaging cost', 'MODULE_SHIPPING_SA_SPEEDSERVICES_6KG_PACKAGING_COST', '0', '6kg packaging rate. Example: 6', '6', '5', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('7kg Shipping Rate', 'MODULE_SHIPPING_SA_SPEEDSERVICES_7KG_RATE', '169.60', '7kg base rate. Example: 169.60', '6', '5', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('7kg packaging cost', 'MODULE_SHIPPING_SA_SPEEDSERVICES_7KG_PACKAGING_COST', '0', '7kg packaging rate. Example: 4', '6', '5', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('8kg Shipping Rate', 'MODULE_SHIPPING_SA_SPEEDSERVICES_8KG_RATE', '191.53', '8kg base rate. Example: 191.53', '6', '5', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('8kg packaging cost', 'MODULE_SHIPPING_SA_SPEEDSERVICES_8KG_PACKAGING_COST', '0', '8kg packaging rate. Example: 5', '6', '5', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('9kg Shipping Rate', 'MODULE_SHIPPING_SA_SPEEDSERVICES_9KG_RATE', '213.47', '9kg base rate. Example: 213.47', '6', '5', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('9kg packaging cost', 'MODULE_SHIPPING_SA_SPEEDSERVICES_9KG_PACKAGING_COST', '0', '9kg packaging rate. Example: 6', '6', '5', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('10kg Shipping Rate', 'MODULE_SHIPPING_SA_SPEEDSERVICES_10KG_RATE', '235.40', '10kg base rate. Example: 235.40', '6', '5', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('10kg packaging cost', 'MODULE_SHIPPING_SA_SPEEDSERVICES_10KG_PACKAGING_COST', '0', '10kg packaging rate. Example: 6', '6', '5', 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_SA_SPEEDSERVICES_HANDLING_FEE', '0', 'Handling Fee for SA Speed Services', '6', '1', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Maximum weight for Speed Services.', 'MODULE_SHIPPING_SA_SPEEDSERVICES_MAX_WEIGHT', '10000', 'Maximum weight for Speed Services.', '6', '5', now())"); } function remove() { tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')"); } function keys() { $keys = array('MODULE_SHIPPING_SA_SPEEDSERVICES_STATUS','MODULE_SHIPPING_SA_SPEEDSERVICES_SORT_ORDER','MODULE_SHIPPING_SA_SPEEDSERVICES_TAX_CLASS','MODULE_SHIPPING_SA_SPEEDSERVICES_HANDLING_FEE','MODULE_SHIPPING_SA_SPEEDSERVICES_1KG_RATE','MODULE_SHIPPING_SA_SPEEDSERVICES_1KG_PACKAGING_COST','MODULE_SHIPPING_SA_SPEEDSERVICES_2KG_RATE','MODULE_SHIPPING_SA_SPEEDSERVICES_2KG_PACKAGING_COST','MODULE_SHIPPING_SA_SPEEDSERVICES_3KG_RATE','MODULE_SHIPPING_SA_SPEEDSERVICES_3KG_PACKAGING_COST','MODULE_SHIPPING_SA_SPEEDSERVICES_4KG_RATE','MODULE_SHIPPING_SA_SPEEDSERVICES_4KG_PACKAGING_COST','MODULE_SHIPPING_SA_SPEEDSERVICES_5KG_RATE','MODULE_SHIPPING_SA_SPEEDSERVICES_5KG_PACKAGING_COST','MODULE_SHIPPING_SA_SPEEDSERVICES_6KG_RATE','MODULE_SHIPPING_SA_SPEEDSERVICES_6KG_PACKAGING_COST','MODULE_SHIPPING_SA_SPEEDSERVICES_7KG_RATE','MODULE_SHIPPING_SA_SPEEDSERVICES_7KG_PACKAGING_COST','MODULE_SHIPPING_SA_SPEEDSERVICES_8KG_RATE','MODULE_SHIPPING_SA_SPEEDSERVICES_8KG_PACKAGING_COST','MODULE_SHIPPING_SA_SPEEDSERVICES_9KG_RATE','MODULE_SHIPPING_SA_SPEEDSERVICES_9KG_PACKAGING_COST','MODULE_SHIPPING_SA_SPEEDSERVICES_10KG_RATE','MODULE_SHIPPING_SA_SPEEDSERVICES_10KG_PACKAGING_COST','MODULE_SHIPPING_SA_SPEEDSERVICES_MAX_WEIGHT'); return $keys; } } ?> And here's the other file: catalog\includes\languages\english\modules\shipping\sservices.php <?php /* $Id: sservices.php,v 1.0 2007/06/08 RudyC Exp $ Catalog Side / Includes / LANGUAGES / Modules / Shipping osCommerce, Open Source E-Commerce Solutions [url="http://www.oscommerce.com"]http://www.oscommerce.com[/url] Copyright © 2007 RudyC for osCommerce Released under the GNU General Public License */ define('MODULE_SHIPPING_SA_SPEEDSERVICES_TEXT_TITLE', 'SA Speed Services Delivery'); define('MODULE_SHIPPING_SA_SPEEDSERVICES_TEXT_DESCRIPTION', 'SA Speed Services (Domestic) Post Rates'); define('MODULE_SHIPPING_SA_SPEEDSERVICES_TEXT_WAY', 'Speed Services Counter to Counter:'); define('MODULE_SHIPPING_SA_SPEEDSERVICES_TEXT_DELIVERYTIME', '(delivery in 1-2 business days)'); define('MODULE_SHIPPING_SA_SPEEDSERVICES_TEXT_UNITS', 'g'); define('MODULE_SHIPPING_SA_SPEEDSERVICES_INVALID_ZONE', 'Speed Services shipping only available in South Africa.'); define('MODULE_SHIPPING_SA_SPEEDSERVICES_EXCEEDED_WEIGHT', 'exceeds the maximum Speed Services weight limit of'); ?> Quote Link to comment Share on other sites More sharing options...
nelson5 Posted June 18, 2007 Share Posted June 18, 2007 catalog\includes\languages\english\modules\shipping\sservices.php catalog\includes\modules\shipping\sservices.php Hello, but what is the contribution that you have: "sservices.php" ? Greetings, Nelson Quote Link to comment Share on other sites More sharing options...
RudyC Posted June 18, 2007 Author Share Posted June 18, 2007 Hello, but what is the contribution that you have: "sservices.php" ? Greetings, Nelson Hey Nelson, That's correct. sservices.php is the contribution (module) that I am using/writing. The two files I quoted above are the current ones which I am trying to get working. Quote Link to comment Share on other sites More sharing options...
Guest Posted June 18, 2007 Share Posted June 18, 2007 Hey Nelson, That's correct. sservices.php is the contribution (module) that I am using/writing. The two files I quoted above are the current ones which I am trying to get working. A pure guess, change SA_SPEEDSERVICES to SSERVICES Quote Link to comment Share on other sites More sharing options...
RudyC Posted June 18, 2007 Author Share Posted June 18, 2007 A pure guess, change SA_SPEEDSERVICES to SSERVICES Tried it, didn't seem to work. It's like the page just won't recognise it :( thanks for the advice tho Quote Link to comment Share on other sites More sharing options...
RudyC Posted June 18, 2007 Author Share Posted June 18, 2007 Tried it, didn't seem to work. It's like the page just won't recognise it :( thanks for the advice tho my bad, after i also changed the class name to be sservices, it worked! thanks dude! Quote 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.