Forums / Addon Shipping Modules / USPS Shipping Module Error

USPS Shipping Module Error

Started by christian_wagner on 30 May 2013, 9:32 PM · Views: 2,253

Results 1 to 12 of 12
30 May 2013, 9:32 PM
#1
christian_wagner avatar

christian_wagner

New Zenner

Join Date:
May 2013
Location:
Long Branch, NJ
Posts:
49
Plugin Contributions:
0

USPS Shipping Module Error

See screenshots for errors and settings. Module is fully up to date. Running on v 1.5.1.

Attachment 12582
Attachment 12583
Attachment 12584
Attachment 12585

30 May 2013, 10:03 PM
#2
ajeh avatar

ajeh

Oba-san

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

Re: USPS Shipping Module Error

If you do not check any of the checkboxes for what you want USPS to quote you will get an error ...

NOTE: I think that version should have warned you ... You might check, as there should have been an error showing on the Modules ... Shipping ... USPS indicating that there wasn't anything selected ... I kinda forget if that version has the nifty warning or the one that I am currently working on ... :lookaroun

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!

31 May 2013, 5:05 PM
#3
christian_wagner avatar

christian_wagner

New Zenner

Join Date:
May 2013
Location:
Long Branch, NJ
Posts:
49
Plugin Contributions:
0

Re: USPS Shipping Module Error

Ajeh:

If you do not check any of the checkboxes for what you want USPS to quote you will get an error ...

NOTE: I think that version should have warned you ... You might check, as there should have been an error showing on the Modules ... Shipping ... USPS indicating that there wasn't anything selected ... I kinda forget if that version has the nifty warning or the one that I am currently working on ... :lookaroun

Yeah, silly mistake. Thank you for catching this.

Do you happen to know if there's a way to offer media mail options? So if it's only a CD or vinyl it's media mail but if it's bundled with anything else it's no longer media mail?

31 May 2013, 5:20 PM
#4
ajeh avatar

ajeh

Oba-san

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

Re: USPS Shipping Module Error

What identifies a Product as a CD or Vinyl?

Anything like master_categories_id or some other field that can be used to identify Products to know who is what?

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!

31 May 2013, 5:24 PM
#5
christian_wagner avatar

christian_wagner

New Zenner

Join Date:
May 2013
Location:
Long Branch, NJ
Posts:
49
Plugin Contributions:
0

Re: USPS Shipping Module Error

Ajeh:

What identifies a Product as a CD or Vinyl?

Anything like master_categories_id or some other field that can be used to identify Products to know who is what?

We have them separated by categories in our store but that's it. Unfortunately I've been thrown in the fire with learning Zen Cart at a crazy learning curve.

I don't even know what master_categories_id is :dontgetit

For reference - www.piratespressrecords.com/store.

31 May 2013, 5:33 PM
#6
ajeh avatar

ajeh

Oba-san

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

Re: USPS Shipping Module Error

The master_categories_id is the immediate categories_id that "owns" the Product in the table:
products

If you edit a Product, it will show you the master_categories_id at the top of the page:

Product Master Category:

The master_categories_id can be used as an identifier that a Product is a CD or Vinyl, if all CDs and Vinyls are in Categories that hold only CDs and/or Vinyls ...

This would allow a count on Products in the shopping_cart that match the master_categories_id numbers of CDs and Vinyls vs the total item count in the cart ...

The idea is, if the count of Products using these master_categories_id values matches the total items in the cart, then all Products are Media ... if not, then the whole cart is not Media ...

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!

31 May 2013, 5:40 PM
#7
christian_wagner avatar

christian_wagner

New Zenner

Join Date:
May 2013
Location:
Long Branch, NJ
Posts:
49
Plugin Contributions:
0

Re: USPS Shipping Module Error

Ajeh:

The master_categories_id is the immediate categories_id that "owns" the Product in the table:
products

If you edit a Product, it will show you the master_categories_id at the top of the page:

The master_categories_id can be used as an identifier that a Product is a CD or Vinyl, if all CDs and Vinyls are in Categories that hold only CDs and/or Vinyls ...

This would allow a count on Products in the shopping_cart that match the master_categories_id numbers of CDs and Vinyls vs the total item count in the cart ...

The idea is, if the count of Products using these master_categories_id values matches the total items in the cart, then all Products are Media ... if not, then the whole cart is not Media ...

Amazing. Thank you.

So I guess I have to add a code to the PHP file that would allow the check out to ONLY use media mail for the selected Master ID Categories?

31 May 2013, 5:52 PM
#8
ajeh avatar

ajeh

Oba-san

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

Re: USPS Shipping Module Error

You might look over this thread:
http://www.zen-cart.com/showthread.php?126077-Media-Mail-Option

and see if it gives you some idea of how to do this ...

If you really start to cry and pull your hair out, I might casually try to do a quick review on how to adapt that to the current USPS 3-27-2013 shipping module when I get some time ... :lookaroun

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!

31 May 2013, 5:53 PM
#9
christian_wagner avatar

christian_wagner

New Zenner

Join Date:
May 2013
Location:
Long Branch, NJ
Posts:
49
Plugin Contributions:
0

Re: USPS Shipping Module Error

Ajeh:

You might look over this thread:
http://www.zen-cart.com/showthread.php?126077-Media-Mail-Option

and see if it gives you some idea of how to do this ...

If you really start to cry and pull your hair out, I might casually try to do a quick review on how to adapt that to the current USPS 3-27-2013 shipping module when I get some time ... :lookaroun

I'll check this out. Thank you! Sadly, I have no hair to pull out :/

31 May 2013, 7:24 PM
#10
christian_wagner avatar

christian_wagner

New Zenner

Join Date:
May 2013
Location:
Long Branch, NJ
Posts:
49
Plugin Contributions:
0

Re: USPS Shipping Module Error

Ajeh:

You might look over this thread:
http://www.zen-cart.com/showthread.php?126077-Media-Mail-Option

and see if it gives you some idea of how to do this ...

If you really start to cry and pull your hair out, I might casually try to do a quick review on how to adapt that to the current USPS 3-27-2013 shipping module when I get some time ... :lookaroun

Alright so I took a look at it and I'm just not literate in PHP. I do know that the products ID categories are 4, 5, 6, and 7. But that's as far as I can get right now.

31 May 2013, 8:26 PM
#11
christian_wagner avatar

christian_wagner

New Zenner

Join Date:
May 2013
Location:
Long Branch, NJ
Posts:
49
Plugin Contributions:
0

Re: USPS Shipping Module Error

Ajeh:

You might look over this thread:
http://www.zen-cart.com/showthread.php?126077-Media-Mail-Option

and see if it gives you some idea of how to do this ...

If you really start to cry and pull your hair out, I might casually try to do a quick review on how to adapt that to the current USPS 3-27-2013 shipping module when I get some time ... :lookaroun

Could I just possibly PM you?

31 May 2013, 9:42 PM
#12
ajeh avatar

ajeh

Oba-san

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

Re: USPS Shipping Module Error

Try this ...

Customize the USPS shipping module:
/includes/modules/shipping/usps.php

and add the code in Red around line 305 or so:

      if (isset($uspsQuote['Package']['Postage']) && zen_not_null($uspsQuote['Package']['Postage'])) {
        $PackageSize = 1;
      } else {
        $PackageSize = ($this->usps_countries == 'US') ? sizeof($uspsQuote['Package']) : sizeof($uspsQuote['Package']['Service']);
      }

[B]// bof: test for media mail eligible
            $cart_count = $_SESSION['cart']->count_contents();
            $chk_products = 0;
            $media_valid = true;
      $chk_products += $_SESSION['cart']->in_cart_check('master_categories_id','4');
      $chk_products += $_SESSION['cart']->in_cart_check('master_categories_id','5');
      $chk_products += $_SESSION['cart']->in_cart_check('master_categories_id','6');
      $chk_products += $_SESSION['cart']->in_cart_check('master_categories_id','7');
      if ($cart_count == $chk_products) {
        $media_valid = true;
      } else {
        $media_valid = false;
      }
// eof: test for media mail eligible
[/B]
      for ($i=0; $i<$PackageSize; $i++)

and then add the code in Red 418 or so:

        $title .= $this->transittime[$type];

[B]// bof: test for media mail eligible
[/B]        if ((($method == '' && in_array($type, $types)) || $method == $type) && $usps_shipping_weight <= $maxweight && $usps_shipping_weight > $minweight) {
[B]//echo 'USPS $type: ' . $type . '<br>';
          if ($type == 'Media MailRM' && !$media_valid) {
            // skip media
          } else {
          $methods[] = array('id' => $type,
                             'title' => $title,
                             'cost' => $cost,
                            );
          }
// eof: test for media mail eligible
[/B]
        }
      }

      if (sizeof($methods) == 0) return false;

see if that shows Media only when Products are in categories 4, 5, 6 and 7 ...

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!