Baby Boy Posted November 10, 2004 Share Posted November 10, 2004 I installed the contribution right I take it, yet it does not work on checkout. At the checkout, it says "Could not find a zone for the given Zip Code", yet if I use the other buildfedexdata.php file in the main folder in place of the one in the admin folder, the checkout works, BUT, it says thats there was an Invalid arguement between foreach() yet I cannot have it work. Does anybody know why it won't work. I think the buildfedexdata.php is the latest update that the guy put out. Can somebody direct me to get the FedEx method to work, please. Quote 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 :) Link to comment Share on other sites More sharing options...
Baby Boy Posted November 10, 2004 Author Share Posted November 10, 2004 Alright, just wanted to update everybody. I have gotten the error at the top to go away, but it only shows $0.00 as an option, don't know whats going on now and why it isn't showing the correct price. Would anybody happen to know why? I installed the contribution right I take it, yet it does not work on checkout. At the checkout, it says "Could not find a zone for the given Zip Code", yet if I use the other buildfedexdata.php file in the main folder in place of the one in the admin folder, the checkout works, BUT, it says thats there was an Invalid arguement between foreach() yet I cannot have it work. Does anybody know why it won't work. I think the buildfedexdata.php is the latest update that the guy put out. Can somebody direct me to get the FedEx method to work, please. <{POST_SNAPBACK}> Quote 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 :) Link to comment Share on other sites More sharing options...
dlpuma Posted November 19, 2004 Share Posted November 19, 2004 I am having the same problem with the $0.00 showing up. Got any ideas? Quote Link to comment Share on other sites More sharing options...
discomonkey Posted November 24, 2004 Share Posted November 24, 2004 Yep, same problem here. Quote Link to comment Share on other sites More sharing options...
murphydm722 Posted November 26, 2004 Share Posted November 26, 2004 Same Here, 0.00 and only one fedex method. Quote MurphyDM722 Link to comment Share on other sites More sharing options...
dlpuma Posted November 27, 2004 Share Posted November 27, 2004 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. Quote Link to comment Share on other sites More sharing options...
murphydm722 Posted November 27, 2004 Share Posted November 27, 2004 dlpuma, Could you post your entire fedexzipzones.php code so I can compare all. I'm still having problems. Thanks. Quote MurphyDM722 Link to comment Share on other sites More sharing options...
dlpuma Posted November 27, 2004 Share Posted November 27, 2004 Here is the entire fedexzones.php file, including the "sorting" changes. <?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 Quote Link to comment Share on other sites More sharing options...
murphydm722 Posted November 27, 2004 Share Posted November 27, 2004 Thanks so much, worked like a charm. Quote MurphyDM722 Link to comment Share on other sites More sharing options...
Baby Boy Posted December 20, 2004 Author Share Posted December 20, 2004 You cannot do that, if you remove that then the file will not work, it does not work for me. Taking off that thing allowed for me to get a fatal error and it will not fix, thanks to the thing you posted up, thought it'd help me, but destroyed me even more. The main thing is that, all you have to remove it the ; semicolon off of the piece of code, do not do anything else. I promise you man, it'll work. Quote 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 :) Link to comment Share on other sites More sharing options...
Baby Boy Posted December 20, 2004 Author Share Posted December 20, 2004 I correct myself Dorothy, much apologies, alright, I know why it says that foreach error, it should be because of the semicolon. Remove that semicolon and it will work flawlessly. I have it going on my site at http://www.street-game.com/index.php I am working on it right now to get the file uploaded to the Contributions server for it to work, and one of your changes, the rounded weight, should be like this: $rounded_weight = round($shipping_weight,0); The rounded weight should be changed to that if you are running on an updated version. Thanks and I will include your tips in the next file change. Use my new updated version, and I recommend for ALL zip codes, please update them monthly, I also updated the fuel surcharge. I see in your file the # signs before the few lines ..... this tells your using a much older file. I have been working with the FedEx file for a while and finally accomplished it. Check the FedEx Zip Code Changes thing later. Thanks for bringing to my attention ;-) Quote 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 :) Link to comment Share on other sites More sharing options...
Baby Boy Posted December 20, 2004 Author Share Posted December 20, 2004 (edited) GRRRRRRRRRRRRRRRRRR. DOROTHY! I apologize, Im so twisted and caught up, I never got to update my file yet. The file you was reading from was the one I did, I am working and changing a few codes from the one on my server, a whole new package will be up for osCommerce in a few. Get with me on AIM (CBlockThug21) sometime so we can work on this ;) See ya. P.S. I actually packaged the wrong darn file, stupid me :-" Edited December 20, 2004 by Baby Boy Quote 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 :) Link to comment Share on other sites More sharing options...
Baby Boy Posted December 28, 2004 Author Share Posted December 28, 2004 Alright, I realized when I removed one of the bars the thing began giving me problems. So in my guesses, I would have to say its because of a coding problem. I have been in the past few days trying to work on it and see what I can do about getting it to work with my site. I am not guarenteeing correct functioning on anybody elses sites, but I'll later further you in. Happy Holidays and have a safe 2005. Quote 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 :) Link to comment Share on other sites More sharing options...
Guest Posted January 19, 2005 Share Posted January 19, 2005 Do we have this thing working yet? Scott Quote Link to comment Share on other sites More sharing options...
Baby Boy Posted January 19, 2005 Author Share Posted January 19, 2005 Still nothing yet, I have not given up but at the moment I have taken a break from it, its a coding problem though. Something with either the template or removing the side bars, cause it works nicely on a clean installation of osCommerce. Quote 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 :) Link to comment Share on other sites More sharing options...
Baby Boy Posted January 23, 2005 Author Share Posted January 23, 2005 Oh, and by the way Dorothy, after multiple tries, your code that you have is useless, so I am not sure how it worked for Murphy but its nothing to me cause it doesnt even work on a fresh install. Quote 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 :) Link to comment Share on other sites More sharing options...
murphydm722 Posted January 23, 2005 Share Posted January 23, 2005 I don't know, but I ain't messing with it. :) I'm sure you pointed your browser to the build file, didn't you. What are they symptoms you are having, and then maybe someone can help. Anyway, thanks again Dorothy. Quote MurphyDM722 Link to comment Share on other sites More sharing options...
dlpuma Posted January 24, 2005 Share Posted January 24, 2005 Hi all, I have been so busy working on other parts of the site and moving my database over, that I haven't had a chance to look at all of this in awhile. Baby Boy, you said you had a different version on your server, than what you had posted on the contrib. If that's the case, can you post the "clean" version you have. I'll start fresh and see if the $0.00 problem still exists. Like I've said before, I'm not a programmer, but I've been able to fiddle here and there. The only problem I have is International orders, I get: Warning: Invalid argument supplied for foreach() in /path/fedexzipzones.php on line 110 Domestic addresses work flawlessly. Quote Link to comment Share on other sites More sharing options...
Baby Boy Posted February 20, 2005 Author Share Posted February 20, 2005 'Em, I'll try as soon as I can, I need to alter my site back around. I am terribly sorry again though. If it sounded rude what I said about it being useless, no pun intended. But let's see, 'em, the foreach thing your getting I think I know why, look below and change: ---------[Open modules/shipping/fedexzipzones.php ]------------------------- Look for: $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; } In the piece of coding, look for: while($rec = tep_db_fetch_array($qResult)) { Change this to: while($rec = tep_db_fetch_array($qResult)); { Save and close file and upload. This should about do it and fix it, hopefully it will work for you. Good luck. Quote 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 :) Link to comment Share on other sites More sharing options...
chimol Posted December 23, 2008 Share Posted December 23, 2008 I know this thread is old, but I'm having a small issue with my FedEx shipping estimater and it only happens once the weight goes over about 170lbs. Here's the error: Warning: Invalid argument supplied for foreach() in D:\vhosts\MySite.COM\httpdocs\catalog\includes\modules\shipping\fedexzipzones.php on line 128 Here's line 128 foreach( $retArr as $aquote ){ Any help is appreciated! Quote Steve I appreciate all the help that everyone on this site has given me! Link to comment Share on other sites More sharing options...
Guest Posted January 4, 2009 Share Posted January 4, 2009 (edited) Well, I'm still having issues, too. I was not getting a selection button to appear next to the FedEx choice, so you couldn't actually choose it. I added the semi-colon in the file as Dorothy said to, above, and the button appeared, and you can select it, but when you try to proceed to the next step in the checkout process, it just asks you to pick a shipping method again. Upon further review, none of the choices for fed ex that I'm offering are appearing, either. Just the FedEx choice. I'm going to tear my hair out! Edited January 4, 2009 by PilotShopGuy Quote Link to comment Share on other sites More sharing options...
chimol Posted January 13, 2009 Share Posted January 13, 2009 I know this thread is old, but I'm having a small issue with my FedEx shipping estimater and it only happens once the weight goes over about 170lbs. Here's the error: Warning: Invalid argument supplied for foreach() in D:\vhosts\MySite.COM\httpdocs\catalog\includes\modules\shipping\fedexzipzones.php on line 128 Here's line 128 foreach( $retArr as $aquote ){ Any help is appreciated! Still having some issues with this, is there anyway to bypass or overide the 170lb limit. If I could do that then I can leave the module turned on, it works great under that limit. Anybody have any ideas???? Quote Steve I appreciate all the help that everyone on this site has given me! Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.