Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
I'm getting this notice whenever a customer gets a USPS shipping quote during the checkout process. The order includes two products with package parameters for both set to 7x5x1 inches. Shipping quote options are set to "All products in one package". Package type for each product is "Variable".
Notice: Undefined property: stdClass::$girth in /home/muscl1/public_html/sites/all/modules/ubercart/shipping/uc_usps/uc_usps.module on line 463
Comment | File | Size | Author |
---|---|---|---|
#8 | 1926054.patch | 411 bytes | TR |
#6 | ubercart_usps_girth-1926054-2.patch | 1.13 KB | sah62 |
#4 | ubercart_usps_girth-1926054-2.patch | 1.15 KB | sah62 |
#1 | ubercart_usps_girth-1926054-1.patch | 1.12 KB | DanZ |
Comments
Comment #1
DanZ CreditAttribution: DanZ commentedTry this (completely untested) patch and see if it helps.
I'm not sure if this is a complete fix for the problem, but it might help you in the short term.
See https://www.usps.com/business/web-tools-apis/rate-calculators-v1-7a.htm for details.
Comment #2
sah62 CreditAttribution: sah62 commentedThanks for the tip. As-is the patch produces a malformed request that looks like this (note that the opening tag for the Package element is missing):
I tweaked the code a little differently and got it to work. Here's what it looks like with my change in place:
I won't claim that it's the best way to do it, but as I said it seems to work.
Comment #3
DanZ CreditAttribution: DanZ commentedLooks like #1 needs some parentheses.
Comment #4
sah62 CreditAttribution: sah62 commentedYup, adding parentheses resolved the problem.
Comment #6
sah62 CreditAttribution: sah62 commentedFixed line endings in the patch file.
Comment #7
sah62 CreditAttribution: sah62 commentedFixing issue status...
Comment #8
TR CreditAttribution: TR commentedThis bug was introduced just recently by #1364508: USPS error: Dimensions are missing for package; unable to calculate postage., which is why I REALLY do not like to see changes committed unless there's a real patch, not just a few lines of suggested text. A real patch ensures the testbot will look at it, and catch stupid things like this. I moved this to minor because it's a PHP Notice that doesn't appear to the customer.
A simpler fix is just to ensure that girth is initialized, just like width, length, and height are. Please try this out and see if it eliminates the notice.
Comment #9
sah62 CreditAttribution: sah62 commentedMuch simpler, and yes, it eliminates the warning. Thanks!
Comment #10
DanZ CreditAttribution: DanZ commentedThe testbot and sah62 seem to like it, so RTBC.
Comment #11
TR CreditAttribution: TR commentedOkay then. Committed patch from #8. Thanks for the bug report.
Comment #12
sah62 CreditAttribution: sah62 commentedThanks for the fix.
Comment #13
longwaveTestbot would not have caught this anyway, as there are no tests for USPS. I did not commit it blindly either; I now have a USPS account precisely so I could test the outstanding patches in this queue before committing. Unfortunately, I did not catch this case!
Comment #14.0
(not verified) CreditAttribution: commentedAdded note about product package type.