Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

PHP sucks


Guest

Recommended Posts

Posted

Does anyone know what might be going on this is the error I get when I try to install table rate shipping.

 

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'True', 'False'), ', now())' at line 1

 

insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Enable Table Method', 'MODULE_SHIPPING_TABLE_STATUS', 'True', 'Do you want to offer table rate shipping?', '6', '0', 'tep_cfg_select_option(array('True', 'False'), ', now())

 

[TEP STOP

 

Also if I'm not mistaken shouldn't the code in catalog/includes/modules/shipping be the same as the code below from store/catalog/includes/modules/shipping/ and also isn't there a way to go in and manualy change the default shipping settings so that when it's installed it will automatically go to the defaults. Like say I want to change the defaults from what they are now '25:8.50,50:5.50,10000:0.00' to say 9:4.50, 10:0.00 then set the country and state codes from blank to whatever I want.

This is the code from the Table rate shipping folder.

<?php

/*

$Id: table.php,v 1.27 2003/02/05 22:41:52 hpdl Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

 

class table {

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

 

// class constructor

function table() {

global $order;

 

$this->code = 'table';

$this->title = MODULE_SHIPPING_TABLE_TEXT_TITLE;

$this->description = MODULE_SHIPPING_TABLE_TEXT_DESCRIPTION;

$this->sort_order = MODULE_SHIPPING_TABLE_SORT_ORDER;

$this->icon = '';

$this->tax_class = MODULE_SHIPPING_TABLE_TAX_CLASS;

$this->enabled = ((MODULE_SHIPPING_TABLE_STATUS == 'True') ? true : false);

 

if ( ($this->enabled == false) && ((int)MODULE_SHIPPING_TABLE_ZONE > 0) ) {

$check_flag = true;

$check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_SHIPPING_TABLE_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_TABLE_MODE == 'price') {

$order_total = $cart->show_total();

} else {

$order_total = $shipping_weight;

}

 

$table_cost = split("[:,]" , MODULE_SHIPPING_TABLE_COST);

$size = sizeof($table_cost);

for ($i=0, $n=$size; $i<$n; $i+=2) {

if ($order_total <= $table_cost[$i]) {

$shipping = $table_cost[$i+1];

break;

}

}

 

if (MODULE_SHIPPING_TABLE_MODE == 'weight') {

$shipping = $shipping * $shipping_num_boxes;

}

 

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

'module' => MODULE_SHIPPING_TABLE_TEXT_TITLE,

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

'title' => MODULE_SHIPPING_TABLE_TEXT_WAY,

'cost' => $shipping + MODULE_SHIPPING_TABLE_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_TABLE_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_TABLE_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_TABLE_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_TABLE_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_TABLE_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_TABLE_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_TABLE_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_TABLE_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_TABLE_STATUS', 'MODULE_SHIPPING_TABLE_COST', 'MODULE_SHIPPING_TABLE_MODE', 'MODULE_SHIPPING_TABLE_HANDLING', 'MODULE_SHIPPING_TABLE_TAX_CLASS', 'MODULE_SHIPPING_TABLE_ZONE', 'MODULE_SHIPPING_TABLE_SORT_ORDER');

}

}

?>

Posted

Change

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_TABLE_STATUS', 'True', 'Do you want to offer table rate shipping?', '6', '0', 'tep_cfg_select_option(array('True', 'False'), ', now())");

To

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_TABLE_STATUS', 'True', 'Do you want to offer table rate shipping?', '6', '0', 'tep_cfg_select_option(array(\'True\',\ 'False\'), ', now())");

Change

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_TABLE_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())");

To

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_TABLE_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())");

Posted

Ok, I've tried the fix about and it didn't work. I tried the fix on the link and it doesn't work either. Here's the code again. Any ideas would be greatly appreciated as this is causeing some serious problems and headaches. Perferably I would just like to change the defaults for shipping cost from what they are now to a different price, from weight to price, tax from to texas and zone to US and just leave that as the default

 

Here's the error:

 

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'True', 'False'), ', now())' at line 1

 

insert into configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) VALUES ('Enable Table Method', 'MODULE_SHIPPING_TABLE_STATUS', 'True', 'Do you want to offer table rate shipping?', '6', '0', 'tep_cfg_select_option(array('True', 'False'), ', now())

 

[TEP STOP]

 

 

Now the code from the file:

<?php

/*

$Id: table.php,v 1.27 2003/02/05 22:41:52 hpdl Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

 

class table {

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

 

// class constructor

function table() {

global $order;

 

$this->code = 'table';

$this->title = MODULE_SHIPPING_TABLE_TEXT_TITLE;

$this->description = MODULE_SHIPPING_TABLE_TEXT_DESCRIPTION;

$this->sort_order = MODULE_SHIPPING_TABLE_SORT_ORDER;

$this->icon = '';

$this->tax_class = MODULE_SHIPPING_TABLE_TAX_CLASS;

$this->enabled = ((MODULE_SHIPPING_TABLE_STATUS == 'True') ? true : false);

 

if ( ($this->enabled == false) && ((int)MODULE_SHIPPING_TABLE_ZONE > 0) ) {

$check_flag = true;

$check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_SHIPPING_TABLE_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_TABLE_MODE == 'price') {

$order_total = $cart->show_total();

} else {

$order_total = $shipping_weight;

}

 

$table_cost = split("[:,]" , MODULE_SHIPPING_TABLE_COST);

$size = sizeof($table_cost);

for ($i=0, $n=$size; $i<$n; $i+=2) {

if ($order_total <= $table_cost[$i]) {

$shipping = $table_cost[$i+1];

break;

}

}

 

if (MODULE_SHIPPING_TABLE_MODE == 'weight') {

$shipping = $shipping * $shipping_num_boxes;

}

 

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

'module' => MODULE_SHIPPING_TABLE_TEXT_TITLE,

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

'title' => MODULE_SHIPPING_TABLE_TEXT_WAY,

'cost' => $shipping + MODULE_SHIPPING_TABLE_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_TABLE_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_TABLE_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_TABLE_COST', '9:4.75,10:0.00,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_TABLE_MODE', 'price', '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_TABLE_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_TABLE_TAX_CLASS', 'TX', '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_TABLE_ZONE', 'US', '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_TABLE_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_TABLE_STATUS', 'MODULE_SHIPPING_TABLE_COST', 'MODULE_SHIPPING_TABLE_MODE', 'MODULE_SHIPPING_TABLE_HANDLING', 'MODULE_SHIPPING_TABLE_TAX_CLASS', 'MODULE_SHIPPING_TABLE_ZONE', 'MODULE_SHIPPING_TABLE_SORT_ORDER');

}

}

?>

Posted

That's not the default osCommerce root level Table Rate shipping file.

 

The error has already been pointed out to you.

 

The file should say this at the end:

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_TABLE_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_TABLE_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_TABLE_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_TABLE_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_TABLE_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_TABLE_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_TABLE_SORT_ORDER', '0', 'Sort order of display.', '6', '0', now())");

 

Note the back slashes already mentioned to you.

 

Vger

Posted

Yes I know that. I changed them as suggested, but in you pointing it out again I am just noticing that even though I put the back slashes in they are not there now. so when I save the file they are just disapearing as if nothing was changed and yes I saved. Where is the root level default table file then so I can change the default settings to a new default?

Posted
Yes I know that. I changed them as suggested, but in you pointing it out again I am just noticing that even though I put the back slashes in they are not there now. so when I save the file they are just disapearing as if nothing was changed and yes I saved. Where is the root level default table file then so I can change the default settings to a new default?

 

Bad editor like dreamweaver or using the old osC file "mangler".

 

Try googling ConTEXT and using that as an editor.

Posted
Bad editor like dreamweaver or using the old osC file "mangler".

Hi Robert,

Just wondering is there a problem with dreamweaver that I should be aware of? Thats what I use and haven't had any problems with it.

Thanks Brian

Posted
Bad editor like dreamweaver or using the old osC file "mangler".

 

Try googling ConTEXT and using that as an editor.

 

 

Ok, with either program do I need to download the file edit it then upload it again or can I edit it on the fly like with frontpage for example you log on to the server then edit the pages and the editing is saved when you hit save. I'm realy sorry guys, I'm new to PHP and this whole sql thing, I have no clue what I'm doing and I'm trying to learn, sorry if I sound stupid. I make enough off my website to live on but not enough to hire a programer yet so I realy need to learn this stuff step by step like a child. Thanks for all your help. I realy think I screwed up the shipping modules trying to instal the USPS updates and trying to understand how it worked and what to change at any rate most of my customers order enough to get free shipping anyway so all I realy need is the table rate shippign to work either with default settings I make or the way it's supossed to. thanks again

Posted
Hi Robert,

Just wondering is there a problem with dreamweaver that I should be aware of? Thats what I use and haven't had any problems with it.

Thanks Brian

 

Edit files by hand coding with a propper editor like ConTEXT, works better and you don't have to worry about that auto code monkey Dreamweaver has running around jacking up your code.

Posted

OK. I downloaded Context, used it to edit the code and add the back slashes and they still revert back to the way it was with no slashes. Is there a root default file for the Table.php somewhere. If so where would I find it and if it had no slashes would it cause the files I'm changing to revert back to the file with no back slashes. I realy need some help here, thanks.

Posted

Here is the default table.php file

<?php
/*
 $Id: table.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 table {
var $code, $title, $description, $icon, $enabled;

// class constructor
function table() {
  global $order;

  $this->code = 'table';
  $this->title = MODULE_SHIPPING_TABLE_TEXT_TITLE;
  $this->description = MODULE_SHIPPING_TABLE_TEXT_DESCRIPTION;
  $this->sort_order = MODULE_SHIPPING_TABLE_SORT_ORDER;
  $this->icon = '';
  $this->tax_class = MODULE_SHIPPING_TABLE_TAX_CLASS;
  $this->enabled = ((MODULE_SHIPPING_TABLE_STATUS == 'True') ? true : false);

  if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_TABLE_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_TABLE_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_TABLE_MODE == 'price') {
	$order_total = $cart->show_total();
  } else {
	$order_total = $shipping_weight;
  }

  $table_cost = split("[:,]" , MODULE_SHIPPING_TABLE_COST);
  $size = sizeof($table_cost);
  for ($i=0, $n=$size; $i<$n; $i+=2) {
	if ($order_total <= $table_cost[$i]) {
	  $shipping = $table_cost[$i+1];
	  break;
	}
  }

  if (MODULE_SHIPPING_TABLE_MODE == 'weight') {
	$shipping = $shipping * $shipping_num_boxes;
  }

  $this->quotes = array('id' => $this->code,
						'module' => MODULE_SHIPPING_TABLE_TEXT_TITLE,
						'methods' => array(array('id' => $this->code,
												 'title' => MODULE_SHIPPING_TABLE_TEXT_WAY,
												 'cost' => $shipping + MODULE_SHIPPING_TABLE_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_TABLE_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_TABLE_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_TABLE_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_TABLE_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_TABLE_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_TABLE_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_TABLE_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_TABLE_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_TABLE_STATUS', 'MODULE_SHIPPING_TABLE_COST', 'MODULE_SHIPPING_TABLE_MODE', 'MODULE_SHIPPING_TABLE_HANDLING', 'MODULE_SHIPPING_TABLE_TAX_CLASS', 'MODULE_SHIPPING_TABLE_ZONE', 'MODULE_SHIPPING_TABLE_SORT_ORDER');
}
 }
?>

Posted

Ok so it looks like the one I've been trying to change. Shouldn't changing one of them change them all since they are in essence the same file or do you have to change one main file for them to change? do you know what I mean. Where is the Root table file located?

Posted

The above file is in catalog/includes/modules/shipping/table.php.

The file in catalog/includes/languages/englis/modules/shipping/table.php is the language definition file.

What files do you mean by they are the same file?

Posted

the table.php files is what I ment by that.

 

So if I was trying to change the one in catalog/includes/languages/englis/modules/shipping/table.php it would not make any difference but if I change the one in here catalog/includes/modules/shipping/table.php it will?

Posted
The above file is in catalog/includes/modules/shipping/table.php.

The file in catalog/includes/languages/englis/modules/shipping/table.php is the language definition file.

What files do you mean by they are the same file?

 

 

Ok I tried what it said in the link to the other thread. I tried downloading Context and I added the slashes NOW all I get in the admin area of the shipping modules is this:

Fatal error: Cannot redeclare class table in /hsphere/local/home/gigashad/allaboutfunhobbies.com/store/catalog/includes/modules/shipping/table.php on line 13

 

and the only two shipping options are table and bestway and nothing else and neither on of them is editable. I even tried to put the original file, that I saved before starting this back and it still gives the same results.

 

Here's the code from the edited file.

<?php

/*

$Id: table.php,v 1.27 2003/02/05 22:41:52 hpdl Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

 

class table {

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

 

// class constructor

function table() {

global $order;

 

$this->code = 'table';

$this->title = MODULE_SHIPPING_TABLE_TEXT_TITLE;

$this->description = MODULE_SHIPPING_TABLE_TEXT_DESCRIPTION;

$this->sort_order = MODULE_SHIPPING_TABLE_SORT_ORDER;

$this->icon = '';

$this->tax_class = MODULE_SHIPPING_TABLE_TAX_CLASS;

$this->enabled = ((MODULE_SHIPPING_TABLE_STATUS == 'True') ? true : false);

 

if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_TABLE_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_TABLE_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_TABLE_MODE == 'price') {

$order_total = $cart->show_total();

} else {

$order_total = $shipping_weight;

}

 

$table_cost = split("[:,]" , MODULE_SHIPPING_TABLE_COST);

$size = sizeof($table_cost);

for ($i=0, $n=$size; $i<$n; $i+=2) {

if ($order_total <= $table_cost[$i]) {

$shipping = $table_cost[$i+1];

break;

}

}

 

if (MODULE_SHIPPING_TABLE_MODE == 'weight') {

$shipping = $shipping * $shipping_num_boxes;

}

 

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

'module' => MODULE_SHIPPING_TABLE_TEXT_TITLE,

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

'title' => MODULE_SHIPPING_TABLE_TEXT_WAY,

'cost' => $shipping + MODULE_SHIPPING_TABLE_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_TABLE_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_TABLE_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_TABLE_COST', '9:4.75,10:0.00,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_TABLE_MODE', 'price', '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_TABLE_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_TABLE_TAX_CLASS', 'TX', '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_TABLE_ZONE', 'US', '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_TABLE_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_TABLE_STATUS', 'MODULE_SHIPPING_TABLE_COST', 'MODULE_SHIPPING_TABLE_MODE', 'MODULE_SHIPPING_TABLE_HANDLING', 'MODULE_SHIPPING_TABLE_TAX_CLASS', 'MODULE_SHIPPING_TABLE_ZONE', 'MODULE_SHIPPING_TABLE_SORT_ORDER');

}

}

?>

Archived

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

×
×
  • Create New...