UPS Shipping

13 views
Skip to first unread message

Salman Mehmood

unread,
Aug 20, 2009, 9:00:58 PM8/20/09
to ups-php-discuss
Hi,

Sorry it might sound very absurd but I couldn't understand how to use
Shipping Tool via ups-ship..

Where do I add the data that I want to be sent to UPS, apart from
Access Key, Username & Password, where do I add rest of the data?

Should I add other data into an array and pass it to "buildRequestXML"
function? and then in class.upsShip.php change the dummy data with the
array?

Can anyone guide me if that is how it's supposed to be?

Thanks,
-Salman

Aaron Ryden

unread,
Aug 20, 2009, 10:20:12 PM8/20/09
to ups-php...@googlegroups.com
Hi,

I recently figured all of this out and integrated it with a page using a JSON object.

First, check out tests/ship to see the order things are called in. You have to look at it from an action form posting point of view. Also note that processing a shipment requires 2 calls (and returns) to the UPS server. You cannot debug locally / with a firewall or router (at least I couldn't, but when I deployed the test code to my webserver it worked fine).

Secondly, I added one variable to class.upsShip to hold a JSON generated object variable... and i just plug in $this->objectName->propertyName in the proper ship to fields in XML builder. The data in this file was all hard coded in to provide for the  test script.

Example of what i modified:
class upsShip {
    var $buildRequestXML;
    var $xmlSent;
    var $responseXML;
    var $ShipmentDigest;
    var $person; // added this

$ShipmentConfirmRequestXML->element('Name', $this->person->first.' '.$this->person->last);

Third, in class.ups I removed the parameters from the default constructor and hard coded my xml access key, username, and password into the file.

Hope this helps.

Salman Mehmood

unread,
Aug 20, 2009, 11:04:11 PM8/20/09
to ups-php...@googlegroups.com
Thanks Aaron :)

it really helped, but my boss changed his mind he will do the printing himself just like he used to do (manually via ups web)

Thanks anyways :)

-Salman
Reply all
Reply to author
Forward
0 new messages