Jump to content
greasemonkey

FedEx - Web Services v9

Recommended Posts

I am working with FedEx Automated Labels and I get the following error:

 

"Could not find a FedEx account number. Is FedEx RealTime Quotes installed and configured?"

 

Of course, I had to turn off the old FedEx for this new module.

 

Has anyone fixed this problem? Please let me know what you did to correct.


Anyone can buy a camera... it's what you do with it that counts!

Sticky Pod

www.stickypod.com

Share this post


Link to post
Share on other sites

The FedEx Web services is working on mine, but anyone can help to add the transit time in the Fedexwebservices.php same as the old FedEx1 module? Fedex web site give us this code:

 

 

  $rateReply = $response -> RateReplyDetails;

echo '<table border="1">';

echo '<tr><td>Service Type</td><td>Amount</td><td>Delivery Date</td></tr><tr>';

$serviceType = '<td>'.$rateReply -> ServiceType . '</td>';

$amount = '<td>$' . number_format($rateReply->RatedShipmentDetails[0]->ShipmentRateDetail->TotalNetCharge->Amount,2,".",",") . '</td>';

if(array_key_exists('DeliveryTimestamp',$rateReply)){

$deliveryDate= '<td>' . $rateReply->DeliveryTimestamp . '</td>';

}else if(array_key_exists('TransitTime',$rateReply)){

$deliveryDate= '<td>' . $rateReply->TransitTime . '</td>';

}else {

$deliveryDate='';

}

echo $serviceType . $amount. $deliveryDate;

echo '</tr>';

echo '</table>';

 

printSuccess($client, $response);

}

else

{

printError($client, $response);

}

 

writeToLog($client); // Write to log file

 

Thanks

 

 

I used this code and I have the shipping wieight and Transit Times working with the new fedexwebsiervices.php file.

 

Here are the changes that I made:

 

around line: 204

 

change it to looks like this:

 

case (0):

// Show weight and Qty Start

$show_box_weight = ' <br>(Total Items: ' . $shipping_num_boxes . ' pcs. Total Weight: ' . number_format($shipping_weight,2) . ' lbs)<br>';

// Show weight and Qty End

break;

 

around line: 244

 

change it to look like this:

 

$cost = (float)round(preg_replace('/[^0-9.]/', '', $cost), 2);

//Begin Transit Time or Deliver Time from Fedex

if(array_key_exists('DeliveryTimestamp',$rateReply)){

$deliveryDate = $rateReply->DeliveryTimestamp;

}else if(array_key_exists('TransitTime',$rateReply)){

$deliveryDate= $rateReply->TransitTime;

}else {

$deliveryDate='';

}

//End Transit Time or Deliver Time from Fedex

}

}

}

else

 

and then again around line 260

 

change to the following:

 

$cost = (float)round(preg_replace('/[^0-9.]/', '', $cost), 2);

//Begin Transit Time or Deliver Time from Fedex

if(array_key_exists('DeliveryTimestamp',$rateReply)){

$deliveryDate = $rateReply->DeliveryTimestamp;

}else if(array_key_exists('TransitTime',$rateReply)){

$deliveryDate = $rateReply->TransitTime;

}else {

$deliveryDate='';

}

//End Transit Time or Deliver Time from Fedex

}

 

And Finally around line 284:

 

replace with:

 

$methods[] = array('id' => str_replace('_', '', $rateReply->ServiceType),

// Transit Time Edit Start

'title' => ucwords(strtolower(str_replace('_', ' ', $rateReply->ServiceType . ' : ' . $deliveryDate))),

// Transit time Edit End

'cost' => $cost);

}

}

 

Examples of what I see:

 

FedEx

(Total Items: 1 pcs. Total Weight: 3.85 lbs)

FedEx

Ground Home Delivery : One Day $9.77

Fedex Express Saver : 2012-03-09t19:00:00 $17.28

Fedex 2 Day : 2012-03-08t19:00:00 $18.24

Standard Overnight : 2012-03-07t15:00:00 $30.16

Priority Overnight : 2012-03-07t10:30:00 $35.25

First Overnight : 2012-03-07t08:30:00 $64.63

 

 

I have it working but it shows in a strange format and I need some help making it look better. Any help would be awesome.

 

Evan

Share this post


Link to post
Share on other sites

I would guess that I am not the only one scrambling here to have Web Services working when Fedex drops their Ship Manager in May.

 

What I wanted to do is to apply Web Services V9 on my test site, before installing it on my live site.

 

Previously, I have been able to access Fedex Real Time rates both on my live site and test site.

 

At this point, I am not retrieving any rates on my test site, seeing a message:

 

Fatal error: Uncaught SoapFault exception: [HTTP] SSL support is not available in this build in /usr/local/apache2/htdocs/catalog/includes/modules/shipping/fedexwebservices.php:187\nStack trace:\n#0 [internal function]: SoapClient->__doRequest('<?xml version="...', 'https://gateway...', 'getRates', 1, 0)\n#1 [internal function]: SoapClient->__call('getRates', Array)\n#2 /usr/local/apache2/htdocs/catalog/includes/modules/shipping/fedexwebservices.php(187): SoapClient->getRates(Array)\n#3 /usr/local/apache2/htdocs/catalog/includes/classes/shipping.php(95): fedexwebservices->quote('')\n#4 /usr/local/apache2/htdocs/catalog/checkout_shipping.php(166): shipping->quote()\n#5 {main}\n thrown in /usr/local/apache2/htdocs/catalog/includes/modules/shipping/fedexwebservices.php on line 187

 

 

I called Fedex to ask about the “SSL support” in the error message, and they did not rule out that some modules are written that way - to require an SSL certificate, and I’m not sure if that is the case here. I was referred to their developers’ announcements page, which links to a downloadable certificate at

http://images.fedex.com/us/developer/downloads/prod_cert.zip , which I am not sure on how to install on my test linux and apache environment anyway, if it is in fact the right approach to resolve this.

 

Feedback, anyone?

Share this post


Link to post
Share on other sites

As I had no further feedback, I just tried installing on the live site, and the error does not appear to happen there - maybe this has to do with an SSL certificate not existing on the test site.

Share this post


Link to post
Share on other sites

Well, my programmer was able to install FedEx Web Services with no trouble and it seems to be working other than the fact that the rates are off. It seems the insurance is not being added so has anyone come up with a fix for this?

 

I am also instersted in getting the SmartPost added as well but do not see it available as a selection in the Admin area like the other services. I do see some code for it though in the addon. My Fedex Rep. will be adding it shortly to my account so I want to be able to turn it on when it is available.

Share this post


Link to post
Share on other sites

So how do you actually test the Fedex web services? I have a spot to put the meter# and account# but where does the developer# and password go? Can anyone please help. Thanks.

Share this post


Link to post
Share on other sites

Thank you. after some playing around this seems to work well. it would be nice to be able to increase the domestic vs international rates independantly of one another.

Share this post


Link to post
Share on other sites

Thank you. after some playing around this seems to work well. it would be nice to be able to increase the domestic vs international rates independantly of one another.

 

Were you able to get the insurance working?

Share this post


Link to post
Share on other sites

Hi,

 

we need to discount the Fedex air rates only to stay competitive. We are a small wholesale niche company and have only three competitors in the US, so this is really important to us.

 

I can't see how I would 'unpack' $quotes within the module to adjust the air rates rates only.

 

BTW, we already adjust all quotes (up or down) for individual states but as we do it to the whole quote at the discount stage it shouldn't interfere with whatever we need to do to pick out the air rates.

 

Peter

Share this post


Link to post
Share on other sites

Hi there trying to get this module working and am now getting the following messages

 

fedexwebservices::require_once(http://www.omnitrack.us/includes/library/fedex-common.php5) [function.fedexwebservices-require-once]: failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found inD:\home\Default\omnitrack.us\htdocs\includes\modules\shipping\fedexwebservices.php on line 59

 

Fatal error: fedexwebservices::require_once() [function.require]: Failed opening required 'http://www.omnitrack.us/includes/library/fedex-common.php5' (include_path='.;C:\php5\pear') inD:\home\Default\omnitrack.us\htdocs\includes\modules\shipping\fedexwebservices.php on line 59

 

Anyone have bright ideas. I am on a windows server and am using PEAR SOAP. Soap test script says that it is installed and I am now really confused.

 

Thanks

Edited by davidkinsella

Share this post


Link to post
Share on other sites

Further to my last post, had a play around and now get this message.

 

Fatal error: Uncaught SoapFault exception: [HTTP] SSL support is not available in this build in D:\home\Default\omnitrack.us\htdocs\includes\modules\shipping\fedexwebservices.php:185 Stack trace: #0 [internal function]: SoapClient->__doRequest('<?xml version="...', 'https://gateway...', 'getRates', 1, 0) #1 [internal function]: SoapClient->__call('getRates', Array) #2 D:\home\Default\omnitrack.us\htdocs\includes\modules\shipping\fedexwebservices.php(185): SoapClient->getRates(Array) #3 D:\home\Default\omnitrack.us\htdocs\includes\classes\shipping.php(81): fedexwebservices->quote('') #4 D:\home\Default\omnitrack.us\htdocs\checkout_shipping.php(141): shipping->quote() #5 {main} thrown in D:\home\Default\omnitrack.us\htdocs\includes\modules\shipping\fedexwebservices.php on line 185

 

However, I know I have SSL running. Any bright ideas anyone? Open_SSL seems to be enabled in my php_ini and still running a windows server.

Edited by davidkinsella

Share this post


Link to post
Share on other sites

Thank you. after some playing around this seems to work well. it would be nice to be able to increase the domestic vs international rates independantly of one another.

 

I put this in at line 256. Shouldn't be hard to adjust if you don't ship to too many countries.

 

You can also keep whatever % you already charge as a handling fee. If you charge a flat handling fee just hard code the amount below.

 

We have to change the shipping adjustments frequently -- we have FIERCE competitors in a small niche wholesale market -- so I use a spreadsheet and copy and paste the adjustments.

 

BTW, we used this in the UPS module before we switched to Fedex.

 

 

/* mod: adjust Fedex shipping quote up or down by a set percentage; this mod requires handling fee to be set to % in Fedex module admin.
15 = 15% increase and -15 = 15% decrease
*/
//$state_discounts = array ('CA' => -7.00, 'OR' => -7.00, 'WA' => -7.00, 'AK' => 18.00, 'AL' => 18.00, 'AR' => 18.00, 'AZ' => 18.00, 'CO' => 18.00, 'CT' => 23.00, 'DC' => 23.00, 'DE' => 23.00, 'FL' => 18.00, 'GA' => 18.00, 'HI' => 13.00, 'IA' => 18.00, 'ID' => 18.00, 'IL' => 18.00, 'IN' => 18.00, 'KS' => 18.00, 'KY' => 18.00, 'LA' => 18.00, 'MA' => 23.00, 'MD' => 23.00, 'ME' => 23.00, 'MI' => 18.00, 'MN' => 18.00, 'MS' => 18.00, 'MT' => 18.00, 'NC' => 18.00, 'ND' => 18.00, 'NE' => 18.00, 'NH' => 23.00, 'NJ' => 23.00, 'NM' => 18.00, 'NV' => 18.00, 'NY' => 23.00, 'OH' => 23.00, 'OK' => 18.00, 'PA' => 18.00, 'PR' => 13.00, 'RI' => 23.00, 'SC' => 18.00, 'SD' => 18.00, 'TN' => 18.00, 'TX' => 18.00, 'UT' => 18.00, 'VA' => 18.00, 'VT' => 23.00, 'WI' => 18.00, 'WV' => 18.00, 'WY' => 18.00);
$state_discounts = array ('AK' => -15.00, 'HI' => -15.00, 'CA' => -15.00, 'OR' => -15.00, 'WA' => -15.00, 'AZ' => -10.00, 'NM' => -10.00, 'TX' => -10.00, 'CO' => -10.00);
/*
end mod
*/
	   $cost += $cost*(str_replace('%','',$this->handling_fee)/100);

Share this post


Link to post
Share on other sites

Wow. I really messed this up. Ignore the code in the message above.

 

There's a whole bunch of older adjustments I had commented out and I forgot that we have the adjustments turned off in the test store version! D'UH.

 

Here's the real thing for FedEx that's in our live store.

 

I changed line 119. I have no clue why I did this. Maybe because I was working on this at 4am? I only did this in the FedEx version.

 

$mystate = $state;

 

 

Then I added the mod at around line 254 after

 

	  if(strlen($this->handling_fee)>0)
	  {
	    if(strstr($this->handling_fee,'%'))
	    {

 

/* mod: adjust Fedex shipping quotes for some states up or down by percentage; this mod requires handling fee to be set to % in Fedex module admin.
15 = 15% increase and -15 = 15% decrease
*/
$state_discounts = array ('AK' => -15.00, 'HI' => -15.00, 'CA' => -15.00, 'OR' => -15.00, 'WA' => -15.00, 'AZ' => -10.00, 'NM' => -10.00, 'TX' => -10.00, 'CO' => -10.00);
//original was  $cost += $cost*(str_replace('%','',$this->handling_fee)/100);
 $cost = $cost/100 * (100 + $state_discounts[$mystate]) + 2.75;  // + 2.75 is the $ handling fee
/*
end mod
*/

 

 

 

And here is the UPS version I used before we switched over to FedEx. We didn't charge a $ handling fee on top of the adjustments. I didn't do that strange $mystate thing I did in FedEx.

 

I added the mod at around line 460 after

 

   function _upsDest($city, $stateprov, $country, $postal) {
    $this->_upsDestCity = $city;
    $this->_upsDestStateProv = $stateprov;
    $this->_upsDestCountryCode = $country;

 

 

 

 

/* mod: adjust UPS shipping quote up or down by a set percentage; this mod requires handling fee to be set to % in UPS module admin.
15 = 15% increase and -15 = 15% decrease
*/
$state_discounts = array ('CA' => -7.00, 'OR' => -7.00, 'WA' => -7.00, 'AK' => 18.00, 'AL' => 18.00, 'AR' => 18.00, 'AZ' => 18.00, 'CO' => 18.00, 'CT' => 23.00, 'DC' => 23.00, 'DE' => 23.00, 'FL' => 18.00, 'GA' => 18.00, 'HI' => 13.00, 'IA' => 18.00, 'ID' => 18.00, 'IL' => 18.00, 'IN' => 18.00, 'KS' => 18.00, 'KY' => 18.00, 'LA' => 18.00, 'MA' => 23.00, 'MD' => 23.00, 'ME' => 23.00, 'MI' => 18.00, 'MN' => 18.00, 'MS' => 18.00, 'MT' => 18.00, 'NC' => 18.00, 'ND' => 18.00, 'NE' => 18.00, 'NH' => 23.00, 'NJ' => 23.00, 'NM' => 18.00, 'NV' => 18.00, 'NY' => 23.00, 'OH' => 23.00, 'OK' => 18.00, 'PA' => 18.00, 'PR' => 13.00, 'RI' => 23.00, 'SC' => 18.00, 'SD' => 18.00, 'TN' => 18.00, 'TX' => 18.00, 'UT' => 18.00, 'VA' => 18.00, 'VT' => 23.00, 'WI' => 18.00, 'WV' => 18.00, 'WY' => 18.00);
 if ($country=='US' and tep_not_null($state_discounts[$stateprov])) {
 $this->handling_fee = +$state_discounts[$stateprov];
 }  

// end mod

 

Use at your own risk.

Share this post


Link to post
Share on other sites

I'm having an issue where if a customer orders a lot and the weight exceeds 150lbs (which I believe is the max for FedEx) then it will throw an error. Does anyone know a workaround this?

Share this post


Link to post
Share on other sites

Thanks to all of you for supporting this contribution.

 

Is there a way for admin to edit shipping method in the backend? I don't see any input fields in Edit Order screen.

 

Thanks!


WhatsTheBigIdea.com, Inc.

Bright Ideas for the Web, Print and beyond!

 

100 Dock Street

Saugerties, NY 12477

(845)247-0909

Share this post


Link to post
Share on other sites

The module works on RC2a. We've implemented in numerous client sites. It is not possible that it is calling the wrong FedEx URL. Any issues have to be specific to your site. It is either how y ou installed it or some incompatibility with your specific site setup.

 

If it was me I would uninstall the module in Admin, delete all files and folders. Delete all related configuration entries from my database. Then repeat the installation making sure I put all files in the correct location - specifically the additional/new folders, reconfigure and see what happens.

 

You also need to look in your error log. If the site is not displaying an error then it may be that an error is being logged in error_log. If not then you are going to haev to debug your checkout_shipping process to see where it is stopping.

 

Kym thanks for your help supporting this module. My problem is that there are no input fields for the admin to select/change shiping methods in the order edit page. Any help would be appreciated. Thanks


WhatsTheBigIdea.com, Inc.

Bright Ideas for the Web, Print and beyond!

 

100 Dock Street

Saugerties, NY 12477

(845)247-0909

Share this post


Link to post
Share on other sites

I added


ini_set('display_errors',1);
error_reporting(E_ALL);

right after the opening <?php on the file in question which indicated missing files. My sloppy installation is to blame.

Edited by dave@whatsthebigidea.com

WhatsTheBigIdea.com, Inc.

Bright Ideas for the Web, Print and beyond!

 

100 Dock Street

Saugerties, NY 12477

(845)247-0909

Share this post


Link to post
Share on other sites

All-

 

I will be posting a new and vastly improved version of theis module within a day or two... just a few more details to iron out.

 

- Added "Ship-Seperate" (FedEx Real Time quote users) aka "ready-to-ship" (UPS users) functionality

- added seperate surcharges for ground, express, intl, etc....

- improved the rate presentation with item count, weight, and transit days for ground services.

- Several more minor enhancements

 

If there is anyone with developer coding skills that can help me iron out a few last bugs,,,, I could use a little help. Message me please and I will call you.

 

Almost there....


-Dave

Share this post


Link to post
Share on other sites

@@Roaddoctor if you need help please let me know. I'm in the midst of fixing several bugs. FedEx Real Time Quotes doesn't play well since it relies on the old FedEx API. Shipping prices jump from GROUND to 2nd DAY depending on what is selected in the Web Services v9 configuration settings. Printing of labels doesn't work and so on... I could help out ASAP.


WhatsTheBigIdea.com, Inc.

Bright Ideas for the Web, Print and beyond!

 

100 Dock Street

Saugerties, NY 12477

(845)247-0909

Share this post


Link to post
Share on other sites

I will be posting a new and vastly improved version of theis module within a day or two... just a few more details to iron out.

 

That's great news! Looking forward to it!


- The Jackal

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×