dhs13 Posted July 2, 2003 Posted July 2, 2003 I am looking for a shipping module that would work with Roadway Express and/or Conway(CCX). We ship large items with these 2 carriers. I need automate the frieght charges with our discount,round the near highest dollar and add an additional about and then show that amount to the customer. Thanks
mgraphics Posted July 4, 2003 Posted July 4, 2003 From Roadway: We offer a rate quote hyperlinkthat accesses Roadway's public rates and returns HTML. This returns Roadway's page. or Roadway also offers a customer-specific rate quote API that returns an XML data stream containing freight charges. -if you're a paying Roadway customer I talked to them recently and a generic (non-customer specific) XML is in the works. I tried to motivate them by telling them what a large community there was here! -Doug
dhs13 Posted July 4, 2003 Author Posted July 4, 2003 I also contacted them and Con-Way. Maybe something will happen.
Guest Posted July 8, 2003 Posted July 8, 2003 If they have a table rate sheet you can create a shipping module that will seve until the XML part is resolved
dhs13 Posted July 8, 2003 Author Posted July 8, 2003 Here is some PHP code for Conway-ccx. It was furnished by the carrier. Here is some sample PHP code that will execute the XML based Con-Way rating application. Please contact us if you have any questions. Thank you, ---------------------------------------------------------------------------- --------- <?php // replace the "userId" & "passWd" String values with your Con-Way username and password $userId = "userId"; $passWd = "passWd"; /* Build Rate Request In actual use, you would probably populate the Rating Request parameters (Weights, Classes, Zip Codes, etc.) from data submitted via an on-line order form or database. For this sample we will just hard code some dummy data. */ $rateRequest="<RateRequest> <OriginZip country="us">97006</OriginZip> <DestinationZip country="us">33179</DestinationZip> <ChargeCode>P</ChargeCode> <DiscountRate>100</DiscountRate> <EffectiveDate>2/13/01</EffectiveDate> <Item> <CmdtyClass>775</CmdtyClass> <Weight unit="lbs">667</Weight> </Item> <Item> <CmdtyClass>100</CmdtyClass> <Weight unit="lbs">555</Weight> </Item> <Accessorial>SSC</Accessorial> <Accessorial>ZHM</Accessorial> <Accessorial>DNC</Accessorial> <Accessorial>GUR</Accessorial> </RateRequest>"; //Convert characters to proper format for post $rateRequest = urlencode($rateRequest); // open synchronous connection to X-Rate servlet // NOTE: you must have the cURL libraries installed with PHP on your server-- // If you need them, see your System Administrator, who can get then at // http://curl.haxx.se/download.html $urlConn = curl_init ("http://www.con-way.com/XMLj/X-Rate"); curl_setopt ($urlConn, CURLOPT_POST, 1); curl_setopt ($urlConn, CURLOPT_HTTPHEADER, "Content-type","application/x-www-form-urlencoded"); curl_setopt ($urlConn, CURLOPT_USERPWD, $userId.":".$passWd); curl_setopt ($urlConn, CURLOPT_POSTFIELDS, "RateRequest=".$rateRequest); ob_start(); curl_exec($urlConn); $rateQuote = ob_get_contents(); ob_end_clean(); /* Parse the response Here we simple redisplay the XML data, but in a real world scenario you will parse the document to locate the data you wish to display or save, such as the net charge, transit time, and disclaimer. */ $parser= xml_parser_create(); xml_parse_into_struct($parser,$rateQuote,$vals,$index); xml_parser_free($parser); // This function will return the value of an element given the $vals and $index arrays, // and the element name function getElementValue($vals,$index,$elName) { $elValue = null; while ( list ( $keys, $values ) = each ($index)) { if ($keys == strtoupper($elName)) { list ( $key ) = $values; while ( list ( $key1, $value1 ) = each ($vals[$key])) { if ($key1 == "value") { $elValue = $value1; } } } } return $elValue; } // Use the above function to get the values you want, e.g. $totalCharge = getElementValue($vals,$index,"totalCharge"); echo "<HTML> <HEAD> <TITLE>Sample PHP for Con-Way XML Rating</TITLE> </HEAD> <BODY> <CENTER> <B><FONT face="arial" size=+1><I>Sample PHP Con-Way Rate Getter</I></FONT></B> </CENTER> <BR> <b>Here is the RateQuote XML output:</b> <BR> <xmp>".$rateQuote."</xmp> <B>Shipping Charges: </B>".$totalCharge ."</BODY> </HTML>"; ?> ---------------------------------------------------------------------------- ----------------------------------------
Recommended Posts
Archived
This topic is now archived and is closed to further replies.