Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

FedEx - Web Services v9


greasemonkey

Recommended Posts

He means re-install the old real time quotes API module that uses FEDEX1.... install it, but then set enable to false..

 

yes, that's what I meant. The Real Time Quotes API module still works for most of the backend, just not the shipping rates.

 

I do think that there's a way to cannibalize the old module and use the parts that currently work. If anyone would like to point me in the right direction (files, snippets of code), I will take a crack at improving this module.

Link to comment
Share on other sites

yes, that's what I meant. The Real Time Quotes API module still works for most of the backend, just not the shipping rates.

 

I do think that there's a way to cannibalize the old module and use the parts that currently work. If anyone would like to point me in the right direction (files, snippets of code), I will take a crack at improving this module.

 

I think you'tre mistaken. I get only broken images for labels. Let me know if you have any luck. I am having to manually complete FedEx labels = a big PITA.

Link to comment
Share on other sites

I converted the FedEX labels piece a while back, I don't use the base OSC version so my conversion is not going to work for the mass. I really have no interest in setting up a test environment and re-coding it. I hard-coded most of the values I used and didn't drive it off a module.

 

Here are some pointers.

 

1) When you code against FedEX labels it needs to be done with a test account, Production accounts won't work until it's approved by FedEX.

2) You have to go through a Label Certification Program and send FedEX each type of label you use. When I did it I just did I just did these Labels.

 

$service_type = array();
$service_type[] = array('id' => 'GROUND_HOME_DELIVERY', 'text' => 'FedEx Home Delivery');
$service_type[] = array('id' => 'FEDEX_GROUND', 'text' => 'FedEx Ground Service');
$service_type[] = array('id' => 'PRIORITY_OVERNIGHT', 'text' => 'FedEx Priority Overnight');
$service_type[] = array('id' => 'FEDEX_2_DAY', 'text' => 'FedEx 2day');
$service_type[] = array('id' => 'STANDARD_OVERNIGHT', 'text' => 'FedEx Standard Overnight');
$service_type[] = array('id' => 'FEDEX_EXPRESS_SAVER', 'text' => 'FedEx Express Saver');

 

3) MPS (Multi-Piece Shipments) labels, is not intuitive, that's the tricky part to code. (It wouldn't be so bad, but FedEX documentation is lacking in some area's).

 

4) When you get certified, you have to do a MPS Label and a normal Label for each method you use. So when I got certified it was for 12 labels (6 normal labels and the 6 MPS Labels to go with it). But I also heard of FedEX just approving accounts for the advance services, I wasn't lucky.

 

5) You need to use the "Ship Service Web Service" and the "Track Service Web Service", I guess the track service isn't really needed, but I did that piece of it too.

 

If anyone attempts a module, I can help you get past the tricky parts, but I have no interest in doing it. Once was enough.

 

I'm attaching the tracking piece, it *might* plug in directly. But the other pieces wont.

track_fedex.php

Check out my Community Profile (Click Here)

 

Link to comment
Share on other sites

Hi all. I'm having a strange, albeit common, common issue.

 

We have two servers: one is a localhost testing server, the other is a hosted live server. Everything is virtually identical - same files, same keys, et al. The only real difference is that the dev server is a windows Apache handler server and the live is a Linux Apache CGI server.

 

I called FedEx support on this and that was a waste of time. I spent a majority of the call explaining that both servers were using the same credentials (e.g. production key) however the dev server successfully calls and receives rate quotes (works fine) while the live server never gets through (errors out). Firefox and IE both give blank pages while Chrome gave me a 500 error.

 

Other modules associated with the site include MVS Shipping Cost Estimator V2.0, USPS, Free Shipping Specials, and discount coupons.

 

Any clue why two servers (with the same information) would give different results? Thanks for any insight given.

 

Edit: Forgot to mention: soap_test shows PHP Soap is loaded, files have proper permissions, triple checked keys/acct & meter numbers, triple checked wsdl file to ensure same https URL (ws.fedex.com:443/web-services).

Edited by feralamour
Link to comment
Share on other sites

Many thanks for this contribution! After installing Fedex Web Services 9 on our site (osc 2.2), it seemed to be working fine. But just to be sure I compared the rates which were being quoted on our store with the rates we get simply by logging into the FedEx website. The rates for "FedEx 2 Day" and "FedEx Express Saver" match to the penny. But the rates for "Standard Overnight" and "Priority Overnight" are way off. Just to experiment, I zero'd out all our handling fees, and tried it both with displaying "list" and "account" rates. The numbers do change, but they're still wrong.

 

Here's an example. We currently have the FedEx shipping module set to display ACCOUNT rates, and add a $5 handling charge. Let's use a hypothetical .8 pound package going from Dallas 75227 to Chicago 60601. Our OSC store quotes the following:

Priority Overnight - $46.90

Standard Overnight - $42.66

 

But logging into fedex.com and getting a rate quote for the same package with our same account number, we get:

Priority Overnight - $25.41

Standard Overnight - $23.66

 

Even adding the $5 handling fee to the FedEx quote, you can see that the rates shown on our store are > $15 higher. And yet the rates for FedEx 2 Day and FedEx Express Saver agree perfectly. (These are the 4 services we are offering, so I did not compare any of the other possible rates.)

 

How can this be happening? And, more importantly, can anyone suggest a fix? I would encourage everyone to try a similar test to make certain that the prices you are displaying have some basis in reality. Thanks.

 

i have seen the same issue myself with version 9.4.2: overnight rates that are $6-15 over the rate that the web interface shows. we ship 100s of packages and customers have been complaining about this for the past ~3 weeks.

 

it would be great if roaddoctor or another dev who is familiar with this contrib fixed this.

 

one thing that could be responsible for this rate problem is the .wsdl file used: it's v9 and v10 is current, at least for the label printing.

 

thx for reading :)

Link to comment
Share on other sites

further information that may be of use: this rate increase does not occur with all destination zipcodes, e.g. shipping from 60601 to 94109 gives the correct rate but shipping from 60601 to 03110 is off by about 30%.

 

if there is a newer .wsdl file from fedex i will attempt to use that and see if it helps.

Link to comment
Share on other sites

i believe i have determined the source of the overcharging issue: the line in catalog/includes/modules/shipping/fedexwebservices.php where the PackagingType fedex variable is set.

 

it defaults to YOUR_PACKAGING with the 9.4.2 files, which is obviously inaccurate for websites that ship products via fedex express with fedex-supplied packaging. i added some conditional handling for the PackagingType based on the shipping_weight variable and confirmed it does give the correct quotes.

Link to comment
Share on other sites

i added some conditional handling for the PackagingType based on the shipping_weight variable and confirmed it does give the correct quotes.

 

Can you please post the details of what you changed or added so I can try it?

 

Thank you for (1) confirming that the problem exists and (2) working on a solution.

Link to comment
Share on other sites

FYI - - I've been running this module on a clients site, the site has a very sizable and aged database, some of the old info saved in the addresses was saved under different character encoding and has left the funcky black diamond icon (�) in place of certian characters. Clean up and character encoding work is enevitable, but for the mean time the checkout shipping page would crash if one of those characters existied in the address fields.

 

The solution is posted in this thread some post back, but the use of utf8_encode will allow the characters to pass through the string seemlessly.

 

Also, there is another spin off of this same module located at the CRE loaded site. It has been cleaned up a bit further, the utf8_encode is already in place and with 2 small changes it will work on osCommerce. The changes involve removing the can_install function in 2 places. Just comment them and the closing bracket out and thats it. It works very well. It does not however have dimensions support, though it could easily be added back in.

 

I do not have time to port it back to osCommerce, but this information may be helpful to some.

Link to comment
Share on other sites

I was finally able to get this module working. Turns out that I used my full State name in my deliver from address rather than a two letter abbreviation. Much aggravation for such a simple fix. May I humbly suggest that when this module is updated that the the form is changed to only allow two characters for the State field. It would save a lot of headaches for people like me that make a habit of not abbreviating. Thanks.

Link to comment
Share on other sites

Had an order come through that had only the shipping and handling fee, but no fee for the chosen method (Ground). Anyone else had such a thing happen?

 

I'd like to suggest that we add some logic wherein if the shipping fee = 0 (or null etc), that it throws an error rather than completing. Surprised that wouldn't be in there. Perhaps FedEx servers had a glitch and were functioning, but spitting out blank quotes? odd.

 

I'm digging in further, but thought I'd throw this out there in case I'm not alone.

 

J

Link to comment
Share on other sites

I'm installing v 9.4.2 on what is essentially osCommerce-2.2rc2a (I updated a while back from an earlier 2.2 version). I removed all traces of the old real time quote mod and now I'm instlaling this one. When the purchase process reaches checkout there is an error in place of what should be the shipping method selection, "Error in processing transaction." I've traced this to an if/then statement in fedexwebservices.php around line 355:

 

  if ($this->tax_class > 0) {
	$this->quotes['tax'] = tep_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);
  }
} else {
  $message = 'Error in processing transaction.<br /><br />';
  foreach ($response -> Notifications as $notification) {
	if(is_array($response -> Notifications)) {
	  $message .= $notification->Severity;
	  $message .= ': ';
	  $message .= $notification->Message . '<br />';
	} else {
	  $message .= $notification->Message . '<br />';
	}
  }
  $this->quotes = array('module' => $this->title,
						'error'  => $message);
}

 

Through a little debugging, it appears that $this->tax_class is empty, even though I have a tax class selected in the admin config for the module. It makes no difference if I select a valid class or select none, the error and only that error display. Does anyone have any ideas on where I should go next?

Edited by DavidR
Link to comment
Share on other sites

Thought I'd post my success in fixing the blank page issue I was having. Hopefully, it can help others. After much hair pulling, I realized that the modules/fedexwebservices.php file was looking for both the catalog location and the includes location (lines 60 - 74):

 

 //Class Methods
 function quote($method = '') {
   /* FedEx integration starts */
   global $shipping_weight, $shipping_num_boxes, $cart, $order;
   require_once(DIR_FS_CATALOG . DIR_WS_INCLUDES . 'library/fedex-common.php5');
   //if (MODULE_SHIPPING_FEDEX_WEB_SERVICES_SERVER == 'test') {
  //$request['Version'] = array('ServiceId' =&--#62; 'crs', 'Major' =&--#62; '7', 'Intermediate' =&--#62; '0', 'Minor' =&--#62; '0');
  //$path_to_wsdl = DIR_WS_INCLUDES . "wsdl/RateService_v7_test.wsdl";
   //} else {
   $path_to_wsdl = DIR_FS_CATALOG . DIR_WS_INCLUDES . "wsdl/RateService_v9.wsdl";
   //}
   ini_set("soap.wsdl_cache_enabled", "0");
   $client = new SoapClient($path_to_wsdl, array('trace' =&--#62; 1));

 

It wasn't throwing any errors within the server error logs and was extremely frustrating to snoop out. The following update to the code finally resolved the issue.

 

 //Class Methods
 function quote($method = '') {
   /* FedEx integration starts */
   global $shipping_weight, $shipping_num_boxes, $cart, $order;
   require_once(DIR_WS_INCLUDES . 'library/fedex-common.php5');
   $path_to_wsdl = DIR_WS_INCLUDES . 'wsdl/RateService_v9.wsdl';
   ini_set("soap.wsdl_cache_enabled", "0");
   $client = new SoapClient($path_to_wsdl, array('trace' =&--#62; 1));

Edited by feralamour
Link to comment
Share on other sites

Yes, please post to the contribution: http://www.oscommerce.com/community/contributions,2244

 

You would be helping a lot of people. I'm surprised I haven;lt yet found a fix. It would save me some money, too, since I have it our for bid at: http://www.freelancer.com/projects/PHP-Javascript/Fedex-Automated-Label-for-oscommerce.1685280.html

 

I'd post it for free.

 

Thx.

 

Martin

 

Hi imagixx, I was watching that auction to see what happened, and you posted in the Public Clarification Board:

 

Sorry, I found a commercial solution: http://www.sonicode.com/mercury.php . Since this is a working solution, we do not need a custom solution and will be withdrawing this project. Thank you.

 

Did you have any success with Mercury? I purchased it, am having trouble, and am having serious problems getting a hold of sonicode. The website lists no phone number, just Yahoo IM (he hasn't been online in 2 days), Google Chat (has never accepted my contact request), Skype (has not been online in 2 days), and a mailing address. I've tried all but the mailing address and even tracked down the company president on Facebook. Have sent him 2 messages there.

 

Feedback from anyone else would be welcome.

Link to comment
Share on other sites

I have a question about Insurance using the FedEx Web Services v9 module. I see that there is code included in the module with an apparent defined constant:

 

@[member='definedmedia']('MODULE_SHIPPING_FEDEX_WEB_SERVICES_INSURE', 0);

 

and further down:

 

function _setInsuranceValue($order_amount){
if ($order_amount > (float)MODULE_SHIPPING_FEDEX_WEB_SERVICES_INSURE) {
  $this->insurance = sprintf("%01.2f", $order_amount);
} else {
  $this->insurance = 0;
}
 }

 

The _setInsuranceValue function is called in the module, but it doesn't appear that it changes the value of the returned quote when we change the package value or the value of the defined constant from 0 to any other number.

 

In the previous module/API we were able to define the insurance amount that triggered insurance addition.

 

Can someone confirm or deny that the insurance option is or isn't functioning with the v9 module?

Edited by fourmat
Link to comment
Share on other sites

Ok, I have a working version of Fedex Automatic Labels for Webservices. I have paid a programer to help with the vast majority of the coding... and it is working.

 

I'm looking for a volunteer who has some (I have just a little more than zero) coding experience to refine... and addon a couple features to what I have. It would be helpful if the volunteer already has an approved for printing labels webservices meter number etc (all the new webservices meter numbers are by default NOT approved) - and is using Web Services v9.4.2

 

What I have;

 

- labels printing for all services

 

What I don't have BUT would like to add before releasing are;

 

- upgrade instructions (I don't think I will worry about fresh install instructions for the time being) - I can do this...

- Fedex Tracking - I think this is a must... I need some help intergrating this into the fedexwebservices.php file - I've tried but can't do this... ( have some sample code and a .wsdl file...)

 

On this wish list for future is;

 

- cancelling a label

- I have some printing issues... which are going to require someone much smarter than I...

- storing label files (this may not be possible... talking to Fedex techsupport it seems they don't want the label file being store... However I see no reason why it can't been done... if I had any idea why I was doing... lol

 

If you can help please PM...

 

Not to be rude, however, if you CAN"T help and just want me to release the code that I have paid good money out of my pocket for - please DON'T PM me... I will release the code, please be patient while I work the bugs out.

Link to comment
Share on other sites

I have just uploaded Automated Fedex Labels for Webservices. I thought this would be the best place to have support...

 

Contribution can be found here - as an UPGRADE to Fedex Automated Labels; http://addons.oscommerce.com/info/2244

 

Please keep in mind, I am NOT a coder, and this is NOT my full time job. Hopefully the oscommerce community will take what

I have started and run with it.

 

This all new version is the FIRST draft of Fedex Labels for webservices.

 

There are currently MANY limitations with this contribution; inlcuding (if someone would like to work on these please post);

 

- install instructions (instructions for NEW installs are NOT included)

- Printing Multi Piece Shipments (MPS) with more than 4 labels - I have had to reuse (and duplicated) the fedex-popup_thermal.php to create the proper label format for printing on a 4x6 label

- Tracking

- cancelling a label

- Shipping Manifest

- International Shipping

- printing issues to more and different label formats.

- storing label files - this may not be possible... talking to Fedex techsupport it seems they don't want the label file being stored...

 

The following files are no longer used;

 

- fedexdc.php (neither of them)

- fedex_popup_laser.php (this could be used in the same way I have used "thermal")

 

Tested and working on 2.2 MS2.

 

REQUIRED; FedEx - Web Services v9 - found here; http://addons.oscommerce.com/info/7977

REQUIRED; FedEx Automated Labels 2.0a - found here; http://addons.oscommerce.com/info/2244

Link to comment
Share on other sites

  • 2 weeks later...

Nice catch to make compatible with manual order editor.

Just incorporated the v9 web services into our store

 

Hi all, I installed this for a client who also has the order editor plugin. It failed in one spot, line 129. It was assuming there would be a cart and an order object, but in this case, there is no cart. This is the simple fix:

 

Change line 129 of catalog/includes/modules/shipping/fedexwebservices.php from:

 

$totals = $order->info['subtotal'] = $_SESSION['cart']->show_total();

 

to

 

$totals = $order->info['subtotal'] || $_SESSION['cart']->show_total();

 

HTH,

-Bill

 

I truly appreciate it, now i I can get Fedex to provide the key and password (services are down for 18 hours plus) I might be able to get our store functional again ;)

 

I am going to add some edits to the install instructions, and add them to the contrib.

I found the existing ones a tad understated and confusing.

 

 

Thanks

 

C

Link to comment
Share on other sites

  • 2 weeks later...

Hello,

 

How can I disable the "Total items" and "Total weight" from displaying in rates? Is there an option to add insurance to the rates, especially for international shipments? Also, it always shows "Ground Home Delivery" regardless if the address is residential or commercial. Home deliveries are usually charged extra fees. Is it possible to base the fedex rates for Ground or Home services on Commercial or Residential selection in address book, just like it was in the previous fedex module "Fedex Rates for Residential or Commercial Addresses" add-on?

 

Thanks in advance.

Link to comment
Share on other sites

Can someone help me please I keep seeing on the checkout page "Error in processing transaction" please if anyone knows please tell me how you fixed the problem. Also the fedex button isn't working either. I has installed everything perfect, the address I used to checkout is real, the api and product information is added and good, what can I do to fix the issue?

Link to comment
Share on other sites

I'm not sure if many have had a chance to try my fedex labels for webservices? However, I can't seem to bring the order id over to the label as the INVOICE_NUMBER.

 

Any help out there?

 

Here is the webservices code;

 

 $request['RequestedShipment'] = array(
  'ShipTimestamp' => date('c'),
  'DropoffType' => $fedexRequestData['shipData']['dropoff_type'], // valid values REGULAR_PICKUP, REQUEST_COURIER, DROP_BOX, BUSINESS_SERVICE_CENTER and STATION
  'ServiceType' => $fedexRequestData['shipData']['service_type'], // valid values STANDARD_OVERNIGHT, PRIORITY_OVERNIGHT, FEDEX_GROUND, ...
  'PackagingType' => $fedexRequestData['shipData']['packaging_type'], // valid values FEDEX_BOX, FEDEX_PAK, FEDEX_TUBE, YOUR_PACKAGING, ...
  'TotalWeight' => array('Value'=>$fedexRequestData['pakage_details']['Total_Weight'],'Units'=>$fedexRequestData['pakage_details']['Units']),
  'Shipper' => $shipper,
  'Recipient' => $recipient,
  'ShippingChargesPayment' => $shippingChargesPayment,
  //'CustomsClearanceDetail' => $customsClearanceDetail,																									  
  'LabelSpecification' => $labelSpecification,
  'CustomerSpecifiedDetail' => array(
   'MaskedData'=> 'SHIPPER_ACCOUNT_NUMBER'
  ),
  'RateRequestTypes' => array('ACCOUNT'), // valid values ACCOUNT and LIST
  'PackageCount' => $fedexRequestData['pakage_details']['PackageCount'],
  'CustomerReferences' => array(
   '0' => array(
 'CustomerReferenceType' => 'INVOICE_NUMBER',
 'Value' => $fedexRequestData['order_info']['orders_id']
   )
  )
 );

 

INVOICE_NUMBER is listed in the .wsdl file under CustomerReferenceType

Link to comment
Share on other sites

Well we originally installed osC 2.3, which we now realize was a huge mistake. I've got the site perfect, I've got all the products I want on it, the design is awesome and looks great, and I've got the correct information plugged in from FedEx, I even went into the code and swapped everything that it said to in the "INSTALL.txt" file and I still get this message on the Shipping Page on my Shopping Cart:

 

Deprecated: Function eregi() is deprecated in /home/content/66/9703366/html/catalog/includes/modules/shipping/fedexwebservices.php on line 353

 

Deprecated: Function eregi() is deprecated in /home/content/66/9703366/html/catalog/includes/modules/shipping/fedexwebservices.php on line 353

 

Deprecated: Function eregi() is deprecated in /home/content/66/9703366/html/catalog/includes/modules/shipping/fedexwebservices.php on line 353

 

Deprecated: Function eregi() is deprecated in /home/content/66/9703366/html/catalog/includes/modules/shipping/fedexwebservices.php on line 353

 

Deprecated: Function eregi() is deprecated in /home/content/66/9703366/html/catalog/includes/modules/shipping/fedexwebservices.php on line 353

 

It won't let me finishing checking out, either.

 

Also, sort of unrelated to FedEx I also get this message as well on the same Shipping Page of my Shopping Cart:

 

Deprecated: Assigning the return value of new by reference is deprecated in /home/content/66/9703366/html/catalog/includes/classes/xml_5.php on line 25

 

I even tried to read as much "HTML for Dummies" and "PHP 5 for Dummies" and it helped me understand a little bit more, but I'm still really lost.

 

I'm about to give up and try to go to osC 2.2 and maybe I'll try my hand at Zen Cart, because GoDaddy will give me technical support for it.

 

I've got to get my website online and working well ASAP.

 

When I try to continue to check out I get these messages on a White Screen.

 

Deprecated: Assigning the return value of new by reference is deprecated in /home/content/66/9703366/html/catalog/includes/classes/xml_5.php on line 25

 

Deprecated: Function eregi() is deprecated in /home/content/66/9703366/html/catalog/includes/modules/shipping/fedexwebservices.php on line 353

 

Deprecated: Function eregi() is deprecated in /home/content/66/9703366/html/catalog/includes/modules/shipping/fedexwebservices.php on line 353

 

Deprecated: Function eregi() is deprecated in /home/content/66/9703366/html/catalog/includes/modules/shipping/fedexwebservices.php on line 353

 

Deprecated: Function eregi() is deprecated in /home/content/66/9703366/html/catalog/includes/modules/shipping/fedexwebservices.php on line 353

 

Deprecated: Function eregi() is deprecated in /home/content/66/9703366/html/catalog/includes/modules/shipping/fedexwebservices.php on line 353

 

Warning: Cannot modify header information - headers already sent by (output started at /home/content/66/9703366/html/catalog/includes/classes/xml_5.php:25) in /home/content/66/9703366/html/catalog/includes/functions/general.php on line 45

 

Also, now that I went in and changed around all the code in the two separate categories.php files, I now get these messages in my Admin Panel, and this one wasn't even on there before I changed around code like the instructions said. When I try to click on my products and view them through the admin panel, I get this white screen which says this:

 

Parse error: syntax error, unexpected ';', expecting ')' in /home/content/66/9703366/html/catalog/admin/categories.php on line 405

 

Also, again, unrelated to FedEx, this comes up when I try to look at the shipping after hitting the Module link in the Admin Panel:

 

Deprecated: Assigning the return value of new by reference is deprecated in/home/content/66/9703366/html/catalog/admin/includes/classes/xml_5.php on line 25

 

I will admit that I do not have the correct plug in codes for UPS, yet, so that may be why I see this XML_5 on line 25 message, but I don't know.

 

Can anybody help me? I literally have very little knowledge of what I'm doing, and we're about at our wit's end over here trying to get the shipping modules to work with osCommerce 2.3.

 

What should I do? Just start all over from scratch and run osC 2.2, or should I just go try Zen Cart, because I have Phone Tech support with GoDaddy for Zen Cart?

 

Thanks you for your help in advance.

 

// po box hack by JD

if (eregi("^P(.+)O(.+)BOX",$order->delivery['street_address']) ||eregi("^PO BOX",$order->delivery['street_address']) || eregi("^P(.+)O(.+)BOX",$order->delivery['suburb']) || eregi("^[A-Z]PO",$order->delivery['street_address']) || eregi("^[A-Z]PO",$order->delivery['suburb'])) {

$this->quotes = array('module' => $this->title,

 

There is line 352, line 353, and line 354 of the deprecated file in question. Can anybody help me with that?

 

Thank you.

Edited by EJR914
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...