Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Problems with table shipping module


Mfred

Recommended Posts

Hi,

 

when I try to use table shipping by weight for international shipping I have

 

0.5:4.75,1:8.83

 

in my weight table

 

Everything is fine until 1kg, above 1kg the delivery costs are 0.

 

How can I prevent this? The maximum weight for this kind of shipping should be 1kg.

 

Above that other shipping modules are used and the table shipping should be not visible.

 

TIA

 

mfred

Link to comment
Share on other sites

you need to modify your shipping module. In the module's constructor you need to detect if you're executing out of the catalog and if so you check the $shipping_weight global. If it's above the limit you set the module to false

 

if( $shipping_weight > SOME_MAX_WEIGHT_FOR_THIS_MODULE )

$this->enabled = false;

Link to comment
Share on other sites

if( $shipping_weight > SOME_MAX_WEIGHT_FOR_THIS_MODULE )

$this->enabled = false;

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


if( $shipping_weight > 1 )
$this->enabled = false;


  $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;
	}
  }
}

Its not working there.

Can you tell me maybe where to put the code? I have no idea

Link to comment
Share on other sites

you need to define it as global first.

 

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

 

and then you check it just before the constructor function ends.

 

// Need to make sure we run on the catalog end....
  if( $this->enabled == true && function_exists('tep_customer_greeting') ) {
	if( $shipping_weight > SOME_MAX_WEIGHT_FOR_THIS_MODULE )
	  $this->enabled = false;
  }

Link to comment
Share on other sites

  • 3 weeks later...

I tried the code now in several places in the constructor class, but the shipping module still remains there with € 0 shipping costs if max weight is exceeded.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...