Is there any tutorial on how to set up and use this module? I'm following the directions stated in the main project page to set up my connections to the USPS services with valid credentials, but always get a blank area on the screen when I go to the shipping page section on checkout. Any help with this would be greatly appreciated.

Comments

LonitaD’s picture

I am having the same problem. The Vimeo video for the Commerce UPS module http://vimeo.com/32535912 does not show the same configuration options so it is hard to follow. I don't have any errors or problems that I can tell but it is still not doing anything. Do we need to set up a calculation rule for this to work?

andyg5000’s picture

Component: Documentation » Code
Assigned: Unassigned » andyg5000
Category: support » bug
Priority: Normal » Critical

The documentation for Commerce UPS should be basically identical. I think that the problem is with a Commerce Shipping dependency. It should work with any Commerce Shipping 7.x-2.x, but I had problems with the current beta-1. Can you please try with Commerce Shipping 7.x-2.x-dev (http://drupal.org/node/1287108) and let me know if it fixes your issue? I will investigate the issue with previous versions of Commerce Shipping in the meantime.

LonitaD’s picture

I just updated to the latest dev version of Commerce shipping (7.x-2.0-beta1+15-dev). I now have a 'configure rule' operation on the admin/commerce/config/shipping page and a 'configure component' operation on the services listing page, both of which were missing before. When I go to checkout, there is no information about shipping. If I enable the Shipping Method Example module, I see a shipping section during checkout. I double checked that the product had a weight. Does it also need dimensions for the USPS shipping to work?

andyg5000’s picture

creativ180, I'm unable to replicate your issue. On the settings page (admin/commerce/config/shipping/methods/usps/edit) what options do you have selected? Be sure to use the production URL (http://production.shippingapis.com/ShippingAPI.dll) and make sure that your username has been updated to production status by USPS. If you've verified those things and cleared the cache you should find the following:

  • The selected shipping services (priority, parcel, etc...) in admin/commerce/config/shipping/services
  • In the watchdog you should see several log entries with each request to USPS and any errors related to them

Let me know what you find.

deaconblues’s picture

I'm doing the same thing that creative180 has done and am seeing the same things. I thought it might be something funky with my site so I decided to start with a clean instance of Commerce Kickstart V1 to test this out. Here are the steps that I did:

  • Installed a fresh version of Commerce Kickstart
  • Downloaded and enabled the following modules
    • Commerce Shipping 7.x-2.0-beta1+15-dev
    • Commerce USPS 7.x-1.x-dev
    • Physical Fields 7.x-1.x-dev
    • Commerce Physical Product 7.x-1.x-dev
    • Commerce Flat Rate 7.x-1.0-beta1 (as a secondary check)
  • I then went to the default product and added basic physical attributes to the content type
    • Added a Physical weight field and called it field_weight. I set the default weight to 1 lb.
    • Added a Physical dimensions field and called it field_dimensions. I set the default dimensions for it to 6in x 6in x 2in.
    • Made sure that the 3 default Products had weights and dimensions.
  • Went to the admin/commerce/config/shipping location and set up the basic information. I used my local zip code, added my USPS username, and selected First Class, Priority, Express, and Parcel options all with a 10% markup. I also checked to make sure that the api location was set to a good URL.
  • Added a Flat Rate shipping option of $3.99 as a secondary check to make sure that it wasn't a Shipping 2.x issue.
  • Left the default Example shipping method enabled.
  • Went to the home page and added two products to my cart. Then proceeded to checkout.
  • Filled out my home address in the billing and shipping address and clicked the Continue button.
  • I then got to the Shipping page and saw the Example Shipping and Flat Rate Shipping values, but no values for the USPS shipping rates were displayed on the screen. I checked the watchdog table and saw no references to the USPS Shipping module in the log.




Did I miss any configuration steps here? Any help would be greatly appreciated.

andyg5000’s picture

deaconblues,
Thanks for the full report. I'll troubleshoot tonight or tomorrow and post a patch or commit a fix.
Andy

andyg5000’s picture

Hey @deaconblues,
I followed your exact steps and I had an empty shipping page (no USPS results). I then ran drush cc all (clear all drupal caches) and refreshed the page and the USPS shipping results showed up. Can you try this is you haven't already? I'm usually in the #drupal-commerce IRC channel if you want to troubleshoot this together.

Thanks,
Andy

deaconblues’s picture

@andyg5000,

Thanks for running through that test scenario and verifying the . I was able to get it running but it took me stepping the source code to see what the problems were. Specifically, I had issues in the following two places in commerce_usps.xml.

// If order contains no weight skip sending request to usps.
  if (!is_array($weight) || $weight['weight'] == NULL) {
      return FALSE;
  }

The code was getting in this statement and closing out correctly, but not giving me any type of message stating that there were no weights associated to the order and that was the reason that it was blank to the screen. I added a weight to each product so that they would not use the default weight from the content type, did a drush cc all, and this item cleared up.

$response = drupal_http_request(variable_get('commerce_usps_connection_address', 'http://Production.ShippingAPIs.com/ShippingAPI.dll'), array('method' => 'POST', 'data' => $request));

I was getting the "RateV4 is not a valid API name" error here as I had an issue with the my credentials and the test/production migration of them. The code behaved correctly but I got a blank screen. A quick call to USPS to get the credentials straightened out cleared this up.

Hope this helps. I'll see what I can do to add some messaging to the areas that I had stumbling blocks with and get a patch for you to review.

andyg5000’s picture

@deaconblues & @creativ180,
It appears that the rules cache and a few other things needed to be cleared after updating the USPS settings form. This is why drush cc all fixes the main issue described above. I've supplied a patch that fixes this and a few other issues. If you have time to test this, it would be appreciated. I'd like to get this committed asap.
Thanks for the help,
Andy

andyg5000’s picture

Status: Active » Needs review
deaconblues’s picture

Priority: Critical » Normal
Status: Needs review » Needs work

@andyg5000,

I tried out the patch for this and I am getting an error in configuration. Note that my instance of the module contains the patch that Brad contributed for the international shipping functionality as this is functionality that we need. After I get all of the required values populated and click "Save" on the configuration, I get an error that states the following:

Notice: Undefined index: commerce_usps_services in commerce_usps_settings_form_submit() (line 136 of /Library/WebServer/Documents/swingsurgeon/sites/all/modules/contrib/commerce_usps/commerce_usps.inc).

if ($services !== $form_state['values']['commerce_usps_services']) {
    commerce_shipping_services_reset();
    entity_defaults_rebuild();
    rules_clear_cache(TRUE);
    menu_rebuild();
  }

In the "!==" area of the conditional statement, I tried "!=" and "==" and still got the same error. If I comment out the conditional statement, the page says it successfully saves but there are no settings that are retained on the screen.

andyg5000’s picture

@deaconblues, sorry the patches are incompatible. I will update the add international issue that it needs to be re-written to work with this patch since this issue represents a bug.

andyg5000’s picture

Title: Documentation On Usage » Cache not properly cleared after settings change
Status: Needs work » Needs review
LonitaD’s picture

I finally got a chance to apply the patch. It looks like it worked, but I am now getting access denied errors from the USPS server. I requested access to the production server and am waiting to hear back from them. I would recommend adding a note in the README about requiring access to the production server. Thank you for your work on this module.

andyg5000’s picture

@creativ180, the module only works with production access. There is really no need to test it. Just request your webtools account and immediately request production access (tell them you are using a 3rd party product).

stopshinal’s picture

I am using these modules: Com Shipping 7.x-2.x-dev & this release of Com Shipping USPS (as is instructed on the front page.)

I've cleared my cache's, run cron, and have yet to find a solution that works. When I go through checkout the shipping page is completely empty.

Now, do I need to apply this patch? And if so, what should I do then?

Thanks for your support!

andyg5000’s picture

Status: Needs review » Fixed

I went ahead and committed this patch to the project. If you're updating to the current dev, be sure to clear the menu cache since the hook_menu in the module has been updated.

http://drupalcode.org/project/commerce_usps.git/commitdiff/bb3cdf0

Status: Fixed » Closed (fixed)

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

jeffpurtle’s picture

How do I apply the patch?

I am having an issue with the USPS shipping not appearing on the Shipping options. I have FedEx and UPS working. So, I know it should be something wrong with USPS module or my settings, which I have checked several times. I have also un-installed and re-installed the USPS module several times and cleared all the cache with the Admin Menu and with Drush several times too.

andyg5000’s picture

Jeff,
Can you enable logging for usps and post the request and response from your watchdog here? Be sure to take out any sensitive info.