marsupial Posted August 14, 2006 Share Posted August 14, 2006 I have also installed the simple module for "Free Shipping" for items with 0 weight. As a customer from many places in the world including Australia I can checkout a 0 weight item and not be charged postage but for a particular customer in the UK I get the error below in the "surface shipping" module only it seems. Does anyone have any idea what is going wrong here? I don't have a local copy and my website is live so a hotfix is in order. As you can see if you copy the http:.drc......... line into a browser the correct values are returned so that part is supposed to work, is the zero weight, zero shipping thing causing issues? if so why for this customer but not others from the US etc? Warning: file(http://drc.edeliver.com.au/ratecalc.asp?Pickup_Postcode=2000&Destination_Postcode=SG2 8XZ&Country=GB&Weight=249&Service_Type=ECONOMY&Height=100&Width=100&Length=100&Quantity=1) [function.file]: failed to open stream: HTTP request failed! in /home/warchest/public_html/catalog/includes/modules/shipping/ausposteconomy.php on line 69 Warning: Invalid argument supplied for foreach() in /home/warchest/public_html/catalog/includes/modules/shipping/ausposteconomy.php on line 70 Warning: file(http://drc.edeliver.com.au/ratecalc.asp?Pickup_Postcode=2000&Destination_Postcode=SG2 8XZ&Country=GB&Weight=249&Service_Type=SEA&Height=100&Width=100&Length=100&Quantity=1) [function.file]: failed to open stream: HTTP request failed! in /home/warchest/public_html/catalog/includes/modules/shipping/auspostsea.php on line 69 Warning: Invalid argument supplied for foreach() in /home/warchest/public_html/catalog/includes/modules/shipping/auspostsea.php on line 70 Quote Link to comment Share on other sites More sharing options...
marsupial Posted August 14, 2006 Author Share Posted August 14, 2006 (edited) I have also installed the simple module for "Free Shipping" for items with 0 weight. As a customer from many places in the world including Australia I can checkout a 0 weight item and not be charged postage but for a particular customer in the UK I get the error below in the "surface shipping" module only it seems. Does anyone have any idea what is going wrong here? I don't have a local copy and my website is live so a hotfix is in order. As you can see if you copy the http:.drc......... line into a browser the correct values are returned so that part is supposed to work, is the zero weight, zero shipping thing causing issues? if so why for this customer but not others from the US etc? Warning: file(http://drc.edeliver.com.au/ratecalc.asp?Pickup_Postcode=2000&Destination_Postcode=SG2 8XZ&Country=GB&Weight=249&Service_Type=ECONOMY&Height=100&Width=100&Length=100&Quantity=1) [function.file]: failed to open stream: HTTP request failed! in /home/warchest/public_html/catalog/includes/modules/shipping/ausposteconomy.php on line 69 Warning: Invalid argument supplied for foreach() in /home/warchest/public_html/catalog/includes/modules/shipping/ausposteconomy.php on line 70 Warning: file(http://drc.edeliver.com.au/ratecalc.asp?Pickup_Postcode=2000&Destination_Postcode=SG2 8XZ&Country=GB&Weight=249&Service_Type=SEA&Height=100&Width=100&Length=100&Quantity=1) [function.file]: failed to open stream: HTTP request failed! in /home/warchest/public_html/catalog/includes/modules/shipping/auspostsea.php on line 69 Warning: Invalid argument supplied for foreach() in /home/warchest/public_html/catalog/includes/modules/shipping/auspostsea.php on line 70 It seems that it doesn't matter if the item is a zero weight item or a normal item....... Here is the code in question $url = "http://drc.edeliver.com.au/ratecalc.asp?Pickup_Postcode=$frompcode&Destination_Postcode=$topcode&Country=$dest_country&Weight=$sweight&Service_Type=ECONOMY&Height=$sheight&Width=$swidth&Length=$slength&Quantity=$shipping_num_boxes"; $myfile = file($url); foreach($myfile as $vals) { $bits = split("=", $vals); $$bits[0] = $bits[1]; } if ($charge <= 0) { $error = true; } else { $handling = MODULE_SHIPPING_AUSPOST_ECONOMY_HANDLING; if ($handling >0) { $handling_details = " $" . MODULE_SHIPPING_AUSPOST_ECONOMY_HANDLING . " " .MODULE_SHIPPING_AUSPOST_ECONOMY_TEXT_HANDLING; } else { $handling_details = ""; } Edited August 14, 2006 by marsupial Quote Link to comment Share on other sites More sharing options...
marsupial Posted August 14, 2006 Author Share Posted August 14, 2006 OK Seems to be that with British post codes and maybe others as well, they have spaces in them like, RG1 27DX etc. If I remove the space it goes through fine. So the question is, since I am no developer, what line of code can I add to strip any possible spaces from the post code and where should this be placed? Quote Link to comment Share on other sites More sharing options...
bobsi18 Posted August 14, 2006 Share Posted August 14, 2006 OK Seems to be that with British post codes and maybe others as well, they have spaces in them like, RG1 27DX etc. If I remove the space it goes through fine. So the question is, since I am no developer, what line of code can I add to strip any possible spaces from the post code and where should this be placed? Sorry - no help here, but I just find it interesting that I've been using this module for about 3 months, and haven't had any problems, then this issue came up just this morning (independent of your post). I'm also interested in any solutions... ~bobsi18~ Quote Link to comment Share on other sites More sharing options...
marsupial Posted August 14, 2006 Author Share Posted August 14, 2006 (edited) Sorry - no help here, but I just find it interesting that I've been using this module for about 3 months, and haven't had any problems, then this issue came up just this morning (independent of your post). I'm also interested in any solutions... ~bobsi18~ Barbara have you tried a dummy user with a british post code with spaces? if you could it would confirm if it is just me or the module as a whole........or are you saying you actually had this problem this morning as coincidence? Stephen Edited August 14, 2006 by marsupial Quote Link to comment Share on other sites More sharing options...
bobsi18 Posted August 14, 2006 Share Posted August 14, 2006 Barbara have you tried a dummy user with a british post code with spaces? if you could it would confirm if it is just me or the module as a whole........or are you saying you actually had this problem this morning as coincidence? Stephen Yeh, I actually had this problem this morning as a coincidence - a customer from the UK tried to place an order, with a postcode with spaces in it, and couldn't select the AusPost Postage option - I had tested my site previously, but never with a postcode with spaces in it. I deleted the spaces in the customers postcode, and now it works fine. Quote Link to comment Share on other sites More sharing options...
marsupial Posted August 15, 2006 Author Share Posted August 15, 2006 ok think I fixed it with some help... In both the economy and sea shipping modules at around lines 69 and 70 where you see this: $url = "http://drc.edeliver.com.au/ratecalc.asp?Pickup_Postcode=$frompcode&Destination_Postcode=$topcode&Country=$dest_country&Weight=$sweight&Service_Type=SEA&Height=$sheight&Width=$swidth&Length=$slength&Quantity=$shipping_num_boxes"; $myfile = file($url); foreach($myfile as $vals) { $bits = split("=", $vals); $$bits[0] = $bits[1]; } Before the very first $url add: $newtopcode = str_replace(" ", "", $topcode); and then in the http://drc line of code replace $topcode with $newtopcode Now it all seems to work fine. This strips spaces from post codes. If you use the other auspost modules you may have to do the same thing in there. Cheers Stephen Quote Link to comment Share on other sites More sharing options...
bobsi18 Posted August 15, 2006 Share Posted August 15, 2006 thanks, u r a genius :) Quote 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.