Zen Cart Logo
Forums / Addon Shipping Modules / max weight for usps?

max weight for usps?

Locked

Views: 5,127

Results 1 to 12 of 12
This thread is locked. New replies are disabled.
4 Oct 2008, 1:34 PM
#1
ryanb4614 avatar

ryanb4614

Totally Zenned

Join Date:
Feb 2008
Posts:
556
Plugin Contributions:
0

max weight for usps?

can i set a maximum weight for USPS? I have items that i would like to offer USPS under 5lbs but anyting above that for the customer not to have to option of USPS during checkout... thanks

4 Oct 2008, 6:33 PM
#2
ajeh avatar

ajeh

Oba-san

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

Re: max weight for usps?

You are best customizing the USPS shipping module itself to only display when the weight > 5 ...

Edit the file:
/includes/modules/shipping/usps.php

and above this code:

    $this->types = array('EXPRESS' => 'Express Mail',
        'FIRST CLASS' => 'First-Class Mail',
        'PRIORITY' => 'Priority Mail',
        'PARCEL' => 'Parcel Post',
        'MEDIA' => 'Media Mail',
        'BPM' => 'Bound Printed Material',
        'LIBRARY' => 'Library'
        );

add this code to make it read:

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

    $this->types = array('EXPRESS' => 'Express Mail',
        'FIRST CLASS' => 'First-Class Mail',
        'PRIORITY' => 'Priority Mail',
        'PARCEL' => 'Parcel Post',
        'MEDIA' => 'Media Mail',
        'BPM' => 'Bound Printed Material',
        'LIBRARY' => 'Library'
        );
4 Oct 2008, 6:35 PM
#3
ajeh avatar

ajeh

Oba-san

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

Re: max weight for usps?

NOTE: that code is for anything above 5 lbs will not see the USPS shipping module ...

NOTE: there are no overrides for this file so be sure to save the original and the customized file for future reference ...

4 Nov 2008, 2:59 AM
#4
ryanb4614 avatar

ryanb4614

Totally Zenned

Join Date:
Feb 2008
Posts:
556
Plugin Contributions:
0

Re: max weight for usps?

sorry for getting back so so late, code didn't seem to work

4 Nov 2008, 5:52 PM
#5
ajeh avatar

ajeh

Oba-san

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

Re: max weight for usps?

Does USPS show at any weight?

Or, does it show all of the time?

You did not explain what "doesn't work" means ... :unsure:

5 Nov 2008, 1:37 PM
#6
ryanb4614 avatar

ryanb4614

Totally Zenned

Join Date:
Feb 2008
Posts:
556
Plugin Contributions:
0

Re: max weight for usps?

it shows up all the time as a shipping option

5 Nov 2008, 7:17 PM
#7
ajeh avatar

ajeh

Oba-san

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

Re: max weight for usps?

Have you an URL where we can try this?

What are your settings in the Configuration ... Shipping/Packaging?

5 Nov 2008, 11:00 PM
#8
ryanb4614 avatar

ryanb4614

Totally Zenned

Join Date:
Feb 2008
Posts:
556
Plugin Contributions:
0

Re: max weight for usps?

USPS.php new:

        $check->MoveNext();
      }

      if ($check_flag == false) {
        $this->enabled = false;
      }
    }

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

    $this->types = array('EXPRESS' => 'Express Mail', 
        'FIRST CLASS' => 'First-Class Mail', 
        'PRIORITY' => 'Priority Mail', 
        'PARCEL' => 'Parcel Post', 
        'MEDIA' => 'Media Mail', 
        'BPM' => 'Bound Printed Material', 
        'LIBRARY' => 'Library' 
        );  

shipping and packaging config:
Enter the Maximum Package Weight you will ship 65
Package Tare Small to Medium - added percentage:weight 2:0
Larger packages - added packaging percentage:weight 5:0
Display Number of Boxes and Weight Status 2
Order Free Shipping 0 Weight Status 0
Shipping Estimator Display Settings for Shopping Cart 1
Display Order Comments on Admin Invoice 2
Display Order Comments on Admin Packing Slip 2

thanks for your time!

6 Nov 2008, 1:15 AM
#9
ryanb4614 avatar

ryanb4614

Totally Zenned

Join Date:
Feb 2008
Posts:
556
Plugin Contributions:
0

Re: max weight for usps?

im sorry long day website petland plus .com

6 Nov 2008, 5:16 AM
#10
ajeh avatar

ajeh

Oba-san

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

Re: max weight for usps?

Try using this instead:

    global $total_weight;
    if ($total_weight > 5) {
        $this->enabled = false;
    }

Does that work better for you?

7 Nov 2008, 5:29 AM
#11
ryanb4614 avatar

ryanb4614

Totally Zenned

Join Date:
Feb 2008
Posts:
556
Plugin Contributions:
0

Re: max weight for usps?

Awsome it worked! Thank you for your time!!! :)

7 Nov 2008, 5:45 PM
#12
ajeh avatar

ajeh

Oba-san

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

Re: max weight for usps?

Thanks for the update that this was able to work for you ... :smile: