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'm using the All-in-one shipping quote option and have set the package quantity field correctly for my items. There's no splitting the quote into multiple packages. The quote always returns 1 package. I'm using UPS.
I've verified that this is not working in 6.x-dev as well as 6.x-2.13.
Here's my debug XML using only the UPS Ground option:
UPS logoUPS Ground Rate (1 package): $22.68
<?xml version="1.0" encoding="UTF-8"?>
<AccessRequest xml:lang="en-US">
<AccessLicenseNumber>SECRET</AccessLicenseNumber>
<UserId>SECRET</UserId>
<Password>SECRET</Password>
</AccessRequest>
<?xml version="1.0" encoding="UTF-8"?>
<RatingServiceSelectionRequest xml:lang="en-US">
<Request>
<TransactionReference>
<CustomerContext>Complex Rate Request</CustomerContext>
<XpciVersion>1.0001</XpciVersion>
</TransactionReference>
<RequestAction>Rate</RequestAction>
<RequestOption>rate</RequestOption>
</Request>
<PickupType>
<Code>06</Code>
</PickupType>
<CustomerClassification>
<Code>04</Code>
</CustomerClassification>
<Shipment>
<Shipper>
<ShipperNumber>SECRET</ShipperNumber>
<Address>
<City></City>
<StateProvinceCode></StateProvinceCode>
<PostalCode></PostalCode>
<CountryCode>US</CountryCode>
</Address>
</Shipper>
<ShipTo>
<Address>
<StateProvinceCode>NY</StateProvinceCode>
<PostalCode>10940</PostalCode>
<CountryCode>US</CountryCode>
<ResidentialAddressIndicator/>
</Address>
</ShipTo>
<ShipFrom>
<Address>
<StateProvinceCode>MD</StateProvinceCode>
<PostalCode>20737</PostalCode>
<CountryCode>US</CountryCode>
</Address>
</ShipFrom>
<ShipmentWeight>
<UnitOfMeasurement>
<Code>LBS</Code>
<Description>Pounds</Description>
</UnitOfMeasurement>
<Weight>22.8</Weight>
</ShipmentWeight>
<Service>
<Code>03</Code>
<Description>UPS Ground</Description>
</Service>
<Package><PackagingType><Code>02</Code></PackagingType><Dimensions><UnitOfMeasurement><Code>IN</Code></UnitOfMeasurement><Length>14.00</Length><Width>8.00</Width><Height>14.00</Height></Dimensions><PackageWeight><UnitOfMeasurement><Code>LBS</Code><Description>Pounds</Description></UnitOfMeasurement><Weight>22.8</Weight></PackageWeight></Package></Shipment>
</RatingServiceSelectionRequest>
<?xml version="1.0"?>
<RatingServiceSelectionResponse><Response><TransactionReference><CustomerContext>Complex Rate Request</CustomerContext><XpciVersion>1.0001</XpciVersion></TransactionReference><ResponseStatusCode>1</ResponseStatusCode><ResponseStatusDescription>Success</ResponseStatusDescription></Response><RatedShipment><Service><Code>03</Code></Service><RatedShipmentWarning>Your invoice may vary from the displayed reference rates</RatedShipmentWarning><BillingWeight><UnitOfMeasurement><Code>LBS</Code></UnitOfMeasurement><Weight>23.0</Weight></BillingWeight><TransportationCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>22.68</MonetaryValue></TransportationCharges><ServiceOptionsCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>0.00</MonetaryValue></ServiceOptionsCharges><TotalCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>22.68</MonetaryValue></TotalCharges><GuaranteedDaysToDelivery/><ScheduledDeliveryTime/><RatedPackage><TransportationCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>22.68</MonetaryValue></TransportationCharges><ServiceOptionsCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>0.00</MonetaryValue></ServiceOptionsCharges><TotalCharges><CurrencyCode>USD</CurrencyCode><MonetaryValue>22.68</MonetaryValue></TotalCharges><Weight>22.8</Weight><BillingWeight><UnitOfMeasurement><Code>LBS</Code></UnitOfMeasurement><Weight>23.0</Weight></BillingWeight></RatedPackage></RatedShipment></RatingServiceSelectionResponse>
Comment | File | Size | Author |
---|---|---|---|
#6 | ubercart-uc_ups-fix-package-count-2263123-6.patch | 1.03 KB | matthand |
Comments
Comment #1
TR CreditAttribution: TR commented"All in one" means all in one - you will get one package. Package quantity is ignored. The only place package quantity has an effect is when you chose "Each in own".
Comment #2
matthandThank you for the quick response.
From the quote settings page, here is the instructions concerning quote type:
Indicate whether each product is quoted as shipping separately or all in one package. Orders with one kind of product will still use the package quantity to determine the number of packages needed, however.
That help statement is at odds with the information you're telling me. Also, when I switch to "each in own" it still does not work as designed. Any chance you review this some more please?
Here's the XML debug code while using "each in own" option which also does not split into multiple packages:
Comment #3
matthandUsing "Each in own" packing option does correctly submit multiple packages to UPS via the XML Schema. However, the rate information that is displayed to the user prints "1 package" instead of the plural when there is multiple packages. This is confusing.
Here is the function code from the file uc_ups.module that is setting this text (line 723):
I think the problem is with line 747:
Comment #4
matthandThe issue with line 747 in uc_ups.module is that $packages is an array with one element, so the count always equals 1. So the solution here is to count the qty properly.
Here's a dpm of $packages in label function:
Comment #5
matthandI altered the uc_ups.module code to display the number of packages in the rate quote.
New code:
It now displays the proper package count now in the quote, see debug code below:
Comment #6
matthandI made a patch file against the current 6.x-2.x-dev branch with the changes I described above. Feedback?
Comment #7
TR CreditAttribution: TR commentedInteresting. But I don't think your proposed fix is correct - you are summing the qty values for each subarray, but qty should hold the number of products in the package, not the number of packages. The packages array in #4 looks to me like there are only two packages, but the UPS response in #5 shows five packages - are these two logs for the same order? How many products in the order and how many packages do you expect based on your package quantity settings?
Comment #8
TR CreditAttribution: TR commentedMarked #2275121: Checkout displays incorrect shipping package quantity as a duplicate.
Comment #9
TR CreditAttribution: TR commented