Forums / Addon Shipping Modules / USPS RateV4 Intl RateV2 - January 26, 2014 Issue

USPS RateV4 Intl RateV2 - January 26, 2014 Issue

Started by sundance72 on 26 Jan 2014, 1:34 PM · Views: 12,097

Results 21 to 40 of 40
7 Feb 2014, 2:06 PM
#21
ajeh avatar

ajeh

Oba-san

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

USPS RateV4 Intl RateV2 - January 26, 2014 Issue

If you have trouble with that code, try changing this section of the code:

  function _getQuote() {
    global $order;
    global $shipping_weight, $currencies;
    global $logfilename;
// force GroundOnly results in Stand Post only being offered
// to use, you must have a field for products_groundonly in the products table
// then uncomment the in_cart_check for the products_groundonly
// when $usps_groundonly is set to true, only Stand Post will show
    $usps_groundonly = 'false';
//    $usps_groundonly = ($_SESSION['cart']->in_cart_check('products_groundonly','1') ? 'true' : 'false');
[B]    if ($usps_groundonly == 'false') {
[/B]      // no GroundOnly products
      $usps_groundonly = '';
    } else {
      // 1+ GroundOnly products
      $usps_groundonly = '<Content>' .
                           '<ContentType>HAZMAT</ContentType>' .
                         '</Content>' .
                         '<GroundOnly>' . $usps_groundonly . '</GroundOnly>';
    }

//echo 'USPS function _getQuote $this->enabled: ' . ($this->enabled ? ' ON' : ' OFF') . ' $shipping_weight: ' . $shipping_weight . '<br>';

    if ((int)SHIPPING_ORIGIN_ZIP == 0) {

We take the champagne and pizza any way we can get it ... :cool:

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

16 Feb 2014, 10:15 PM
#22
phil_s avatar

phil_s

New Zenner

Join Date:
Mar 2008
Posts:
49
Plugin Contributions:
0

Re: USPS RateV4 Intl RateV2 - January 26, 2014 Issue

Played with it today and I'm still getting Priority mail as an option. I changed 2 item values products_groundonly to "1" and it didn't have any effect. I tried with the two variations of if ($usps_groundonly == 'false') { but got the same results.

Am I doing something wrong?

16 Feb 2014, 11:06 PM
#23
ajeh avatar

ajeh

Oba-san

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

Re: USPS RateV4 Intl RateV2 - January 26, 2014 Issue

Is your field that you added to the table:
products

called:
products_groundonly

Did you remove the comment marks on this line:

[B]//[/B]    $usps_groundonly = ($_SESSION['cart']->in_cart_check('products_groundonly','1') ? 'true' : 'false');

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

17 Feb 2014, 3:51 PM
#24
phil_s avatar

phil_s

New Zenner

Join Date:
Mar 2008
Posts:
49
Plugin Contributions:
0

Re: USPS RateV4 Intl RateV2 - January 26, 2014 Issue

Yes to both. I initially goofed and named it product_groundonly and left off the "s". That gave me an error until I realized my mistake. Once I corrected that the error went away so that leads me to believe the code is being read.

I've tried switching between;

if (!$usps_groundonly) { &
if ($usps_groundonly == 'false') {

by adding commentating marks to each line one at a time with no change.

17 Feb 2014, 4:27 PM
#25
ajeh avatar

ajeh

Oba-san

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

Re: USPS RateV4 Intl RateV2 - January 26, 2014 Issue

Could you humor me and Zip the usps.php file that you have on your server in:
/includes/modules/shipping

and post it here, please?

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

17 Feb 2014, 7:08 PM
#26
phil_s avatar

phil_s

New Zenner

Join Date:
Mar 2008
Posts:
49
Plugin Contributions:
0

Re: USPS RateV4 Intl RateV2 - January 26, 2014 Issue

My son caught my error and all is well.

I didn't catch the additional code around line 923 and just pasted the code around line 787. If I had simply uploaded your file it would have been fine but I had previously changed the quoted delivery times and thought I'd save time by not having to change those again.

I sincerely appreciate all your effort!

17 Feb 2014, 7:10 PM
#27
ajeh avatar

ajeh

Oba-san

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

Re: USPS RateV4 Intl RateV2 - January 26, 2014 Issue

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

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

17 Feb 2014, 7:41 PM
#28
phil_s avatar

phil_s

New Zenner

Join Date:
Mar 2008
Posts:
49
Plugin Contributions:
0

Re: USPS RateV4 Intl RateV2 - January 26, 2014 Issue

I've been wanting this for quite a time.

I've followed posts where someone has been looking for a way to restrict shipping based on the product but have never found a solution until now. Hopefully now other sellers searching for a solution will find this thread.

With ORM-D products there are shipping regulations that prohibit mailing other than ground and up until now I could only hope that the customer took the time to read and then selected the proper method. Before the latest rate changes Priority Mail was more expensive than Parcel so the cost of switching was covered. Now, Parcel is sometimes $2 more and I didn't want to have to either send an invoice for the extra or eat it.

THANK YOU!

18 Feb 2014, 4:37 PM
#29
apogeerockets avatar

apogeerockets

Zen Follower

Join Date:
Aug 2011
Posts:
104
Plugin Contributions:
0

Re: USPS RateV4 Intl RateV2 - January 26, 2014 Issue

Oh for..... really?? Really, USPS? I'm in the same situation as Paul - we're a model rocket company and HAVE to ship motors via parcel post (just changing the name of "standard post"). I actually have had a shipping restriction system implemented since forever so that if a cart has the motors, they're limited to just a standard post option or to a HAZMAT system I built via the FedEx module. Shipping is the most complicated part of our cart and I have written and rewritten modules to make it work.

I'll be taking Ajeh's mods and altering it to make use of my already-in-place restriction system and hopefully that will work!

18 Feb 2014, 5:27 PM
#30
phil_s avatar

phil_s

New Zenner

Join Date:
Mar 2008
Posts:
49
Plugin Contributions:
0

Re: USPS RateV4 Intl RateV2 - January 26, 2014 Issue

Great to hear from another vendor that shares the pitfalls of ORM-D shipping. Do you have any method set up that will completely blocks USPS shipping on certain products that you might be willing to share?

18 Feb 2014, 5:42 PM
#31
apogeerockets avatar

apogeerockets

Zen Follower

Join Date:
Aug 2011
Posts:
104
Plugin Contributions:
0

Re: USPS RateV4 Intl RateV2 - January 26, 2014 Issue

Let me get this standard post thing working again, and i'll attach my usps file with the mods i use to disable it via product restriction triggers for you. i've got a dozen mods to the usps module, so i'll point out the ones specific to it.

18 Feb 2014, 8:28 PM
#32
apogeerockets avatar

apogeerockets

Zen Follower

Join Date:
Aug 2011
Posts:
104
Plugin Contributions:
0

Re: USPS RateV4 Intl RateV2 - January 26, 2014 Issue

so, to disable the USPS module on a trigger, i used essentially this:

if (in_array(1, $_SESSION['cart']->ship_restrict) && $this->usps_countries != "US") $this->enabled = false;
if (in_array(2, $_SESSION['cart']->ship_restrict)) $this->enabled = false;

Put it right below the "types_to_skip_over_certain_value" array setting, within the __construct function. About mid-100s in linecount.

my 'ship_restrict' array is the system I use to track restrictions, and it's added to the cart elsewhere since I use that array in a lot of places on my site. The first line looks for a restriction of '1' and checks the destination country. '1' means that it is an orm-d item and it can only be shipped via ground, and to US addresses. A restriction of '2' means that it needs to go fedex hazmat, and turns off the usps module entirely. Later on, for ajeh's groundonly mod, i use the 'ship_restrict' array instead of the 'in_cart_check' system.

if you're using ajeh's trigger system, use something like this to turn off the module depending on a restriction.

if ($_SESSION['cart']->in_cart_check('products_groundonly','1') && $this->usps_countries != "US") $this->enabled = false;
if ($_SESSION['cart']->in_cart_check('products_groundonly','2') $this->enabled = false;

hope that helps, phil!

11 Sep 2014, 2:19 PM
#33
sundance72 avatar

sundance72

New Zenner

Join Date:
Apr 2008
Posts:
4
Plugin Contributions:
0

Re: USPS RateV4 Intl RateV2 - January 26, 2014 Issue

Any chance that you can redo Post#1 for the new USPS module?

Thanks!!

11 Sep 2014, 2:24 PM
#34
ajeh avatar

ajeh

Oba-san

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

Re: USPS RateV4 Intl RateV2 - January 26, 2014 Issue

I am being slow this morning ... umm ... what do you want me to do?

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

11 Sep 2014, 6:56 PM
#35
sundance72 avatar

sundance72

New Zenner

Join Date:
Apr 2008
Posts:
4
Plugin Contributions:
0

Re: USPS RateV4 Intl RateV2 - January 26, 2014 Issue

In answer to post #1 in this thread you created the following (which I was hoping that you would do again for the new USPS mod):

I believe you are trying to stop the use of Priority Mail when the Zone is greater than 4 ... if so then try this ...

Around line 393 add the code in RED:
Code:
$type = $this->clean_usps_marks($Package['MailService']);
$usps_ship_zone = $uspsQuote['Package'][$i]['Zone'];
//echo 'USPS Domestic $type: ' . $type . ' $cost: ' . $cost . '<br>';
then around line 592 change the code to read:
Code:
$show_hiddenCost = '';
if ($type_rebuilt == 'Priority MailTM' && $usps_ship_zone > 4) {
//echo 'Skip: ' . $type_rebuilt . ' zone: ' . $usps_ship_zone . '<br>';
// skip
} else {
$methods[] = array('id' => $type_rebuilt,
'title' => $title . $show_hiddenCost,
'cost' => $cost,
);
}
} else {
Linda McGrath

11 Sep 2014, 7:03 PM
#36
ajeh avatar

ajeh

Oba-san

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

Re: USPS RateV4 Intl RateV2 - January 26, 2014 Issue

I see what you are referring to ...

This line:

$usps_ship_zone = $uspsQuote['Package'][$i]['Zone'];

was added to the USPS September 7, 2014 K5 as this:

          // methods shipping zone
          $usps_shipping_methods_zone = $uspsQuote['Package'][$i]['Zone'];

So in the test for it you could change:

if ($type_rebuilt == 'Priority MailTM' && $usps_ship_zone > 4) {

To use:

if ($type_rebuilt == 'Priority MailTM' && $usps_shipping_methods_zone > 4) {

and not add the line:

$usps_ship_zone = $uspsQuote['Package'][$i]['Zone'];

to the code at all as that is now built in with just a different variable ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

12 Oct 2014, 12:38 AM
#37
justwade avatar

justwade

Zen Follower

Join Date:
Oct 2005
Posts:
206
Plugin Contributions:
0

Re: USPS RateV4 Intl RateV2 - January 26, 2014 Issue

Forgive me but I am confused with these code suggestions for older version from the past and good advice along the way.
Using the latest USPS.php with the last post #36 by Ajeh, my test with using code from #2 and changing it as in #36 still only gave Priority in my own zone. No Standard post shipping. (Yes, I have it checked off and Priority only on the module as choices, nothing else.

I love the idea of changing the products to be "selective for ground only (standard post)", for commercial product / ORM-D. with USPS.
But we need to just get standard post for "All Zones" now. Even if priority just is not an option. Will fix that later but our store is down now.
Its been awhile since I played around in the DB.

Even the USPS postal man from 20 plus years could not figure out how to ship ground anymore on his machine for 40 min.
USPS website now has an ORM-D select button. That's news to us, but maybe not to you all. They print out a special sticker and it ships.
And of course our stores shipping stopped working when we found out, and are down for maintenance with no more orders.
Has anyone had success with all zones available for ground only - USPS only shipping?
Regards,

Justwade
Zen 1.5.5f
Zen 1.3.9h*, Zen 1.27 + (did that, done with that)*

12 Oct 2014, 2:48 AM
#38
ajeh avatar

ajeh

Oba-san

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

Re: USPS RateV4 Intl RateV2 - January 26, 2014 Issue

USPS changed Standard Post to only work with Zones 5-9 and not Zones 1-4 ...

Example: If I ship from 44026 to 44026 I have no Standard Post, but if I ship from 44026 to 33601 I do have Standard Post ...

You can force Standard Post, but then you will not get any other Shipping method ...

Do you want to ship everything in your shop as Standard Post only?

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!

12 Oct 2014, 3:29 AM
#39
justwade avatar

justwade

Zen Follower

Join Date:
Oct 2005
Posts:
206
Plugin Contributions:
0

Re: USPS RateV4 Intl RateV2 - January 26, 2014 Issue

Ajeh:

USPS changed Standard Post to only work with Zones 5-9 and not Zones 1-4 ...

Example: If I ship from 44026 to 44026 I have no Standard Post, but if I ship from 44026 to 33601 I do have Standard Post ...

You can force Standard Post, but then you will not get any other Shipping method ...

Do you want to ship everything in your shop as Standard Post only?

Yes, if that what it takes to get our store back and another unprofitable sale in today's world. (another rant)
We just want to get folks to be able to see shipping costs before they checkout. It just right in our minds, unlike other corporate views on that matter. (a second rant, geez, I must be getting loopy by now)

Later, when my mind is not so cluttered I would like to experiment with the suggestions of getting ORM-D specific products to clear up shipping choices with the needed DB changes. But the first issue, like most of us all, is not the only thing we have to deal with to get through a day or hopefully another year. So to sum up, yes, we would like the ability to ground ship anywhere in the USA at any cost of shipping methods.

Thank you for your quick response Linda!,

Justwade
Zen 1.5.5f
Zen 1.3.9h*, Zen 1.27 + (did that, done with that)*

12 Oct 2014, 12:43 PM
#40
ajeh avatar

ajeh

Oba-san

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

Re: USPS RateV4 Intl RateV2 - January 26, 2014 Issue

To force Standard Post on all USPS shipping where no other shipping method will be available for Domestic shipping, you need to edit the USPS shipping module:
/includes/modules/shipping/usps.php

and change the code in **RED **around line 806 to true:

// force GroundOnly results in Stand Post only being offered
// to use, you must have a field for products_groundonly in the products table
// then uncomment the in_cart_check for the products_groundonly
// when $usps_groundonly is set to true, only Stand Post will show
$usps_groundonly = 'true';
// $usps_groundonly = ($_SESSION['cart']->in_cart_check('products_groundonly','1') ? 'true' : 'false');

Now, regardless of what shipping methods you have checked, be sure Standard Post is checked, only Standard Post will work for all USPS shipping and no other shipping method will work ...

Linda McGrath
If you have to think ... you haven't been zenned ...

**Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!**

Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today!]
Officially PayPal-Certified! Just click here

Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!