It's a Freebie: A FedEx module for Prestashop

If you're not a web developer this probably won't interest you (seriously it's a little geeky). But if you're a developer working with the Prestashop ecommerce platform, this little module might just save you a decent bit of development time.

We're giving away a Prestashop FedEx module we created that enables shipping price calculations based on the FedEx API. This FedEx module also has a fall-back mode if the UPS shipping module is also installed. This release is compatible with Prestashop 1.2

Here's the steps you'll need to set it up:

  1. Download zip package.
  2. Upload 'blockfedex' folder to your modules directory.
  3. Upload Carrier.php to classes folder (make a backup of your copy first!)
  4. Upload fedexRate.php to classes folder
  5. Install the module through the Prestashop admin, entering in your account details from FedEx: key, account number, etc.
  6. Set your shipping (under the 'shipping' tab) to be "according to total weight" (the only way that FedEx can calculate shipping prices)

You can download the Prestashop FedEx module here: http://files.neboweb.com/releases/FedExModule.5.zip

Enjoy!

Written by Emily Winck on November 11, 2009

Comments

Add A Comment
Happy says:

fedex shipping module show free shipping, how to configure this module.
anyone help?

thanks

Emily says:

Hi Dan,
Have you checked to make sure your shipping (under the ‘shipping’ tab) is set to be “according to total weight” (the only way that FedEx can calculate shipping prices)? You can also try debugging it by uncommenting line 92 of classes/fedexRate.php to see the raw XML that FedEx is returning.

gdinari/Franck - unfortunately we've stopped using Prestashop for the most part, so we're no longer developing this plugin for the newer versions of Prestashop.

Dan says:

hoping this is still monitored. Not getting any shipping fee results. set everything in backend correctly (AFAIK).

Are there any detailed setup instructions available??

Franck Aknin says:

Hi everyone,

I have the same problem as Gdinari. There is a new release of the Fedex module which will fix that bug?

Thank you for your future solution.

gdinari says:

I need help with this module. I know its out dated, but I got it to work on prestashop 1.3.1. Ive updated to 1.3.2 and can't seem to get the shipping options to show.

I even tried adding the options directly into the database and still nothing shows up.

This is the only thing I need to finish for a project. Any word from the developer or somebody who can help with this problem?

Thanks a lot.

Shad says:

The link to the fedex module is returning a 404 error.

Sean says:

Emily, I'm running the same version as Chris. I'll test it with his "edits" and let you know if it gets fixed.

Chris says:

Hi all,

I did some digging today and found the causes of the 2 main issues I was having. I will post them here in case others are having similar issues.

The first was that Fedex shipping methods were not being added correctly from the configure screen. I would get the new shipping method under the "shipping" tab but no corresponding entry in "configure shipping methods" or the ps_fedex_method database table. This is because the function to add new shipping methods to the database would submit without the "id_carrier" field and then try to update, but id_carrier had no default value so the first query would error out and the second would do nothing.
So to fix this problem, go into the database under ps_fedex_method and add a default value for id_carrier, I used NULL.

The second was that the fedex shipping methods would always return "free" on the orders screen. This is because I had arbitrarily put in 300kg as the weight for my test product and it was out of range for the fedex API. There is a very handy line for debugging on line 94 of Classes/fedexRate.php

echo "".$this->xmlreturndata."";

If you uncomment this, it will show you the return xml from FedEx which is invaluable in debugging.

Hopefully this helps someone, nice module guys! Even though it was a little rocky it still saved me a ton of time.

Emily says:

Chris,
The latest version I've tested it with is 1.1. It may need reworking for later versions - Sean, what version are you running?

Chris says:

sorry I meant 1.2.5

Chris says:

Hi Emily, thanks for the response

Yes the test link works and seems to be giving the correct info.

I am using Prestashop version 1.5, is the module incompatible with this version?

Emily says:

Chris & Sean -
Does the 'test' link from the administration section work and show reasonably shipping prices?

Chris says:

I'm having the same issue as Sean

Thanks so much for your work on this module!

Sean says:

So I installed this module for canada, and I've got the test key and authentication and everything works.
I added a couple of shipping options through the module, but regardless of what I do the shipping charges are always showing as Free.

I made sure to make it as "by weight" and that the "FS" is set to NO. My "Free Shipping" limit is also set to 0 to disable it anyway.

Any ideas?

Emily says:

Emoti, is your shipping set to calculate "according to total weight"?

Emily says:

Justin, I'm not sure where you heard this is US only, but it should work internationally.

Emoti says:

"http://www.west-wind.com/wwThreads/Message2BF0LDCF9.wwt"

The API call works fine in Test Mode, but gives the error above in live mode!! poof.. :-/

Emoti says:

Okay.. now here is an issue..
The value being returned by the rate() function in fedexRate.php is returning the value ""..

I am still trying to work out as to what is the value that I should be putting up for $firstclassmt..

..

Emoti says:

Here's some further debug information. The page turns blank "after" adding a Shipping method. On deleting the Shipping method, the standard flat rate is being applied, and there is no blank screen.

I am not sure, but, could it be the Response Parsing which is failing? We have v8 of the API available now, which the one used here is v6. Maybe the data returned from the Fedex servers is different for both the versions..

Will let everybody know in case I hit upon a solution soon enough.. ;-)

Regards,
Emoti

Emoti says:

Is there a way to monitor as to when the Web Service call is being made? Some logging or something which indicates this, maybe..

Emoti

Emoti says:

Hi,

This is a fantabulous effort, and I can't thank you enough for releasing this. I have set this module up exactly as suggested, and with as little changes as possible to my Prestashop implementation.

Good News: Test works fine, and gets me a response. Initially, I was getting the standard Shipping costs configured in Prestashop or Free as the case may be. I disabled FS as suggested above.

Here is where the fun begins, I ran into the exact same issue as Irene. The page turns blank after the second stage in the checkout process. I would appreciate any help.

In case there is a logging mechanism where I can look up the logs, I would be happy to dig out the issue, and share it with everybody.

Thanks again..
Emoti

Justin says:

Someone said this module is US only, is that true?

irene says:

Just installed this mod - when clicking the Test Settings link in admin I get a completely blank page. I only have Ground enabled for US right now. Using test customer account and am getting Free where price should be... Any ideas?

Emily says:

Hi Sean,
Give it a try - it should work. I've tested with international origins and destinations, and it seems to calculate correct shipping. I haven't used it in production for international shipping, however. Let us know if it works for you!

Sean says:

Any idea if this will work for us in Canada? I've not downloaded the file to have a look at it yet.

Emily says:

Hey Mike,
You can use the 'test settings' link from the admin to see the full output of what's going on when the module tries to communicate with FedEx. The other thing I would suggest is looking at the 'origin zip code' set in the module configuration. This should be the zip code from where you're shipping. Hope this helps!

Mike says:

I got this up and running, but I am having some problems- I got it running with an api, developers key, all of that jazz, with fedex tech support help.

The problem is that now, the shipping calculations are way off. A customer ordered an item with 2 day shipping. The calculator charged them $45 for it. My supplier says it should be about $65. FEDEX says it should have been no more than $25, and they have no idea why it’s calculated so wrong. They asked if prestashop has a “debug mode”

HELP!! Any clues?

Emily says:

Enigmarokker - glad to see that you've figured out some of the issues. 'FS' means 'free shipping' - if you have free shipping enabled above $50, for example, changing 'FS' to 'yes' for Ground shipping will use Ground as the free shipping method.

In live mode, this module still doesn't create orders within FedEx - it is still used to calculate shipping costs only. However, FedEx might have some limitations on how many quotes you can request per day in dev mode.

To add additional shipping methods, open modules/blockfedex/blockfedex.php. On lines 251-255, you should see code like 'FedEx Ground'. For each additional shipping type you'd like to add, insert an additional line in the same format. FedEx has particular codes for each shipping type, which you can look up by logging into the FedEx developer site (https://www.fedex.com/wpor/web/jsp/drclinks.jsp?links=techresources/getstarted.html) and downloading the 'documentation (pdf) for rate available services' - looks like page 233 has the list of all available codes.

Enigmarokker says:

Okay I've figured it out... My questions above about "Live" and what is "FS" are still in affect is someone could please respond to those?

However, I think I found the answer to my solution, (and a possible bug?) with this module.

I can setup the FedEx API module easily, run the test using the "test key" and it comes back fine...add the fedex ground, and the 2 day for example and apply them both... At this point everything works fine...

However, what I was doing was going to >>Back Office >> Shipping >> Carriers and then going into "FedEx Ground" for example, and adding a description like (3 to 5 day) to it, and then simply save this. It was doing this simple task, that was breaking the shipping from working, and all it would give me in the front end checkout was something "There are no available carriers for your region" or something to that degree.

Simply going into Back Office >> Shipping >> Carriers >> FedEx Ground and not making ANY changes and just clicking on the SAVE button seems to also ruin the FedEx Ground option from the front end of my cart.

I'm just happy that I solved this "problem" for now (simply dont make any change to the carrier that gets created haha)...is there a way you guys can fix this so we can add descriptions to each carrier without it breaking?

REALLY important question please... Is it difficult for me to add more FedEx options like Next Day and Air Saver etc? How can this be done?

Thank you so much once again for your time. - enigmarokker

Enigmarokker says:

A followup to my previous question... It looks like whenever I go into "FedEx Ground" and set out-of-range behavior to "Disable Carrier" I noticed that in my cart it's no longer showing the carrier FedEx Ground as if I'm not shipping within the US...but I AM logged in as a fake US user within Massachusetts...

I also noticed that when I go into the FedEx Ground properties under Back Office >> Shipping >> Carriers... that it will let me check off Zone: US The zone in which this carrier is to be used - HOWEVER even after I save the page, the Zone: US is NOT staying checked off.

Please advise. I REALLY need this to work. Thanks so much =) - Dave

Enigmarokker says:

Im struggling guys...

I dont need to create live orders for my shipping...however I need to simply calculate the cost of shipping from my drop-shipper (the source zip code) to the customer's zip code, and simply add that to my prestashop's total bill/purchase for the order... I'm assuming thats possible with this module.

I've got my developer test key...input all info into this module and tested everything fine...

But now when I add an item to my cart as a fake logged in user, I can select FedEx ground or FedEx 2nd Day...but it's not giving me any unique shipping costs.

Now whats the next step? Do I need a production key? Do I need to enable the "live" option in this module? What does "FS: No/Yes" mean?

Please help me out, I'd appreciate it greatly =) Thanks!

Emily says:

Hey Mike, try this link: https://www.fedex.com/wpor/web/jsp/drclinks.jsp?links=techresources/develop.html

There are links on that page to obtain a developer test key, and also a link in the left menu to get a production key.

Mike says:

I signed up for an account on fedex, so I have the acct number, etc. But I don't know what the key is...

Mike says:

Sorry if this makes me sound dumb, but when you say enter your key and account number from fedex, what do you mean? How do you get these on fedex?

Emily says:

Hey Adam,
Unfortunately I'm not familiar with this subscription request that is being required. From my experience getting a meter number, although it was kind of confusing, I was able to do so through the FedEx web site, starting with registering for a developer account and then getting a key and account number. http://fedex.com/us/developer/ may be a good starting spot.

Best of luck!
Emily

Adam Wolf says:

Hello, I have installed this module without issue but am getting the runaround when trying to acquire a meter number. Long story short, the phone tech guy at FedEx gave me an e-mail of websupport@fedex.com to get in contact with someone who can give me a meter number and they responded with telling me that I need to submit a "subscription request." The following is a quote from the tech support.

"Customers using FSM API/Direct are required to process a subscription request to obtain the meter number. Most third party shipping modules contain a method of processing this subscription request within the software itself. To find out how to do so with your shipping module, you will need to speak with the developers of the shipping module."

How can I obtain a meter number to get this working?

Thanks,
-Adam

Tarun says:

indian address is says

the Prestashop FedEx Module currently only supports shipping inside the USA

hmmm :)

Emily says:

Ray, have you checked that you have shipping set to calculate by weight, not by price?

Ray says:

Hey,
I installed the module and double checked that I followed all instructions correctly. When I run the test in the back office it says "Transaction processed successfully." But in the front page of the store my shipping always comes up as "Free!" any ideas??

Emily says:

Hi Jim,
I've noticed the same thing. This is a Prestashop issue - any shipping module you have installed will exhibit the same behavior. Obviously it's not ideal, but Prestashop is not a super-polished system yet. The shipping modules are set up to cache the price quotes, however, so theoretically it doesn't have to call the FedEx API every page load. Have you looked to see if it's caching the values?

Glad you are putting the module to use!

Emily says:

Hi Jim,
I've noticed the same thing. This is a Prestashop issue - any shipping module you have installed will exhibit the same behavior. Obviously it's not ideal, but Prestashop is not a super-polished system yet. The shipping modules are set up to cache the price quotes, however, so theoretically it doesn't have to call the FedEx API every page load. Have you looked to see if it's caching the values?

Glad you are putting the module to use!

Jim Beals says:

After a lot of issues, i have got your mod to work on our shopping cart. First issue was the server for our domain did not have SOAP installed. The hosting company had to move us to another server that did. Then, I had to set up the server to allow out-going connections to the FedEx ip url addresses.
Then it was just a matter of getting the meter# and key and password from FedEx.

But, I do have some issues - which may be more PrestaShop related rather then your module. I notice that the FedEx WSDL routine is being called a number of times, such as when you add an item to the cart, or display the cart, I think any time the cart is accessed at all. And, it is being called many iterations per each time. This causes the site to go very slow, as it has to go out and make connection with the FedEx WebServers much more often then really needed. As i said, "i think" that is a PrestaShop issue, but it may be able to circumvent via logic in your module? Only contacting the Fed Ex server when in the correct Step level of the cart?
But, at least your module got me past a hurdle, and for that THANK YOU people a lot.

DJ says:

Im getting a error message

Error in processing transaction.

ERROR
prof
1000
Authentication Failed

Any Ideas?

Chris says:

Hey Mario,

could you give us a little more detailed information? We may not be able to fix it at this time, but your feedback will be useful as we develop the module further. Thanks!

Mario says:

Just can't seem to get this working properly. After a purchase it either says.."There is no carrier available that will deliver to this address", or just cant get it to work at all.

Ewinck 1 1opypva
Written by
Emily Winck
Director of Engineering