Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I just tried debugging my install and had some error messages fly off:
Notice: Trying to get property of non-object in commerce_fedex_service_rate_order() (line 126 of /home/**/sites/all/modules/commerce_fedex/commerce_fedex.module).
Notice: Trying to get property of non-object in commerce_fedex_service_rate_order() (line 134 of /home/***/beta/sites/all/modules/commerce_fedex/commerce_fedex.module).
And it keeps goin'. Here is the response from FedEx:
stdClass Object
(
[HighestSeverity] => WARNING
[Notifications] => stdClass Object
(
[Severity] => WARNING
[Source] => crs
[Code] => 872
[Message] => Rating is temporarily unavailable for one or more services:
FIRST_OVERNIGHT; PRIORITY_OVERNIGHT; STANDARD_OVERNIGHT; FEDEX_2_DAY_AM; FEDEX_2_DAY; FEDEX_EXPRESS_SAVER; ; ; ; ; . Please try again later.
[LocalizedMessage] => Rating is temporarily unavailable for one or more services:
FIRST_OVERNIGHT; PRIORITY_OVERNIGHT; STANDARD_OVERNIGHT; FEDEX_2_DAY_AM; FEDEX_2_DAY; FEDEX_EXPRESS_SAVER; ; ; ; ; . Please try again later.
here is a pastin of the entire FedEx SOAP response: http://pastebin.com/924xy2rY if you need all the information returned.
Comment | File | Size | Author |
---|---|---|---|
#1 | commerce_fedex-non_object_error_on_unavailble_services-1866064.patch | 697 bytes | andyg5000 |
Comments
Comment #1
andyg5000@mglaman,
It looks like your getting some PHP notices because the 1st rate doesn't contain any rate details. Here's a patch that should ignore the rate service if it's unavailable. If your still having the issue, apply the patch and let me know if it resolves it. You should still be showing rates for GROUND_HOME_DELIVERY even though some others are failing.
Comment #2
mglamanThanks for the patch. I haven't had to apply it as the FedEx service went back up. I will keep this on hand so I can test it next time I run into that issue.
Comment #3
Summit CreditAttribution: Summit commentedHi shouldn't this patch be applied to get around this situation please?
Greetings, Martijn
Comment #4
Exploratus CreditAttribution: Exploratus commentedI was getting this error because some of the selected services came back blank. Patch worked perfectly. Lets get this committed. :) its a pretty big and nasty bug.
Comment #5
vegantriathleteWhile the patch does prevent the nasty warning messages from appearing, it still doesn't actually handle the error correctly.
I have run into the situation in which FedEx is having a problem quoting some of the services. It's still able to quote other services though.
The issue is that the response object it is now returning looks very different from when there are no errors.
Basically, now the $response object contains
$response->RateReplyDetails->RatedShipmentDetails[$key]->ShipmentRateDetail
where $key represents each array index. So, there is still data there. The way the patch functions now is that it just totally skips any of the valid data that is returned.Comment #6
vegantriathleteI think that the bigger issue is whether you really want to proceed when FedEx is having problems. Even if you jump through the hoops to figure out how to parse this different response, you will be missing quotes for services you would otherwise provide as options.
Comment #7
vegantriathleteIt's probably better to check $response->HighestSeverity == 'SUCCESS' and take some appropriate action when it isn't.
Comment #8
Exploratus CreditAttribution: Exploratus commentedagreed
Comment #10
nvahalik CreditAttribution: nvahalik commentedThis was originally a duplicate of #1935104: Error when fedex is returning only 1 rate. However, the issue turned into a matter of better logging. Updated the title. Also, some basic logging information has been added to -dev. Currently, it's set to ignore NOTE notifications since it seems like those are pretty common. If someone wants to write a patch that handles those as well as allows for configurable logging of API notifications, please do so!