3 replies [Last post]
mmwebdev's picture
Offline
Joined: 11/09/2007
Juice: 25
Was this information Helpful?

Hi folks,

We are deep entrenched in trying to work out problems with the UPS quote functionality in alpha7e. We are using Firebug to try to figure out what goes on when Ubercart posts data to UPS and what is returned. We're not experts on Firebug debugging, DOM, JavaScript, etc., so
we're just starting get oriented with all the parts and pieces we're looking at.

I've read a bit about the jQuery JavaScript library that Ubercart is using (I believe this project is at http://jquery.com/). There is a file, /misc/jquery.js, that I am guessing is the jQuery library.

Unfortunately, this entire .js file's actual code is on one line (line 2). All of the entries in our Firebug Console that have to do with the POSTs to UPS have "jquery.js (line 2)" as their file locations.

The first line of the file, which looks like version control data, is:
// $Id: jquery.js,v 1.6 2006/12/23 21:46:35 dries Exp $

So, at first, I thought it was jQuery version 1.6, but in Firebug we often see a node in (I think) Firebug's DOM inspection pane called "jQuery" with a string "1.0.4". Googling "jQuery 1.0.4" seems to support that this is a common jQuery version.

Due to the entire file being on one line, it is "impossible" to debug this file. I tried pretty printing it with a couple JavaScript beautifiers on the web, but all of them were able to format only a small portion of the file at the beginning and gave up quickly.

Questions:

1) What is this code supposed to do? It is difficult to read and has no comments. Comparing its content with a download of "jQuery-1.2.1.js" from the jQuery site seems to show that these are two completely different animals.

2) Does anyone have a beautified copy of it that can actually be debugged (breakpoints etc.) in Firebug?

Any tips or information is much appreciated!

Thanks,

Chuck

Lyle's picture
Offline
AdministratoreLiTe!
Joined: 08/07/2007
Juice: 6846
Re: Question on functionality of jQuery.js file in alpha7e

The jQuery script comes in two different versions, compressed and uncompressed. Drupal comes with the compressed version because it is probably going to be used on a production site and wants to minimize the filesize. You can replace the file /misc/jquery.js with the uncompressed version to allow Firebug to debug it properly. Make sure you match the version numbers, because the version that comes with Drupal isn't necessarily the latest version of jQuery.

That isn't really important to what you're trying to figure out, though. All of the communication with UPS is handled server-side with PHP. The responses are parsed first and then the data is sent to uc_quote.js for display. There is a checkbox on the "Shipping quotes settings" page that allows administrators to see the raw XML that is sent to and received from UPS. This is more useful than Firebug because the angle brackets won't be encoded when you see them.

mmwebdev's picture
Offline
Joined: 11/09/2007
Juice: 25
Re: Re: Question on functionality of jQuery.js file in alpha7e

Thanks for the details on jQuery and you are correct, I am more interested in working through the problem with getting the UPS quotes Smiling

At this point, I feel like I am quite close to having this work correctly and this is the last item I need in order to push this new store live.

I just upgraded from PHP 4.4.7 to PHP 5 and all seems well with Drupal's status report. But, still no dice getting quotes from UPS.

Prior to the upgrade, I was getting some quotes in some cases: http://www.ubercart.org/forum/bug_reports/2012/ups_xml_parse_error_alpha_8 but, now when I check for shipping quotes, I see in Firebug only empty [] returns with no quotes?

The raw XML seems to show just the request but, not the response? (pasting in below with exception of login details...)

<?xml version="1.0" encoding="UTF-8"?>
<AccessRequest xml:lang="en-US">
  <AccessLicenseNumber>xxxxx</AccessLicenseNumber>
  <UserId>xxxxx</UserId>
  <Password>xxxxx</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>01</Code>
  </PickupType>
  <Shipment>
    <Shipper>
      <ShipperNumber>xxxxx</ShipperNumber>
      <Address>
        <City>Wayne</City>
        <StateProvinceCode>PA</StateProvinceCode>
        <PostalCode>19087</PostalCode>
        <CountryCode>US</CountryCode>
      </Address>
    </Shipper>
    <ShipTo>
      <Address>
        <StateProvinceCode></StateProvinceCode>
        <PostalCode>95920</PostalCode>
        <CountryCode>US</CountryCode>
      </Address>
    </ShipTo>
    <ShipFrom>
      <Address>
        <StateProvinceCode>PA</StateProvinceCode>
        <PostalCode>19087</PostalCode>
        <CountryCode>US</CountryCode>
      </Address>
    </ShipFrom>
    <ShipmentWeight>
      <UnitOfMeasurement>
        <Code>LBS</Code>
      </UnitOfMeasurement>
      <Weight>0.125</Weight>
    </ShipmentWeight>
    <Service>
      <Code>03</Code>
      <Description>UPS Ground</Description>
    </Service>
    <Package><PackagingType><Code>02</Code></PackagingType><PackageWeight><UnitOfMeasurement><Code>LBS</Code><Description>Pounds</Description></UnitOfMeasurement><Weight>0.125</Weight></PackageWeight><PackageServiceOptions><InsuredValue><CurrencyCode>USD</CurrencyCode><MonetaryValue>5</MonetaryValue></InsuredValue></PackageServiceOptions></Package></Shipment>
</RatingServiceSelectionRequest>

I am running Drupal 5.3, Alpha 7e. UPS module:
... packaging script on 2007-10-04, ... datestamp = "1191510012"
I also noticed when reviewing list of required modules, that I do not have Workflow-ng installed. Is this needed for UPS module to work?

Not sure where to start here. Any additional help solving the UPS problem is much appreciated,
KIM Smiling

Lyle's picture
Offline
AdministratoreLiTe!
Joined: 08/07/2007
Juice: 6846
Re: Re: Re: Question on functionality of jQuery.js file in alpha

Workflow-ng is required for alpha 8 and higher, so that's not really the issue here. I can't keep track of more than one version, though, so I can't be much help unless you upgrade.

Check the watchdog tables. There ought to be a reason why you aren't getting a response back from UPS. One thing that comes to mind is that your server has to be able to make secure connections with SSH. That's the main reason why I can't test the UPS module on my local test site.