Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

HELP!! Shipping errors!


Guest

Recommended Posts

Posted

I needed to have 5 different flat rate shipping methods so I took the flat rate file and appended a number to every call. The problem is that the module doesn't even show up in the admin and if it does, shipping charges aren't calculated. Here are the two files for one of the 5 modules I added.

 

/includes/modules/shipping

 

<?php

/*

$Id: flat2.php,v 1.35 2002/11/01 04:47:03 hpdl Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2002 osCommerce

 

Released under the GNU General Public License

*/

 

class flat2 {

var $code, $title, $description, $icon, $enabled;

 

// class constructor

function flat() {

$this->code = 'flat';

$this->title = MODULE_SHIPPING_FLAT_TEXT_TITLE2;

$this->description = MODULE_SHIPPING_FLAT_TEXT_DESCRIPTION2;

$this->icon = '';

$this->enabled = MODULE_SHIPPING_FLAT_STATUS2;

}

 

// class methods

function quote($method = '') {

$this->quotes = array('id' => $this->code,

'module' => MODULE_SHIPPING_FLAT_TEXT_TITLE2,

'methods' => array(array('id' => $this->code,

'title' => MODULE_SHIPPING_FLAT_TEXT_WAY2,

'cost' => SHIPPING_HANDLING + MODULE_SHIPPING_FLAT_COST2)));

 

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_FLAT_STATUS2'");

$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 Flat Shipping', 'MODULE_SHIPPING_FLAT_STATUS2', '1', 'Do you want to offer flat rate shipping?', '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 ('Flat Cost', 'MODULE_SHIPPING_FLAT_COST2', '5.00', 'What is the Shipping cost? The Handling fee will also be added.', '6', '6', now())");

}

 

function remove() {

$keys = '';

$keys_array = $this->keys();

for ($i=0; $i<sizeof($keys_array); $i++) {

$keys .= "'" . $keys_array[$i] . "',";

}

$keys = substr($keys, 0, -1);

 

tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in (" . $keys . ")");

}

 

function keys() {

return array('MODULE_SHIPPING_FLAT_STATUS2', 'MODULE_SHIPPING_FLAT_COST2');

}

}

?>

 

 

Next,

 

includes/languages/english/modules/shipping

 

<?php

/*

$Id: flat2.php,v 1.4 2001/09/20 19:40:42 mbs Exp $

 

The Exchange Project - Community Made Shopping!

http://www.theexchangeproject.org

 

Copyright © 2000,2001 The Exchange Project

 

Released under the GNU General Public License

*/

 

define('MODULE_SHIPPING_FLAT_TEXT_TITLE2', 'USPS Priority Mail ');

define('MODULE_SHIPPING_FLAT_TEXT_DESCRIPTION2', 'Delivered in 2-3+ days excluding Sunday. (P.O. Box Delivery is available)');

define('MODULE_SHIPPING_FLAT_TEXT_WAY2', 'Delivered in 2-3+ days excluding Sunday. (P.O. Box Delivery is available)');

?>

Posted

When doing this, you are better off replacing the word flat with flat2, flat3, flat4 and be sure to do so in a case sensative manner.

 

Compare flat.php and item.php and see where the word flat and item are interchanged.

 

This is the flow you want for doing this.

 

Then, once you have flat2.php working, make a flat3.php, flat4.php, etc.

Posted

I don't undestand why you need to compare it with item.php. Also, I got it to show up in the admin section and then I set the values. When I added items to the cart and went to checkout, I clicked on a shipping option and clicked continue. When I clicked continue it just reloaded the page.

 

I don't understand what I am doing wrong. Am I replacing the wrong things?

Posted

The idea was to look at the naming conventions and see how the words flat and item are used in these two files.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...