Zen Cart Logo
Forums / Built-in Shipping and Payment Modules / disable shipping module if total is greater than some $ value

disable shipping module if total is greater than some $ value

Locked

Views: 1,684

Results 1 to 4 of 4
This thread is locked. New replies are disabled.
21 Jul 2009, 7:11 PM
#1
vandiermen avatar

vandiermen

Totally Zenned

Join Date:
Feb 2007
Posts:
518
Plugin Contributions:
1

disable shipping module if total is greater than some $ value

I would like to set up compulsory insurance for orders over $50.

I have 2 table rate modules; one for standard shipping and the other for insurance shipping. I would like the standard shipping table rate module to be disabled after $50

The below code disables a shipping mod after 18lbs; I can imagine it can be edited to work with price somehow.

In includes/modules/shipping/zonetable.php
Or in
includes/modules/shipping/any_shipping_mod.php

Find this code

 // disable only when entire cart is free shipping 
    if (zen_get_shipping_enabled($this->code)) { 
      $this->enabled = ((MODULE_SHIPPING_ZONETABLE_STATUS == 'True') ? true : false); 
    }  
 

DIRECTLY BENEATH IT, add the following:

// Check for Weight and display module if weight exceeds stated value 
if (IS_ADMIN_FLAG == false && $_SESSION['cart']->show_weight() < 18) { 
  $this->enabled = false; 
} else { 
  $this->enabled = true; 
}  

So it now looks something like:

 
      // disable only when entire cart is free shipping
      if (zen_get_shipping_enabled($this->code)) {
        $this->enabled = ((MODULE_SHIPPING_ZONES_STATUS == 'True') ? true : false);
      }
 
// Check for Weight and display module if weight exceeds stated value 
if (IS_ADMIN_FLAG == false && $_SESSION['cart']->show_weight() < 18) { 
  $this->enabled = false; 
} else { 
  $this->enabled = true; 
}  
 
      // CUSTOMIZE THIS SETTING FOR THE NUMBER OF ZONES NEEDED
      $this->num_zones = 3;
    }
 
 

* 2 other people have the same unanswered question and would like to answer for them; can see in stickies below

3 Aug 2009, 4:16 PM
#2
mr_pibb avatar

mr_pibb

New Zenner

Join Date:
Jul 2009
Posts:
20
Plugin Contributions:
0

Re: disable shipping module if total is greater than some $ value

I have a similar need. I'd like to be able to disable certain shipping options based on price. (over $100, remove First Class Mail International option)

3 Aug 2009, 4:19 PM
#3
vandiermen avatar

vandiermen

Totally Zenned

Join Date:
Feb 2007
Posts:
518
Plugin Contributions:
1

Re: disable shipping module if total is greater than some $ value

I gave up and noted in the shipping module language file that it was compulsory over $x

3 Aug 2009, 8:57 PM
#4
mr_pibb avatar

mr_pibb

New Zenner

Join Date:
Jul 2009
Posts:
20
Plugin Contributions:
0

Re: disable shipping module if total is greater than some $ value

OK, I solved my problem. Add a line immediately after this line:

if ($_SESSION['cart']->total > 400 && strstr($services[$i], 'Priority Mail International Flat Rate Envelope')) continue; // skip value > $400 Priority Mail International Flat Rate Envelope

Here's what I added:

if ($_SESSION['cart']->total > 100 && strstr($services[$i], 'First Class Mail International Package')) continue; // skip value > $100 First Class Mail International Package 

The one that was already there says that if the value is over $400 then Priority Mail International Flat Rate Envelope will no longer be an option.

Mine is the same, but over $100 First Class Mail International Package is no longer an option.