Jump to content



Latest News: (loading..)

- - - - -

Fedex Zone Contrib version 2.0 ready


  • Please log in to reply
145 replies to this topic

#21   adam5532

adam5532
  • Members
  • 678 posts
  • Real Name:Adam Liberman
  • Location:California, USA

Posted 01 May 2003 - 09:34 PM

The surcharge for FedEx Ground to a residential address is a flat $1.40 accordingto the FedEx web site. Note that FedEx Home Delivery is different than FedEx Ground with the residential surcharge. Home Delivery has extra services available like late delivery and prearranged drop-off times, and is more expensive.

It would be totally cool if the following could be added to the contrib:
1) A flat surcharge amount for the residential surcharge (it isn't a percentage amount) (separate from the Osc shipping surcharge, since I'd use that for packaging costs for any carrier).
2) Detect if the customer's "Company" field is blank or not and automatically display the business or residential rates accordingly.

- Adam

#22   adam5532

adam5532
  • Members
  • 678 posts
  • Real Name:Adam Liberman
  • Location:California, USA

Posted 01 May 2003 - 09:42 PM

Quote

When you convert the pdf to text, there are 3 sets of 2 columns (6 total) of data for most of the zip codes, but for the Alaska, Hawaii, and Puerto Rico zip codes there are 3 sets of 3 columns each.  

The order of the columns in a set for AK, Hawaii, and PR is
zip code range - ground zone - non-ground zone

You'll want to remove the ground zone column, to leave 3 sets of 2 columns each.

Tim

Tim, Looking at the pdf generated by FedEx, it looks like the second column is FedEx Express and the 3rd column is FedEx Ground, the reverse of what you say above.

Also, questions:
1) I don't have the mentioned pdf-txt converter. If I convert using Acrobat to an rtf, and then convert that to txt, it comes out nicely but it is 1 set of two columns -- will that work ok?
2) For the zip codes with NA or *, should these be left as-is or the whole line removed? Will there be a problem if a zip code range is missing or will it just not show up as a shipping option if someone enters one of those codes.

Thanks,
Adam

#23   njpern

njpern
  • Members
  • 5 posts
  • Real Name:N J Pern
  • Location:Michigan

Posted 17 May 2003 - 04:21 AM

Hi. I got the 110 error as well. I think what is causing the problem is the Zone_Locator.txt file. I polished the file some and got it working. You just need to be careful with the Zone_Locator.txt file.

I looked through the file catalog/includes/modules/shipping/fedexzipzones.php . I notice that at the beginning of the file

// class methods

    function quote($method = '') {

      global $order, $shipping_weight, $shipping_num_boxes;

      $rounded_weight = round($shipping_weight,0);

During the rounding of weight process, any number below 1.5 is rounded to 1.0 and any number above 1.5 is rounded to 2.0, which does not sounds right to me. If I have to ship a 1.4lb package,  it will be rounded off to 1lb (but Fedex will charge us rate at 2lb), which means customer is paying less shipping.

The fix to this is to replace the round command to  ceil

// class methods

    function quote($method = '') {

      global $order, $shipping_weight, $shipping_num_boxes;

      $rounded_weight = ceil($shipping_weight);

This will round off   1<weight<=2 to 2lb.

Hope that this help.

#24   AdamPGT

AdamPGT
  • Members
  • 81 posts
  • Real Name:Adam
  • Location:Albuquerque, NM

Posted 09 July 2004 - 01:13 AM

njpern, on May 16 2003, 10:21 PM, said:

Hi. I got the 110 error as well. I think what is causing the problem is the Zone_Locator.txt file. I polished the file some and got it working. You just need to be careful with the Zone_Locator.txt file.
Hi, i've been trying to get this contribution to work for hours now but I keep getting this error:

Warning: Invalid argument supplied for foreach() in /home/gforceau/public_html/store/includes/modules/shipping/fedexzipzones.php on line 110

This is what my Zone_Locater.txt file:

000-003 NA
004-005 8
010-324 8
325 7
326-349 8
350-359 7
360-363 8
364-367 7
368 8
369-372 7
373-374 8
375 7
376-379 8
380-397 7
398-399 8
400-402 7
403-418 8
419 NA
420-424 7
425-426 8
427 7
428-429 NA
430-459 8
460-466 7
467-468 8
469 7
470 8
471-472 7
473 8
474-479 7
480-497 8
498-499 7
500-503 6
504 7
505 6
506-507 7
508-516 6
517-519 NA
520-560 7
5616
562-567 7
568-569 NA
570-5816
582 7
583-588 6
589 NA
590-5915
592-595 6
596-599 5
600-639 7
640-649 6
650-652 7
653 6
654-655 7
656-676 6
677-679 5
680-692 6
693 5
694-699 NA
700-709 7
710-711 6
712-717 7
718-719 6
720-725 7
726-738 6
739 5
740-789 6
790-794 5
795-796 6
797-812 5
813 4
814-838 5
839 NA
840-853 4
854 3
855-863 4
864 3
865 4
866-869 NA
870-872 5
873-874 4
875-878 5
879 4
880-885 5
886-888 NA
889-892 3
893-898 4
899 NA
900-933 2
934 3
935 2
936-939 3
940-966 4
970-986 5
987 4
988-994 5
96700 12
96701 10
96702-96705 12
96706-96707 10
96708 12
96709 10
96710 12
96711-96712 10
96713-96716 12
96717 10
96718-96729 12
96730-96731 10
96732-96733 12
96734 10
96735-96743 12
96744 10
96745-96757 12
96758-96759 10
96760-96761 12
96762 10
96763-96774 12
96775 10
96776-96781 12
96782 10
96783-96785 12
96786 10
96787-96788 12
96789 10
96790 12
96791-96792 10
96793 12
96794-96795 10
96796 12
96797 10
96798-96800 12
96801-96863 10
96864-96899 12
99500 11
99501-99524 9
99525-99539 11
99540 9
99541-99566 11
99567 9
99568-99576 11
99577 9
99578-99999 11

I would really appreciate some help, because as it stands now my customers can't get select FedEx as the shipping type and that the only shipping I'm offering!

--Adam

#25   AdamPGT

AdamPGT
  • Members
  • 81 posts
  • Real Name:Adam
  • Location:Albuquerque, NM

Posted 09 July 2004 - 02:55 AM

TTT

#26   AdamPGT

AdamPGT
  • Members
  • 81 posts
  • Real Name:Adam
  • Location:Albuquerque, NM

Posted 09 July 2004 - 04:37 AM

TTT

#27   dlpuma

dlpuma
  • Members
  • 23 posts
  • Real Name:Dorothy Puma

Posted 19 November 2004 - 09:23 PM

I installed this module ver 2.2 (dated 10 Nov 04) but when I go to the shipping page, I just get 0.00 for the rate and none of the FedEx shipping methods are displayed.  Any ideas how to fix this would be great.

#28   discomonkey

discomonkey
  • Members
  • 81 posts
  • Real Name:chris nienhuis

Posted 24 November 2004 - 09:29 PM

I as well get 0 when trying to use fedex as a solution, what gives??

#29   murphydm722

murphydm722
  • Members
  • 20 posts
  • Real Name:David Murphy

Posted 26 November 2004 - 12:42 AM

dlpuma, on Nov 19 2004, 05:23 PM, said:

I installed this module ver 2.2 (dated 10 Nov 04) but when I go to the shipping page, I just get 0.00 for the rate and none of the FedEx shipping methods are displayed.  Any ideas how to fix this would be great.

<{POST_SNAPBACK}>


I'm having the same problem; I just get 0.00 for the rate and none of the FedEx shipping methods are displayed.  Did you happen to figure it out?  Can you help?
MurphyDM722

#30   murphydm722

murphydm722
  • Members
  • 20 posts
  • Real Name:David Murphy

Posted 26 November 2004 - 12:42 AM

discomonkey, on Nov 24 2004, 05:29 PM, said:

I as well get 0 when trying to use fedex as a solution, what gives??

<{POST_SNAPBACK}>


I'm having the same problem; I just get 0.00 for the rate and none of the FedEx shipping methods are displayed.  Did you happen to figure it out?  Can you help?
MurphyDM722

#31   dlpuma

dlpuma
  • Members
  • 23 posts
  • Real Name:Dorothy Puma

Posted 27 November 2004 - 06:45 AM

Well, I got some things working and changed, but I'm not a PHP programmer, so I don't know if what I did is correct, but I did get the rates to show up.

I changed this line (approx line 113):
	foreach( $retArr as $aquote );

to:
	foreach( $retArr as $aquote){

by removing the semicolon, it allowed the foreach loop to actually loop through each item.

I also changed (approx line 116):
  $title = $aquote['shiptype_id'];

to:

  $title = $aquote['shiptype_name'];

which allowed for the Name to showup on the checkout page, rather than the ID

I made some additional changes to allow for corrected rounding (approx line 124) from:
   	 ' (' . $shipping_num_boxes . ' x ' . round($shipping_weight, 1) . ' ' . MODULE_SHIPPING_FEDEXZIPZONES_TEXT_UNITS .')' ,

to:
   	 ' (' . $shipping_num_boxes . ' x ' . $shipping_weight . ' ' . MODULE_SHIPPING_FEDEXZIPZONES_TEXT_UNITS .')' ,



Now, most of this works, my only problem comes when I have a shipping address other than US or CA, I get the following error:

Warning: Invalid argument supplied for foreach() in /home/soma/WWW/catalog/includes/modules/shipping/fedexzipzones.php on line 110

I understand that this module does not support International shipping, but I have UPS and USPS modules installed that do, so it should just show the UPS and USPS options for International, and not even list FedEx.  So, I do not know why I am getting the error, so if anyone knows why I get this error, that would be great.


Since I am using other modules other than just the FedEx, I wanted the option to be able to sort the shipping methods, and this module did not support sorting, so I added the code to allow me to do the sorting, so if you're interested, I can also post those additons.

#32   AdamPGT

AdamPGT
  • Members
  • 81 posts
  • Real Name:Adam
  • Location:Albuquerque, NM

Posted 10 December 2004 - 03:24 PM

dlpuma, on Nov 26 2004, 11:45 PM, said:

Well, I got some things working and changed, but I'm not a PHP programmer, so I don't know if what I did is correct, but I did get the rates to show up.

I changed this line (approx line 113):
	foreach( $retArr as $aquote );

to:
	foreach( $retArr as $aquote){

by removing the semicolon, it allowed the foreach loop to actually loop through each item.

I also changed (approx line 116):
  $title = $aquote['shiptype_id'];

to:

  $title = $aquote['shiptype_name'];

which allowed for the Name to showup on the checkout page, rather than the ID

I made some additional changes to allow for corrected rounding (approx line 124) from:
    	' (' . $shipping_num_boxes . ' x ' . round($shipping_weight, 1) . ' ' . MODULE_SHIPPING_FEDEXZIPZONES_TEXT_UNITS .')' ,

to:
    	' (' . $shipping_num_boxes . ' x ' . $shipping_weight . ' ' . MODULE_SHIPPING_FEDEXZIPZONES_TEXT_UNITS .')' ,
Now, most of this works, my only problem comes when I have a shipping address other than US or CA, I get the following error:

Warning: Invalid argument supplied for foreach() in /home/soma/WWW/catalog/includes/modules/shipping/fedexzipzones.php on line 110

I understand that this module does not support International shipping, but I have UPS and USPS modules installed that do, so it should just show the UPS and USPS options for International, and not even list FedEx.  So, I do not know why I am getting the error, so if anyone knows why I get this error, that would be great.
Since I am using other modules other than just the FedEx, I wanted the option to be able to sort the shipping methods, and this module did not support sorting, so I added the code to allow me to do the sorting, so if you're interested, I can also post those additons.

<{POST_SNAPBACK}>


I made these changes, but still get $0.00 for the shipping cost when I try and checkout.

Any idea?

--Adam

#33   dlpuma

dlpuma
  • Members
  • 23 posts
  • Real Name:Dorothy Puma

Posted 11 December 2004 - 01:42 AM

Well, if you have a file comparison program, like Beyond Compare, you can compare your version with my complete file:

<?php
/*


  Released under the GNU General Public License

*/

  class fedexzipzones {
    var $code, $title, $description, $enabled, $num_zones, $surcharge_factor;

// class constructor:w

    function fedexzipzones() {
      $this->code = 'fedexzipzones';
      $this->title = MODULE_SHIPPING_FEDEXZIPZONES_TEXT_TITLE;
      $this->description = MODULE_SHIPPING_FEDEXZIPZONES_TEXT_DESCRIPTION;
      $this->sort_order = MODULE_SHIPPING_FEDEX_SORT_ORDER;
      $this->icon = DIR_WS_ICONS . 'shipping_fedex.gif';
      $this->enabled = MODULE_SHIPPING_FEDEXZIPZONES_STATUS;

      // CUSTOMIZE THIS SETTING FOR THE NUMBER OF ZONES NEEDED
      $this->num_zones = 1;

      $this->types = array(
       	 'FedEx Standard Overnight' => 'std',
 	 'FedEx Priority Overnight' => 'pri',
 	 'FedEx Ground'             => 'gnd',
 	 //'FedEx First Overnight'    => 'frs',
 	 'FedEx Express Saver'      => 'sav',
 	 'FedEx 2Day'               => 'two',
 	 );

      // change this surcharge factor to cover the gas surcharge from fedex, or to bury packaging costs
      $this->surcharge_factor = 2;
    }

// class methods

    function quote($method = '')
	{

      global $order, $shipping_weight, $shipping_num_boxes;

      $rounded_weight = ceil($shipping_weight);

      // Tim's new code to read the db and come up with a value.

      // first get the dest zip and check the db for our dest zone
      $zip = $order->delivery['postcode'];
      if ( $zip == '' ){
     	 // something is wrong, we didn't find any zone
  $this->quotes['error'] = MODULE_SHIPPING_FEDEXZIPZONES_NO_ZIPCODE_FOUND;
     	 return $this->quotes;
      }

      $sql = "SELECT *
        FROM fedex_pcode_to_zone_xref
  WHERE
 	 $zip >= pcode_from and
 	 $zip <= pcode_to";
      $qResult = tep_db_query($sql); // run the query
      $rec = tep_db_fetch_array($qResult); // get the first row of the result

      $zone_id = $rec['zone_id'];

      if ( $zone_id == '' ){
     	 // something is wrong, we didn't find any zone
  $this->quotes['error'] = MODULE_SHIPPING_FEDEXZIPZONES_NO_ZONE_FOUND;
     	 return $this->quotes;
      }
      $sql = "SELECT
       	 fedex_zone_rates.shiptype_id,
 	 fedex_shiptype.shiptype_name,
 	 fedex_zones.zone_name,
 	 fedex_zone_rates.zonerate_id,
 	 fedex_zone_rates.zone_cost
        FROM
 	 fedex_zone_rates,
 	 fedex_zones,
 	 fedex_shiptype
  WHERE
 	 ";

	if ($method != ''){
  // they asked for a particular method, let's give that to them
  foreach($this->types as $key=>$type){
 	 if ($type == $method){
    break; // we found the right one.
 	 }
  }
  // limit the query to the specific method listed
  $sql .= "fedex_shiptype.shiptype_name = '$key' AND ";

	}

	$sql .=
 	 "fedex_zone_rates.zone_id = fedex_zones.zone_id and
 	 fedex_zone_rates.shiptype_id = fedex_shiptype.shiptype_id and
 	 fedex_zone_rates.weight = $rounded_weight and
 	 fedex_zone_rates.zone_id = $zone_id
  ORDER BY
 	 fedex_zone_rates.zone_cost";
      $qResult = tep_db_query($sql); // run the query

      while($rec = tep_db_fetch_array($qResult)) {
        $retArr[] = $rec;
      }

	foreach( $retArr as $aquote){
  $cost = $aquote['zone_cost'];
  $title = $aquote['shiptype_name'];
  $methods[] = array(
    'id' => $this->types[$title],
    'title' => $title,
    'cost' => (round(($cost * $this->surcharge_factor * $shipping_num_boxes),2)) + ' . MODULE_SHIPPING_FEDEXZIPZONES_HANDLING .');
	}
      $this->quotes = array('id' => $this->code,
         	 'module' => MODULE_SHIPPING_FEDEXZIPZONES_TEXT_TITLE .
   	 ' (' . $shipping_num_boxes . ' x ' . $shipping_weight . ' ' . MODULE_SHIPPING_FEDEXZIPZONES_TEXT_UNITS .')' ,
                             #'module' => MODULE_SHIPPING_FEDEXZIPZONES_TEXT_TITLE,
                          'methods' => $methods);
      if (tep_not_null($this->icon)) $this->quotes['icon'] = tep_image($this->icon, $this->title);
      if ($error == true) $this->quotes['error'] = MODULE_SHIPPING_FEDEXZIPZONES_INVALID_ZONE;
      return $this->quotes;
    }

    function check() {
      if (!isset($this->_check)) {
        $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_SHIPPING_FEDEXZIPZONES_STATUS'");
        $this->_check = tep_db_num_rows($check_query);
      }
      return $this->_check;
    }

    function install() {
      tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('Enable Fedex Zipcode Zones Method', 'MODULE_SHIPPING_FEDEXZIPZONES_STATUS', '1', 'Do you want to offer fedex zip zone rate shipping?', '6', '0', now())");
      tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Handling Fee', 'MODULE_SHIPPING_FEDEXZIPZONES_HANDLING', '0', 'Handling Fee for this shipping method', '6', '0', now())");
      tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort order of display.', 'MODULE_SHIPPING_FEDEX_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0', now())");
      for ($i = 1; $i <= $this->num_zones; $i++) {
        $default_countries = '';
        if ($i == 1) {
          $default_countries = 'US,CA';
        }
  #      tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Fedex Zone " . $i ." Countries', 'MODULE_SHIPPING_FEDEXZIPZONES_COUNTRIES_" . $i ."', '" . $default_countries . "', 'Comma separated list of two character ISO country codes that are part of Zone " . $i . ".', '6', '0', now())");
   #     tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Fedex Zone " . $i ." Shipping Table', 'MODULE_SHIPPING_FEDEXZIPZONES_COST_" . $i ."', '3:8.50,7:10.50,99:20.00', 'Shipping rates to Zone " . $i . " destinations based on a group of maximum order weights. Example: 3:8.50,7:10.50,... Weights less than or equal to 3 would cost 8.50 for Zone " . $i . " destinations.', '6', '0', now())");
      }
    }

    function remove() {
      $keys = '';
      $keys_array = $this->keys();
      for ($i=0; $i<sizeof($keys_array); $i++) {
        $keys .= "'" . $keys_array[$i] . "',";
      }
      $keys = substr($keys, 0, -1);

      tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in (" . $keys . ")");
    }

    function keys() {
      $keys = array('MODULE_SHIPPING_FEDEXZIPZONES_STATUS', 'MODULE_SHIPPING_FEDEXZIPZONES_HANDLING','MODULE_SHIPPING_FEDEX_SORT_ORDER');

      for ($i=1; $i<=$this->num_zones; $i++) {
        $keys[] = 'MODULE_SHIPPING_FEDEXZIPZONES_COUNTRIES_' . $i;
        $keys[] = 'MODULE_SHIPPING_FEDEXZIPZONES_COST_' . $i;
      }

      return $keys;
    }
  }
?>

Hope this helps

#34   MikeRz

MikeRz
  • Members
  • 17 posts
  • Real Name:Mike

Posted 12 December 2004 - 03:38 PM

I just installed the latest version of this contrib and included the upgraded file by dlpuma and it works great EXCEPT that all my shipping rates are too high.

After researching I discovered that although most shippers don't use a Zone 1 and begin local shipping with Zone 2, the buildfedexdata.php builds rate tables begining with Zone 1 and populates the tables with the 'rate.csv which all begin with Zone 2.  Therefore each zone is using the rates for the next higher zone.

-Mike

#35   Jewelie

Jewelie
  • Members
  • 16 posts
  • Real Name:Julie

Posted 24 February 2005 - 06:12 PM

I'm getting an error "Could not find zone to get zone rates" (paraphrased) on the Checkout page.

Any clue what I did wrong?

#36   Baby Boy

Baby Boy
  • Members
  • 129 posts
  • Real Name:Dustin Verley

Posted 22 July 2005 - 05:07 AM

Right now, I am actually working on the contribution to see what I can do to fix it again. I realized since the last time I've updated some people are having problems, if I can get it fixed, I'll keep you updated and try and bring this contribution back again.
Installed Contributions: AJAX Menu, AJAX Attributed Manager, AP URL ReWriting, Credit Class and Gift Vouchers, CCGV Report, Date of Birth PullDown, FCKEditor for Product Desc., Monthly Installment Payments, More Pictures 6, MSRP Savings, Must Agree to Terms on Checkout, Order Editor, Payment Method Fee, PopUp Promo, Private Messages, Purchase Order, Purchase Order Application, Secure Admin Login-Logout, STS Plus, SugarCRM Integration, Supertracker, Tax Exempt and Organization Discounts, Your Recent History.

23 Total Contributions Installed :)

#37   TheJackal

TheJackal
  • Members
  • 175 posts
  • Real Name:Jackal
  • Gender:Male
  • Location:San Francisco

Posted 28 July 2005 - 09:19 PM

Hi all,

  I have released a v3.0 for this contribution.

Enhancements
- Contribution should be working now;
- Supports both FedEx zones in Alaska, Puerto Rico and Hawaii now;
- 2005 FedEx US rates;
- Many new admin variables to update tables more easily such as
a) Fuel surcharges;
b) Free ground shipping option;
c) Individual service surcharges;
d) Bundling of packages;
e) FedEx discounts;
Changes
- Some structural changes in database tables;
- Clean up old codes;
- Renamed import files to FedEx default naming so that its easy to know when the rates are based;
- Heavy revised install.txt to install.html
Bug Fixes
- Corrected multiple similiar zone codes during rates retrieval;
- Corrected $0 problem;
- Corrected buildfedexdata.php

All feedback welcomed.  Enjoy!
- The Jackal

#38   mlamkin

mlamkin
  • Members
  • 5 posts
  • Real Name:Mark Lamkin

Posted 28 July 2005 - 11:47 PM

[quote name='TheJackal' date='Jul 28 2005, 05:19 PM']
Hi all,

  I have released a [url="http://www.oscommerce.com/community/contributions,490"]v3.0[/url] for this contribution.


Hi Jackal,

Could you check your contribution? I copies the files in v3.0 over an existing one, uninstalled and installed this one under admin. Only problem is the only button I found was 'Cancel.'

Thanks,
Mark

#39   TheJackal

TheJackal
  • Members
  • 175 posts
  • Real Name:Jackal
  • Gender:Male
  • Location:San Francisco

Posted 29 July 2005 - 04:37 AM

Something is not right.  I have tested it on the fresh copy of OSC2.2MS2.  

Try the following checks:
  1.  Did you copy the languages file?
  2.  Try to 'install' again.

Let me know.
- The Jackal

#40   judebert

judebert
  • Members
  • 28 posts
  • Real Name:Judebert
  • Location:Orlando, FL

Posted 13 August 2005 - 12:47 AM

I just can't get FedEx to show up.  I know the docs say sort order is buggy, but I've tried most of the values from 0 to 10 and nothing is working.  Sometimes it even screws up my "flat rate shipping" display.  

On my admin page, I've got:

Flat Rate: 1
USPS : 2
Federal Express : 3

On the checkout page, I get:
Flat Rate: $5.00
USPS:
  EXPRESS: $22.05
  Priority   : $5.75

...and that's it.  I'm running a modified MS2.2; it's got QTPro, the USPS Method, thumbnailing and some other small contributions.

I've even tried setting them all to Sort Order = 0.  Anybody got some help for me?
If this were easy, everybody would do it.