When attempting to select more than one shipping method, only the first method returns a value.

----

Breaking down the issue within the code:

http://drupalcode.org/sandbox/andrewmriley/1410424.git/blob/HEAD:/commer...

Defines multiple shipping methods (foreach $enabled, $machine_name) with a rate callback of commerce_usps_rate. So, this will call the function for each service.

Now, in commerce_usps_rate, the request is built (function in commerce_usps.xml.inc):

http://drupalcode.org/sandbox/andrewmriley/1410424.git/blob/HEAD:/commer...

For all USPS services:

http://drupalcode.org/sandbox/andrewmriley/1410424.git/blob/HEAD:/commer...

This then builds $rates for all of the methods under the same $service['name'] because $service remains the same within the loop:

http://drupalcode.org/sandbox/andrewmriley/1410424.git/blob/HEAD:/commer...

Further, we're caching the rates to lower the performance hit:

http://drupalcode.org/sandbox/andrewmriley/1410424.git/blob/HEAD:/commer...

Which, causes it never to get to the next option.

Comments

albert volkman’s picture

Status: Active » Needs review
StatusFileSize
new2.91 KB

This patch seems to pull the correct values back for all of the methods, but it is far from efficient.

The formatting is a little ugly as to focus on the actual diff.

andrew m riley’s picture

Status: Needs review » Fixed

Nice fix! This is now in master.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

Project: » Lost & found issues

This issue’s project has disappeared. Most likely, it was a sandbox project, which can be deleted by its maintainer. See the Lost & found issues project page for more details. (The missing project ID was 1410424)