Forums / Built-in Shipping and Payment Modules / Hide shipping method if order is over a certain weight?

Hide shipping method if order is over a certain weight?

Locked

Started by danielle on 21 Jun 2007, 12:06 AM · Views: 2,555

Results 1 to 2 of 2
This thread is locked. New replies are disabled.
21 Jun 2007, 12:06 AM
#1
danielle avatar

danielle

Totally Zenned

Join Date:
Oct 2004
Posts:
973
Plugin Contributions:
0

Hide shipping method if order is over a certain weight?

Is there a way to hide a shipping method of an order is over a certain weight? I am shipping some small items and if they are under a certain weight they can go lettermail which is quite cheap. I am using the table rate for the lettermail since there are a few weight/price levels. The problem is that if their order goes over the max lettermail rate, my alternate shipping option shows, but lettermail is still showing as well, but with a cost of $0.00! Is there some code I can add into my table.php file to hide it if the order is over a certain weight?

I tried this but no luck:

$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->tax_basis = MODULE_SHIPPING_TABLE_TAX_BASIS;
// disable only when entire cart is free shipping
if (zen_get_shipping_enabled($this->code)) {
$this->enabled = ((MODULE_SHIPPING_TABLE_STATUS == 'True') ? true : false);}

if ($shipping_weight > "0.5") {
$this->enabled = false;}

The bolded part is what I added. I've tried a few variations of it too, but I know I must be missing something significant. There are no errors during checkout with that code added, but it doesn't change anything either, the lettermail cost still shows as $0.00.

If anyone can point me to what I'm missing in the code I would really appreciate it!

TIA!

Danielle

10 Jul 2007, 5:24 PM
#2
kodam avatar

kodam

Zen Follower

Join Date:
Jul 2005
Posts:
84
Plugin Contributions:
0

Re: Hide shipping method if order is over a certain weight?

I'm on the same problem, and still I didn't find the answer.

Dr.Byte kindly gave me this piece of advice :

  global $shipping_weight;
  if ($shipping_weight >= 2) {
    $this->enabled = false;
  }

Hope it helps