Zen Cart Logo
Forums / Built-in Shipping and Payment Modules / USPS Max Shipping Weight + Exclude International

USPS Max Shipping Weight + Exclude International

Views: 1,267

Results 1 to 6 of 6
11 Jan 2013, 10:09 PM
#1
kenichi avatar

kenichi

Zen Follower

Join Date:
Oct 2008
Posts:
252
Plugin Contributions:
0

USPS Max Shipping Weight + Exclude International

Hi,

I have been using

if (!IS_ADMIN_FLAG) {
      global $cart;
      if ($_SESSION['cart']->weight > 4.99 ) {
        $this->enabled = false;
      }
    }

to disable the USPS method after a certain weight, and it works great. However, I only use USPS for international shipping and would like for the USPS weight limit to not apply to international addresses.

Is this possible with a simple code change, or would it require a lot more work?

Thanks! :smile:

12 Jan 2013, 2:25 AM
#2
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: USPS Max Shipping Weight + Exclude International

I am not following what you are trying to do ...

If you only use USPS for International ... and you do not want the weight limit on International ... why don't you just remove that code for the weight limit from USPS shipping module and create a Zone for International so that no one else can use it?

12 Jan 2013, 5:37 AM
#3
kenichi avatar

kenichi

Zen Follower

Join Date:
Oct 2008
Posts:
252
Plugin Contributions:
0

Re: USPS Max Shipping Weight + Exclude International

I meant that while USPS is my only international method, I still use USPS domestically for weight <5lbs and then UPS for weight >5lbs. So the code is an issue because it means all international orders must be under 5lbs - which I don't want.

12 Jan 2013, 3:08 PM
#4
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: USPS Max Shipping Weight + Exclude International

You could try this ...

Move your test for the weight down lower and have it only test when the country is 223 for the US, example, add the additional test in RED and move it down to around:

    if (!IS_ADMIN_FLAG) {
      global $cart;
      if ($_SESSION['cart']->weight > 4.99[B] && $order->delivery['country']['id'] == 223[/B]) {
        $this->enabled = false;
      }
    }
    
    $this->types = array(
        'EXPRESS' => 'Express Mail', // ID="0"
        'FIRST CLASS' => 'First-Class Mail', // ID="1"
        'PRIORITY' => 'Priority Mail', // ID="2"
        'PARCEL' => 'Parcel Post', // ID="3"
        'MEDIA' => 'Media Mail', // ID="4"
        'LIBRARY' => 'Library' // ID="5"
        );

I did not test this, so be sure to test it well for both shipping_estimator and checkout_shipping ...

12 Jan 2013, 7:54 PM
#5
kenichi avatar

kenichi

Zen Follower

Join Date:
Oct 2008
Posts:
252
Plugin Contributions:
0

Re: USPS Max Shipping Weight + Exclude International

Thank you! Tested and it works in both the estimator and checkout process.

12 Jan 2013, 11:26 PM
#6
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: USPS Max Shipping Weight + Exclude International

Thanks for the update that this works for you ... :smile: