Zen Cart Logo
Forums / Addon Shipping Modules / Fedex Freight Module ported from OsCommerce

Fedex Freight Module ported from OsCommerce

Locked

Views: 8,715

Results 1 to 20 of 20
This thread is locked. New replies are disabled.
21 Jan 2008, 5:59 AM
#1
chadderuski avatar

chadderuski

Totally Zenned

Join Date:
Apr 2006
Location:
Dark Side of the Moon
Posts:
986
Plugin Contributions:
0

Fedex Freight Module ported from OsCommerce

Hi,

I am working on porting the Fedex Freight Module from OsCommerce. I am getting stuck on one section of code that queries the products table for several fields that have been added (most importantly freight class). But for some reason I am not getting the data back or not processes the query results correctly:

Excerpt of the problem area:

//Get the shopping cart contents
$products = $_SESSION['cart']->get_products();
$url_attr = '';
$x = 1;
$fxf_urls = array();
$n = sizeof($products);
for ($i=0; $i<$n; $i++) {
    $prod_query = $db->Execute("select products_fxf_class, products_fxf_desc, 
	products_fxf_nmfc, products_fxf_haz, products_fxf_freezable FROM " . 
	TABLE_PRODUCTS . " WHERE products_id = '".$products[$i]['id']."'");

// this doesn't work 
//    $prod_info = array();
//    while (!$pro_query->EOF) {
//      $prod_info[] = $pro_query->fields['products_id'];
//      $pro_query->MoveNext();
//    }

// this query doesn't work and throws a mysql error		 
   $prod_info = $db->Execute($prod_query);
// this is the original code 
// $prod_info = tep_db_fetch_array($prod_query);
		  
// prep XML request class, weight, pcs, descr, nmfc, haz, freezable
		  
     $url_attr .= '&as_class' . $x . '=' . $prod_info['products_fxf_class'];
     $url_attr .= '&as_weight' . $x . '=' . $products[$i]['quantity'] * (int)$products[$i]['weight'];
      $url_attr .= '&as_pcs' . $x . '=' . $products[$i]['quantity'];

I tested the query in phpMyAdmin, and it seems correct. But I am having trouble getting the data from $prod_query...

I hope someone can show what I am doing wrong. I am very close to finishing this, and the other areas of the port seem to be working.

21 Jan 2008, 8:29 PM
#2
chadderuski avatar

chadderuski

Totally Zenned

Join Date:
Apr 2006
Location:
Dark Side of the Moon
Posts:
986
Plugin Contributions:
0

Re: Fedex Freight Module ported from OsCommerce

Could an admin move this thread to "community contributed add-ons > shipping modules" ??? I seem to have posted in the wrong section.

Thanks!

21 Jan 2008, 9:34 PM
#3
Kim avatar

Kim

Obaa-san

Join Date:
Jun 2003
Location:
West Coast, North America
Posts:
26,627
Plugin Contributions:
0

Re: Fedex Freight Module ported from OsCommerce

Have you contacted Fedex to get permission to use any images of their logos? Do you have a Fedex developer's license?

23 Jan 2008, 9:36 PM
#4
chadderuski avatar

chadderuski

Totally Zenned

Join Date:
Apr 2006
Location:
Dark Side of the Moon
Posts:
986
Plugin Contributions:
0

Re: Fedex Freight Module ported from OsCommerce

Kim:

Have you contacted Fedex to get permission to use any images of their logos? Do you have a Fedex developer's license?

Kim: thanks for moving the thread.

I have registered with FEDEX through our company's account. They sure are more picky about things than UPS!

We'll see where it goes once I have it working.

DID anyone look at the first post and have an idea what I'm doing wrong? I tried several different methods but none are quite working.

$prod_info = $db->Execute($prod_query);

either throws an error or returns nothing...??? But the same/similar code elsewhere works correctly.

Ideas?

Incidently, I am also working on a freightquote.com interface.

26 Jan 2008, 9:30 PM
#5
the_ancient avatar

the_ancient

Zen Follower

Join Date:
Mar 2007
Posts:
120
Plugin Contributions:
1

Re: Fedex Freight Module ported from OsCommerce

chadderuski:

Kim: thanks for moving the thread.

I have registered with FEDEX through our company's account. They sure are more picky about things than UPS!

We'll see where it goes once I have it working.

DID anyone look at the first post and have an idea what I'm doing wrong? I tried several different methods but none are quite working.

$prod_info = $db->Execute($prod_query);

either throws an error or returns nothing...??? But the same/similar code elsewhere works correctly.

Ideas?

Incidently, I am also working on a freightquote.com interface.
Now you know why most ecommerce site use UPS:wink:

I have yet to get any fedex web service to return the proper discount rates, and as of today I get 3 different "list" rates, Our ship manager Software Returns one set, fedex.com returns a different price for the same shipment, and finally the web service returns an even different price for the same shipment:blink:

I am about Fed Up with FedEx

26 Jan 2008, 9:38 PM
#6
merlinpa1969 avatar

merlinpa1969

Totally Zenned

Join Date:
Mar 2004
Posts:
13,031
Plugin Contributions:
4

Re: Fedex Freight Module ported from OsCommerce

Blame Fedex NOT the code though,
the ZC mod for Fedex returns ONLY published rates for ######## to and from post codes and weight
doesnt take dimension into account

Where if you use ship manager you get shown published rates with dimension support

and the fedex website shows your discount list rates

27 Jan 2008, 5:07 AM
#7
the_ancient avatar

the_ancient

Zen Follower

Join Date:
Mar 2007
Posts:
120
Plugin Contributions:
1

Re: Fedex Freight Module ported from OsCommerce

Merlinpa1969:

Blame Fedex NOT the code though,
the ZC mod for Fedex returns ONLY published rates for ######## to and from post codes and weight
doesnt take dimension into account

Where if you use ship manager you get shown published rates with dimension support

and the fedex website shows your discount list rates

I am not blaming the code, Infact I am trying to write a module based on the better supported SOAP service from fedex, Fedex does not "offically" support DC anymore (I dont think)

regardless Fedex's different service APIs all return different rates, Fedex.com, ship manager, and the Web Service. this is KNOWN problem (read other forums on fedex crap if you dont believe me) and fedex has no intentions of fixing or even acknowledging the problem exists

28 Jan 2008, 3:49 AM
#8
the_ancient avatar

the_ancient

Zen Follower

Join Date:
Mar 2007
Posts:
120
Plugin Contributions:
1

Re: Fedex Freight Module ported from OsCommerce

Ok, After my rant I figured I should come back and update on what I have figured out..

After doing alot of research today, and allot of trial and error, I have come with with where most of my rate discrepancies where coming from, the current fedex modules need serious updating.

Anyway I am going to rewrite both the currrent modules to add in much needed functionality, in addition (this is where it ties in to this thread) the class I found that I am going to make use of has Freight Functionality built in and will enable to me create a Fedex Freight module.

I hope to have all 3 released for testing by the end of the week (beginning of next week at the lastest)

28 Jan 2008, 4:46 AM
#9
merlinpa1969 avatar

merlinpa1969

Totally Zenned

Join Date:
Mar 2004
Posts:
13,031
Plugin Contributions:
4

Re: Fedex Freight Module ported from OsCommerce

Best of luch wioth the fedex modules,
you will soon realize why I stopped messing with then ,
Fedex changes their rules every few days,

please remember to get yourself a contact at fedex identity,
since before you can release a module you will need their permission to do so. ( something to do with trademark infringment )

just out of curiosity, whats the reason for the rewrite of the current modules?

28 Jan 2008, 5:05 AM
#10
the_ancient avatar

the_ancient

Zen Follower

Join Date:
Mar 2007
Posts:
120
Plugin Contributions:
1

Re: Fedex Freight Module ported from OsCommerce

Merlinpa1969:

Best of luch wioth the fedex modules,
you will soon realize why I stopped messing with then ,
Fedex changes their rules every few days,

please remember to get yourself a contact at fedex identity,
since before you can release a module you will need their permission to do so. ( something to do with trademark infringment )

just out of curiosity, whats the reason for the rewrite of the current modules?

there is a lack of support for many of the line item surcharges, list rates, and other items

the module as written only returns Base + Fuel, which does not accurately reflect true charges

As far as their Legal People, let them sue me, I dont care, if they give me too much grief I will only use it for internal projects, and People can keep using the more user friendly UPS

28 Jan 2008, 5:56 AM
#11
the_ancient avatar

the_ancient

Zen Follower

Join Date:
Mar 2007
Posts:
120
Plugin Contributions:
1

Re: Fedex Freight Module ported from OsCommerce

Also to make the module more manageable I am switching from Tagged Transaction, to the XML model.

This will make the code easier to adjust and manage as fedex constantly changes things...:yes::yes:

28 Jan 2008, 6:28 AM
#12
chadderuski avatar

chadderuski

Totally Zenned

Join Date:
Apr 2006
Location:
Dark Side of the Moon
Posts:
986
Plugin Contributions:
0

Re: Fedex Freight Module ported from OsCommerce

Merlinpa1969:

please remember to get yourself a contact at fedex identity,
since before you can release a module you will need their permission to do so. ( something to do with trademark infringment )

Ancient: This is not a big deal. But you need permission to use their logos. Also, if your going to DO this, put in an option for account numbers. Any larger company will have an account and negotiated rates.

This would be handy also in the UPS module. I have found that UPS freight much much less than FedEx Freight. UPS is more in line with other LTL shippers like Yellow, Old Dominion, etc.

Really wish I knew what I am doing in that code in 1st post that is wrong... anyone?

-chaddro

28 Jan 2008, 1:18 PM
#13
the_ancient avatar

the_ancient

Zen Follower

Join Date:
Mar 2007
Posts:
120
Plugin Contributions:
1

Re: Fedex Freight Module ported from OsCommerce

chadderuski:

Ancient: This is not a big deal. But you need permission to use their logos. Also, if your going to DO this, put in an option for account numbers. Any larger company will have an account and negotiated rates.

This would be handy also in the UPS module. I have found that UPS freight much much less than FedEx Freight. UPS is more in line with other LTL shippers like Yellow, Old Dominion, etc.

Really wish I knew what I am doing in that code in 1st post that is wrong... anyone?

-chaddro

I would happy help with that, i dont see anything standing out to me, post the mysql errors, in full, so i can see what exactly is happening.

Back on the Fedex Rant, Why do they need soo many different options for more or less the same service, In researching the Freight Module for my client I have found they have

Fedex Express Frieght
Fedex Ground Multi=Package Frieght
Fedex Freight (LTL)

#####, and all of them use different APIs and web services :censored::censored::censored:

EDIT: Moderator note: aggressive language censored

28 Jan 2008, 5:12 PM
#14
chadderuski avatar

chadderuski

Totally Zenned

Join Date:
Apr 2006
Location:
Dark Side of the Moon
Posts:
986
Plugin Contributions:
0

Re: Fedex Freight Module ported from OsCommerce

Ancient:

I sent you a pm with a link to the two files. Thanks for taking a look!

-chaddro

28 Jan 2008, 7:40 PM
#15
mauryg avatar

mauryg

Zen Follower

Join Date:
Jul 2006
Posts:
213
Plugin Contributions:
0

Re: Fedex Freight Module ported from OsCommerce

Merlinpa1969:

Best of luch wioth the fedex modules,
you will soon realize why I stopped messing with then ,
Fedex changes their rules every few days,

I was considering asking Merlin to add a feature to the Fedex modules, but since he has abandoned the project, I will put in my 2 cents to whomever is brave or foolhardy enough to do it.

REQUEST: could we have the ability to select WHICH services we want quoted like the UPS and USPS modules? :thumbsup:

28 Jan 2008, 7:57 PM
#16
the_ancient avatar

the_ancient

Zen Follower

Join Date:
Mar 2007
Posts:
120
Plugin Contributions:
1

Re: Fedex Freight Module ported from OsCommerce

mauryg:

I was considering asking Merlin to add a feature to the Fedex modules, but since he has abandoned the project, I will put in my 2 cents to whomever is brave or foolhardy enough to do it.

REQUEST: could we have the ability to select WHICH services we want quoted like the UPS and USPS modules? :thumbsup:

That is one of the things I am putting in mine as well, it will probably not be on the admin however for the first release, but I will provide documentation on how to turn off the services

28 Jan 2008, 8:52 PM
#17
merlinpa1969 avatar

merlinpa1969

Totally Zenned

Join Date:
Mar 2004
Posts:
13,031
Plugin Contributions:
4

Re: Fedex Freight Module ported from OsCommerce

If you look in the files them selves just comment out what you dont want displayed

30 Jan 2008, 6:49 PM
#18
chadderuski avatar

chadderuski

Totally Zenned

Join Date:
Apr 2006
Location:
Dark Side of the Moon
Posts:
986
Plugin Contributions:
0

Re: Fedex Freight Module ported from OsCommerce

Well! I figured it out... SORT OF!

$n = sizeof($products);
for ($i=0; $i<$n; $i++) {
	$products_id = $products[$i]['id'];
       	$prod_query = $db->Execute("select products_fxf_class, products_fxf_desc, 
	products_fxf_nmfc, products_fxf_haz, products_fxf_freezable FROM " . 
	TABLE_PRODUCTS . " WHERE products_id = '".$products[$i]['id']."'");
	
while (!$prod_query->EOF) {
   // was trying to use this, but it didn't work ...???
   // $prod_info[] = $pro_query->fields['products_id']; 
   $prod_query->MoveNext();
}

//class, weight, pcs, descr, nmfc, haz, freezable
		  
$url_attr .= '&as_class' . $x . '=' . $prod_query->fields['products_fxf_class'];
          $url_attr .= '&as_weight' . $x . '=' . $products[$i]['quantity'] * (int)$products[$i]['weight'];
$url_attr .= '&as_pcs' . $x . '=' . $products[$i]['quantity'];

if (trim($prod_info['products_fxf_desc']) != '') {
     $url_attr .= '&as_descr' . $x . '=' . urlencode($prod_query->fields['products_fxf_desc']);
}
if (trim($prod_info['products_fxf_nmfc']) != '') {
     $url_attr .= '&as_nmfc' . $x . '=' . urlencode($prod_query->fields['products_fxf_nmfc']);
}
if (trim($prod_info['products_fxf_haz']) != '') {
    $url_attr .= '&as_haz' . $x . '=' . $prod_query->fields['products_fxf_haz'];
}
if (trim($prod_info['products_fxf_freezable']) != '') {
    $url_attr .= '&as_freezable' . $x . '=' . $prod_query->fields['products_fxf_freezable'];
}          

//Six is the maximum number of products that FedEx will take at a time.
if ($x >= 6) {
  $fxf_urls[] = array('pcs' => '6', 'url' => $base_URL . $url_attr);
  $x = 1;
  $url_attr = '';
} else {
   $x++;
}
}

I am getting correct rates back now. But it still needs work. Unless I raise the maximum shipping weight, the Estimator want to break down the shipment into multiple packages... that doesn't work for podiums!

And I need to figure this part out:

while (!$prod_query->EOF) {
   // was trying to use this, but it didn't work ...???
   // $prod_info[] = $pro_query->fields['products_id']; 
   $prod_query->MoveNext();
}

How do I fix this section of code so I can reference with

$prod_info['products_fxf_class']

Thanks for the help!

30 Jan 2008, 7:45 PM
#19
the_ancient avatar

the_ancient

Zen Follower

Join Date:
Mar 2007
Posts:
120
Plugin Contributions:
1

Re: Fedex Freight Module ported from OsCommerce

Nothing in that code breaks the package down by shipping weight, the module as written creates a pallet for each type of item, so if you have the follow order

100 Widgets
200 Fidgets

the module would get a price to ship 1 Pallet of 100 Widgets and 1 Pallet of 200 Fidgets (which is one of the problems I have with it, as I ship mixed pallets. so I would have 1 pallet of 300 pcs)

If you using the "Shipping Estimator" Page shown at the bottom of the check out, you will need to edit the shipping estimator not the shipping module

16 May 2008, 3:50 PM
#20
lawdlee avatar

lawdlee

New Zenner

Join Date:
May 2008
Posts:
1
Plugin Contributions:
0

Re: Fedex Freight Module ported from OsCommerce

Does anyone have a working FedEx Freight module?

I looked everywhere in the forum and can't find anything on it yet.

My client has a Fedex account and shippes by FedEx Freight only and my PHP skill isn;t good enough to tackle it.