Forums / Built-in Shipping and Payment Modules / USPS Flat Rate Option

USPS Flat Rate Option

Results 1 to 8 of 8
22 Mar 2011, 19:33
#1
page avatar

page

New Zenner

Join Date:
Jan 2011
Posts:
23
Plugin Contributions:
0

USPS Flat Rate Option

I have read everything I can find on USPS flat rate shipping. I have gathered the following information from several different threads. I still cannot quite find a post that tells if/how it can be done.

I want to enable USPS Priority Flat Rate Shipping for most items. In fact, I think I only have 2 items that will not fit in a flat rate box. (Domestic only for now).

I went to /includes/modules/shipping/usps.php.

!. What line do I put it on?
2. Is this the correct php language?

global $shipping_weight;
//PRIORITY MAIL OPTIONS
if ($key == 'PRIORITY'){
$this->container = ''; // Blank, Flate Rate Envelope, or Flat Rate Box // Sm Flat Rate Box, Md Flat Rate Box and Lg Flat Rate Box

}
//PRIORITY MAIL OPTIONS
if ($key == 'PRIORITY')
{
if ($usps_shipping_weight < 1)
{
$this->container = 'Sm Flat Rate Box';
}
else if ($usps_shipping_weight < 5)
{
$this->container = 'Md Flat Rate Box';
}
else
{
$this->container = 'Lg Flat Rate Box';
}
}

Thanks so much.
22 Mar 2011, 20:02
#2
ajeh avatar

ajeh

Oba-san

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

Re: USPS Flat Rate Option

You could try this:
          //PRIORITY MAIL OPTIONS
          if ($key == 'PRIORITY'){
//            $this->container = ''; // Blank, Flate Rate Envelope, or Flat Rate Box // Sm Flat Rate Box, Md Flat Rate Box and Lg Flat Rate Box
            switch (true) {
              case ($this->pounds < 1):
                $this->container = 'Sm Flat Rate Box';
                break;
              case ($this->pounds < 5):
                $this->container = 'Md Flat Rate Box';
                break;
              default:
                $this->container = 'Lg Flat Rate Box';
                break;
            }
          }
28 Mar 2011, 22:11
#3
page avatar

page

New Zenner

Join Date:
Jan 2011
Posts:
23
Plugin Contributions:
0

Re: USPS Flat Rate Option

Thanks for the code. Where exactly do I put it? Sorry, trying to learn. I have 2 files.
/includes/modules/shipping/usps.php and
/includes/modules/shipping/flat.php
I not only need to know which file to add it to but what line to enter it.
Thank you so much!
28 Mar 2011, 22:40
#4
ajeh avatar

ajeh

Oba-san

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

Re: USPS Flat Rate Option

The current USPS code reads:
          //PRIORITY MAIL OPTIONS
          if ($key == 'PRIORITY'){
            $this->container = ''; // Blank, Flate Rate Envelope, or Flat Rate Box // Sm Flat Rate Box, Md Flat Rate Box and Lg Flat Rate Box

          }


So you would need to change that to match your needs with the code posted ...

The Flat Rate flat shipping module is for when you want to charge 1 price regardless of the number of Products or Weight of the Products ...

I do not believe you want to use the Flat Rate flat shipping module at all and you should go to the Modules ... Shipping ... and click on it and click REMOVE ...
29 Mar 2011, 00:01
#5
page avatar

page

New Zenner

Join Date:
Jan 2011
Posts:
23
Plugin Contributions:
0

Re: USPS Flat Rate Option

That's right. I remember that now. Okay. I still need to use the small, med, and large USPS flat rate shipping boxes. Where do i enter the code within the USPS.php? Thank you.
29 Mar 2011, 00:09
#6
ajeh avatar

ajeh

Oba-san

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

Re: USPS Flat Rate Option

I already posted the old code and the new code ... you replace the old code with the new code ...

Then, set the weights for the new code if 1 and 5 are not the weights you want to use to break up which container should be used for the different weights ...
29 Mar 2011, 08:12
#7
page avatar

page

New Zenner

Join Date:
Jan 2011
Posts:
23
Plugin Contributions:
0

Re: USPS Flat Rate Option

Got it! Thank you. Applause Applause.
29 Mar 2011, 12:59
#8
ajeh avatar

ajeh

Oba-san

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

Re: USPS Flat Rate Option

Thanks for the update that this is now working for you ... :smile: