Please enter the package weight.

Posts: 146
Joined: 11/10/2007
Bug Finder

I updated to the latest version in bazaar and when I go to checkout the shipping quotes just says

"Please enter the package weight"

I checked everything an nothing works... Strange

--

Give and you will receive, you will be given much. Pressed Down, Shaken together, Running Over, it will spill into your lap.

Posts: 32
Joined: 01/28/2008

I'm seeing the same issue on Drupal 5.7, Ubercart 1.0beta3... The weights are specified. I tried this with two products. One has attributes, and the other does not. The request to USPS seems to be going through. The response from their server is:

<?xml version="1.0"?>
<RateV3Response><Package ID="0"><Error><Number>-2147219500</Number><Source>DomesticRatesV3::clsRateV3ValidateWeight;RateEngineV3.ProcessRequest</Source><Description>Please enter the package weight.  </Description><HelpFile></HelpFile><HelpContext>1000440</HelpContext></Error></Package></RateV3Response>

So, aside from a 'metoo', I'm also looking for a solution. Smiling

I'll do a little more digging, but hope someone has an easy fix.

Posts: 924
Joined: 11/05/2007
Bug FinderFAQ ModeratorGetting busy with the Ubercode.

I have it working without a problem on beta 2, so if there's a bug it's something that was introduced recently. Do you by chance have your store default weight set to something other than pounds? Can you print the request XML as well as the response (remove your user ID from the request before posting!). It sure sounds like the weight isn't being sent (maybe an error in unit conversion...), or that part of the XML is formatted improperly.

--

<tr>.

Posts: 32
Joined: 01/28/2008

TR wrote:
I have it working without a problem on beta 2, so if there's a bug it's something that was introduced recently. Do you by chance have your store default weight set to something other than pounds? Can you print the request XML as well as the response (remove your user ID from the request before posting!). It sure sounds like the weight isn't being sent (maybe an error in unit conversion...), or that part of the XML is formatted improperly.

Mine is set to Pounds as default. I tried it with a product weight set in Pounds, and also with one in ounces. Same thing. Smiling

What's the easiest way to capture the XML being sent from Ubercart? I looked, and couldn't find a setting to spit that out...

Posts: 924
Joined: 11/05/2007
Bug FinderFAQ ModeratorGetting busy with the Ubercode.

Hmm, I could swear it just did it when you checked the debug box at admin/store/settings/quotes/edit, but trying it out it doesn't seem to show up. I don't know, it's late. Anyway, stick the following line in uc_usps.module in the function uc_usps_quote(), just after the first call to uc_usps_rate_request():

$services['data']['debug'] .= htmlentities($request) ."<br />\n";

That should show your request.

--

<tr>.

Posts: 32
Joined: 01/28/2008

TR wrote:
Hmm, I could swear it just did it when you checked the debug box at admin/store/settings/quotes/edit, but trying it out it doesn't seem to show up. I don't know, it's late. Anyway, stick the following line in uc_usps.module in the function uc_usps_quote(), just after the first call to uc_usps_rate_request():
$services['data']['debug'] .= htmlentities($request) ."<br />\n";

That should show your request.

Thanks, it did:

API=RateV3&XML=%3CRateV3Request+USERID%3D%22(deleted)%22%3E%3CPackage+ID%3D%220%22%3E%3CService%3EALL%3C%2FService%3E%3CZipOrigination%3E95203%3C%2FZipOrigination%3E%3CZipDestination%3E92128%3C%2FZipDestination%3E%3CPounds%3E0%3C%2FPounds%3E%3COunces%3E0.0%3C%2FOunces%3E%3CContainer%3ERECTANGULAR%3C%2FContainer%3E%3CSize%3EREGULAR%3C%2FSize%3E%3CMachinable%3EFalse%3C%2FMachinable%3E%3C%2FPackage%3E%3C%2FRateV3Request%3E

As you suspected, it looks like 0.0 oz and 0 Pounds. Bummer. Sad

Posts: 924
Joined: 11/05/2007
Bug FinderFAQ ModeratorGetting busy with the Ubercode.

That's actually good news - it narrows down the problem considerably. Either the weights aren't set for the products or the weight calculation in uc_usps got screwed up. I suspect the latter, since you said you checked your product weights and because a lot of work has been done on the _uc_usps_package_product() function recently. Maybe Lyle can quickly spot the problem.

A quick way I use to see if the order weights are set right is to set up the Weight Quote shipping method to charge $1/lb. for shipping - that way on the checkout page when you get shipping quotes the shipping charge for Weight Quote will be = the shipping weight of your order. (Change this to $1/ounce if you want a more precise weight measure.) If Weight Quote gives the right answer then the problem is definitely in the uc_usps module.

--

<tr>.

Posts: 146
Joined: 11/10/2007
Bug Finder

never mind my bad no typo

--

Give and you will receive, you will be given much. Pressed Down, Shaken together, Running Over, it will spill into your lap.

Posts: 32
Joined: 01/28/2008

TR wrote:
That's actually good news - it narrows down the problem considerably. Either the weights aren't set for the products or the weight calculation in uc_usps got screwed up. I suspect the latter, since you said you checked your product weights and because a lot of work has been done on the _uc_usps_package_product() function recently. Maybe Lyle can quickly spot the problem.

A quick way I use to see if the order weights are set right is to set up the Weight Quote shipping method to charge $1/lb. for shipping - that way on the checkout page when you get shipping quotes the shipping charge for Weight Quote will be = the shipping weight of your order. (Change this to $1/ounce if you want a more precise weight measure.) If Weight Quote gives the right answer then the problem is definitely in the uc_usps module.

I enabled the Weight Quote module, set $1/lb, disabled USPS (Domestic and International) in the Shipping Quote configuration, and am seeing the same issue. To be complete, I removed the product from my shopping cart, and re-added it, checked again. No dice. Removed it again, set the product's weight up in lbs so that it would be the same across the board, re-added, and am still seeing the same issue.

Posts: 924
Joined: 11/05/2007
Bug FinderFAQ ModeratorGetting busy with the Ubercode.

So Weight Quote is telling you $0 = 0 lbs. shipping weight? Sounds like this isn't a shipping quotes problem then. Time to inspect your database to make sure the product weights are really in there ... strange problem!

--

<tr>.

Posts: 32
Joined: 01/28/2008

TR wrote:
So Weight Quote is telling you $0 = 0 lbs. shipping weight? Sounds like this isn't a shipping quotes problem then. Time to inspect your database to make sure the product weights are really in there ... strange problem!

Alrighty...

I disabled the "Cart Links" module, which I had enabled, assuming I might use it in the future. Smiling The Weight Quote now seems to work with $1/lb. With USPS enabled, and Weight Quote disabled, I'm now getting

"There were problems getting a shipping quote. Please verify the delivery and product information and try again.
If this does not resolve the issue, please call in to complete your order."

This occurs without the XML error from USPS being spit out as it was before, even though the debug info is turned on. I looked in the uc_products table, and the weight is in there.

Posts: 32
Joined: 01/28/2008

Update -

So, for some reason, I had to disable the Weight Quote module for the USPS code to start working, even though Weight Quote was disabled in the Store admin, and USPS was enabled. Now I'm seeing the XML error from USPS, but it is still not sending the weight correctly...

Posts: 32
Joined: 01/28/2008

Updated to Ubercart 1.0b4, same issue...

Posts: 29
Joined: 08/23/2007

I'm having the very same issue.

I'm using the latest release (ubercart-5.x-1.0-beta3) and this is occurring when attempting to retrieve shipping quotes.

Here is the exact code I'm getting.

<?xml version="1.0"?>
<RateV3Response>
  <Package ID="0">
    <Error>
      <Number>-2147219500</Number>
      <Source>DomesticRatesV3::clsRateV3ValidateWeight;RateEngineV3.ProcessRequest</Source>
      <Description>Please enter the package weight.</Description>
      <HelpFile></HelpFile>
      <HelpContext>1000440</HelpContext>
    </Error>
  </Package>
</RateV3Response>

Posts: 32
Joined: 01/28/2008

Decided to do a little more digging...

If I turn off "all in one" in the USPS shipping configuration, it seems to work, but I'm getting this now:

<?xml version="1.0"?>
<RateV3Response><Package ID="0"><Error><Number>-2147219499</Number><Source>DomesticRatesV3::clsRateV3ValidateWeight;RateEngineV3.ProcessRequest</Source><Description>Warning - The package weight cannot exceed 70 pounds.  </Description><HelpFile></HelpFile><HelpContext>1000440</HelpContext></Error></Package><Package ID="1"><ZipOrigination>95203</ZipOrigination><ZipDestination>92128</ZipDestination><Pounds>4</Pounds><Ounces>8.0</Ounces><Size>REGULAR</Size><Machinable>FALSE</Machinable><Zone>4</Zone><Postage CLASSID="2"><MailService>Express Mail PO to PO</MailService><Rate>28.30</Rate></Postage><Postage CLASSID="3"><MailService>Express Mail</MailService><Rate>30.70</Rate></Postage><Postage CLASSID="13"><MailService>Express Mail Flat-Rate Envelope</MailService><Rate>16.25</Rate></Postage><Postage CLASSID="1"><MailService>Priority Mail</MailService><Rate>8.90</Rate></Postage><Postage CLASSID="16"><MailService>Priority Mail Flat-Rate Envelope</MailService><Rate>4.60</Rate></Postage><Postage CLASSID="17"><MailService>Priority Mail Flat-Rate Box</MailService><Rate>8.95</Rate></Postage><Postage CLASSID="4"><MailService>Parcel Post</MailService><Rate>12.12</Rate></Postage><Postage CLASSID="5"><MailService>Bound Printed Matter</MailService><Rate>2.98</Rate></Postage><Postage CLASSID="6"><MailService>Media Mail</MailService><Rate>3.49</Rate></Postage><Postage CLASSID="7"><MailService>Library Mail</MailService><Rate>3.30</Rate></Postage></Package></RateV3Response>


<?xml version="1.0"?>
<RateV3Response><Package ID="0"><ZipOrigination>95203</ZipOrigination><ZipDestination>92128</ZipDestination><Pounds>5</Pounds><Ounces>4.0</Ounces><Size>REGULAR</Size><Machinable>FALSE</Machinable><Zone>4</Zone><Postage CLASSID="2"><MailService>Express Mail PO to PO</MailService><Rate>31.40</Rate></Postage><Postage CLASSID="3"><MailService>Express Mail</MailService><Rate>33.80</Rate></Postage><Postage CLASSID="13"><MailService>Express Mail Flat-Rate Envelope</MailService><Rate>16.25</Rate></Postage><Postage CLASSID="1"><MailService>Priority Mail</MailService><Rate>10.00</Rate></Postage><Postage CLASSID="16"><MailService>Priority Mail Flat-Rate Envelope</MailService><Rate>4.60</Rate></Postage><Postage CLASSID="17"><MailService>Priority Mail Flat-Rate Box</MailService><Rate>8.95</Rate></Postage><Postage CLASSID="4"><MailService>Parcel Post</MailService><Rate>12.86</Rate></Postage><Postage CLASSID="5"><MailService>Bound Printed Matter</MailService><Rate>3.35</Rate></Postage><Postage CLASSID="6"><MailService>Media Mail</MailService><Rate>3.83</Rate></Postage><Postage CLASSID="7"><MailService>Library Mail</MailService><Rate>3.62</Rate></Postage></Package><Package ID="1"><ZipOrigination>95203</ZipOrigination><ZipDestination>92128</ZipDestination><Pounds>0</Pounds><Ounces>7.0</Ounces><Size>REGULAR</Size><Machinable>FALSE</Machinable><Zone>4</Zone><Postage CLASSID="2"><MailService>Express Mail PO to PO</MailService><Rate>13.85</Rate></Postage><Postage CLASSID="3"><MailService>Express Mail</MailService><Rate>16.25</Rate></Postage><Postage CLASSID="13"><MailService>Express Mail Flat-Rate Envelope</MailService><Rate>16.25</Rate></Postage><Postage CLASSID="1"><MailService>Priority Mail</MailService><Rate>4.60</Rate></Postage><Postage CLASSID="16"><MailService>Priority Mail Flat-Rate Envelope</MailService><Rate>4.60</Rate></Postage><Postage CLASSID="17"><MailService>Priority Mail Flat-Rate Box</MailService><Rate>8.95</Rate></Postage><Postage CLASSID="0"><MailService>First-Class Mail Flat</MailService><Rate>2.15</Rate></Postage><Postage CLASSID="0"><MailService>First-Class Mail Parcel</MailService><Rate>2.15</Rate></Postage><Postage CLASSID="4"><MailService>Parcel Post</MailService><Rate>8.39</Rate></Postage><Postage CLASSID="5"><MailService>Bound Printed Matter</MailService><Rate>2.23</Rate></Postage><Postage CLASSID="6"><MailService>Media Mail</MailService><Rate>2.13</Rate></Postage><Postage CLASSID="7"><MailService>Library Mail</MailService><Rate>2.02</Rate></Postage></Package></RateV3Response>

Posts: 2244
Joined: 08/07/2007
AdministratoreLiTe!

If you're getting the options to select the shipping quote (and it looks like you should be, despite the error in the first part), you can turn off the debug information in the shipping quotes settings.

I just checked the USPS module, and I don't know why the "all in one" setting wouldn't get the weight properly. It ought to work fine in beta 4, I think.

Posts: 32
Joined: 01/28/2008

Right, I had the debug XML on because it was not functioning with 'all in one'. It looks like others are having this problem, though. Does anyone have the USPS module confirmed working with 'all in one' enabled?

Posts: 29
Joined: 08/23/2007

Alright.
So I turned off xml debugging and set it to ship "each in its own package" and now I'm getting this:

warning: array_search() [function.array-search]: Wrong datatype for first argument in /home/rofl/public_html/dev/sites/all/modules/ubercart/shipping/uc_usps/uc_usps.module on line 564.
warning: array_search() [function.array-search]: Wrong datatype for first argument in /home/rofl/public_html/dev/sites/all/modules/ubercart/shipping/uc_usps/uc_usps.module on line 564.
Invalid option selected. Recalculate shipping quotes to continue.

If I set to ship "all in one" I get a simple "Please enter the package weight" - however I have set the products weight to 1lbs and tested it being 10oz and I get the same thing.

Also notable, when I select to ship "all in one" in shipping quote settings, I get this:
warning: array_search() [function.array-search]: Wrong datatype for first argument in /home/rofl/public_html/dev/sites/all/modules/ubercart/shipping/uc_usps/uc_usps.module on line 535.

What to do?

Posts: 29
Joined: 08/23/2007

Moving along.
I've removed a shipping module I was not using and hoping not to use as it hasn't worked perfectly in the past, that module was the uc_tablerate module.
http://www.ubercart.org/forum/general_discussion/830/shipping_quotes_wei...
http://www.ubercart.org/comment/4203/Tablerate-module-alpha7e

Removing has helped somewhat. In that I am now getting quoted a price, albeit expensive and not correct one.

Yet under the price, it's still telling me to enter the package shipping weight.

Posts: 29
Joined: 08/23/2007

Oh noes.

What's this?

user warning: Unknown column 'required' in 'field list' query: INSERT IGNORE INTO uc_product_attributes (nid, aid, ordering, required, default_option) SELECT 4, aid, ordering, required, default_option FROM uc_class_attributes WHERE pcid = 'product' in /home/rofl/public_html/dev/includes/database.mysql.inc on line 172.

I got this when adding a new product.
It shows up after this and it appears to be fine, but this was kicked back when I added it...

Posts: 5
Joined: 01/31/2008

I just installed beta 4 and unfortunately it looks like the weight of packages still isn't being calculated properly when you use "All in one". When I switch to separate packaging my quotes work fine; otherwise I get "please enter package weight" from USPS.

(drupal 5.7 / workflow-ng 5.x-1.6, if it matters)

Posts: 32
Joined: 01/28/2008

rio_gio wrote:
Oh noes.

What's this?

user warning: Unknown column 'required' in 'field list' query: INSERT IGNORE INTO uc_product_attributes (nid, aid, ordering, required, default_option) SELECT 4, aid, ordering, required, default_option FROM uc_class_attributes WHERE pcid = 'product' in /home/rofl/public_html/dev/includes/database.mysql.inc on line 172.

I got this when adding a new product.
It shows up after this and it appears to be fine, but this was kicked back when I added it...

I got this after installing a fresh beta3, and I added the field 'required' manually. It looks like the install code in that version did not create the table with this field. It does, however, look that the beta4 adds that update. 'required' is needed in uc_product_attributes, and uc_class_attributes from what I can tell.

Posts: 2244
Joined: 08/07/2007
AdministratoreLiTe!

I found the problem with the "All in one" option for USPS. Lines 547 and 548 should have $package[0]->weight instead of $package->weight. This has been committed to the bazaar repository and will be in the next release.

Posts: 32
Joined: 01/28/2008

Lyle wrote:
I found the problem with the "All in one" option for USPS. Lines 547 and 548 should have $package[0]->weight instead of $package->weight. This has been committed to the bazaar repository and will be in the next release.

I changed those two lines in the beta4 version I had installed, and it seems to fix the issue. Thanks a bunch.

Posts: 29
Joined: 08/23/2007

Lyle wrote:
I found the problem with the "All in one" option for USPS. Lines 547 and 548 should have $package[0]->weight instead of $package->weight. This has been committed to the bazaar repository and will be in the next release.

I went to change those two lines, but I only saw where to change it on line 546 and 547.
Here's what I have.

      $packages[$key][0]->pounds = floor($package[0]->weight);
      $packages[$key][0]->ounces = 16 * ($package[0]->weight - $packages[$key][0]->pounds);
      $packages[$key][0]->container = 'RECTANGULAR';

I'm getting this when I go to review my order with what I have above.
It's also not letting me continue on to checkout, it just brings the review page up over and over again.

warning: array_search() [function.array-search]: Wrong datatype for first argument in /home/rofl/public_html/dev/sites/all/modules/ubercart/shipping/uc_usps/uc_usps.module on line 535.
warning: xml_parse() [function.xml-parse]: Unable to call handler _startElement() in /home/rofl/public_html/dev/sites/all/modules/ubercart/uc_store/includes/simplexml.php on line 244.

Posts: 29
Joined: 08/23/2007

beejaysea@drupal.org wrote:
rio_gio wrote:
Oh noes.

What's this?

user warning: Unknown column 'required' in 'field list' query: INSERT IGNORE INTO uc_product_attributes (nid, aid, ordering, required, default_option) SELECT 4, aid, ordering, required, default_option FROM uc_class_attributes WHERE pcid = 'product' in /home/rofl/public_html/dev/includes/database.mysql.inc on line 172.

I got this when adding a new product.
It shows up after this and it appears to be fine, but this was kicked back when I added it...

I got this after installing a fresh beta3, and I added the field 'required' manually. It looks like the install code in that version did not create the table with this field. It does, however, look that the beta4 adds that update. 'required' is needed in uc_product_attributes, and uc_class_attributes from what I can tell.


I have beta4 installed and I'm still getting this.
Any ideas?

Posts: 924
Joined: 11/05/2007
Bug FinderFAQ ModeratorGetting busy with the Ubercode.

You ran update.php? That error was a known bug with clean install in beta 3, which was fixed in beta 4. You do need to run update.php for the fix to work, and you should *always* run update.php when you update any Drupal modules.

--

<tr>.

Posts: 29
Joined: 08/23/2007

TR wrote:
You ran update.php? That error was a known bug with clean install in beta 3, which was fixed in beta 4. You do need to run update.php for the fix to work, and you should *always* run update.php when you update any Drupal modules.

Yep, I sure did.

I always do.

:\

Posts: 924
Joined: 11/05/2007
Bug FinderFAQ ModeratorGetting busy with the Ubercode.

Hmm, looking at the fix that was made to uc_attribute, it looks like it didn't completely fix the problem in the narrow case where you did a clean install of beta 3 then upgraded to beta 4. If you had done an upgrade from beta 2 to beta 3, or clean install of beta 4 (or above), or upgraded from beta 2 directly to beta 4, etc., there would be no problem. I'm not even sure that it's worth it to patch the module anymore to address that case, since it will be fine for every other case.

Anyway, to fix:
Go to admin/build/modules and uncheck the "Attribute" module, then save
Go to admin/build/modules/uninstall and completely uninstall the "Attribute" module
Back to admin/build/modules, reload that page then check the "Attribute" module again and save

(I tested this procedure on a beta 3 installation, and it eliminated the problem).

Unfortunately, that destroys any product attributes you might have set up. If you want to preserve your attributes, INSTEAD of the procedure above, you can execute the following SQL on your DB:

ALTER TABLE {uc_product_attributes} ADD COLUMN required tinyint(2) NOT NULL default 0 AFTER default_option

--

<tr>.

Posts: 29
Joined: 08/23/2007

TR wrote:
Hmm, looking at the fix that was made to uc_attribute, it looks like it didn't completely fix the problem in the narrow case where you did a clean install of beta 3 then upgraded to beta 4. If you had done an upgrade from beta 2 to beta 3, or clean install of beta 4 (or above), or upgraded from beta 2 directly to beta 4, etc., there would be no problem. I'm not even sure that it's worth it to patch the module anymore to address that case, since it will be fine for every other case.

Anyway, to fix:
Go to admin/build/modules and uncheck the "Attribute" module, then save
Go to admin/build/modules/uninstall and completely uninstall the "Attribute" module
Back to admin/build/modules, reload that page then check the "Attribute" module again and save

(I tested this procedure on a beta 3 installation, and it eliminated the problem).

Unfortunately, that destroys any product attributes you might have set up. If you want to preserve your attributes, INSTEAD of the procedure above, you can execute the following SQL on your DB:

ALTER TABLE {uc_product_attributes} ADD COLUMN required tinyint(2) NOT NULL default 0 AFTER default_option

I went thru the steps and I'm still getting the error...

Posts: 924
Joined: 11/05/2007
Bug FinderFAQ ModeratorGetting busy with the Ubercode.

Well then, I don't know what to suggest, other than do a clean install. The procedure above results in a clean install of uc_attribute, so that should have fixed your DB table.

Look in your uc_attribute.install and see if it defines the function uc_attribute_update_7() at the bottom - if it doesn't, you don't have beta 4!

Look in your DB at the uc_product_attributes table using phpMyAdmin - the above procedure will create that table with a column named 'required'. If it didn't, you don't have beta 4.

I don't see how uc_attribute could have been re-installed without this column created, unless you don't have the beta 4 version of uc_attribute.

--

<tr>.

Posts: 29
Joined: 08/23/2007

Oh wow.

I thought I had beta4 this whole time.

I downloaded it and never installed it. lol

So, that fixed the shipping quote problem, but I still get the checkout page loading over and over instead of going to the review before you submit page.

I get these back:

warning: array_search() [function.array-search]: Wrong datatype for first argument in /home/rofl/public_html/dev/sites/all/modules/ubercart/shipping/uc_usps/uc_usps.module on line 535.

warning: xml_parse() [function.xml-parse]: Unable to call handler _startElement() in /home/rofl/public_html/dev/sites/all/modules/ubercart/uc_store/includes/simplexml.php on line 244.

warning: xml_parse() [function.xml-parse]: Unable to call handler _characterData() in /home/rofl/public_html/dev/sites/all/modules/ubercart/uc_store/includes/simplexml.php on line 244.

Posts: 924
Joined: 11/05/2007
Bug FinderFAQ ModeratorGetting busy with the Ubercode.

Please start a new topic for that issue - we're drifting pretty far away from this forum topic. (My guess is those errors come from using PHP4 - please state your versions of UC, PHP etc. when you post the new topic.)

--

<tr>.