VirtueMart Forum

VirtueMart Dev/Coding Central: VM1 (old version) => Development Projects, Modifications, Hacks & Tweaks. VM1.1 => Shipping Modules => Topic started by: chakkos on December 13, 2010, 14:16:56 PM

Title: ERROR - Please select another Shipping Method
Post by: chakkos on December 13, 2010, 14:16:56 PM
For some time now I was getting error message "Please select another Shipping Method" and whatever shipping method the client selected the same error message would display.
The above error message will only appear in very rare cases and I could not pin-point what was causing it. After some investigation I concluded that this problem appeared because the zip code of the client was not in the valid zip code interval. I come from Cyprus and all zip codes are numeric and 4 digit length, so I set my zip start range to 0 - 99999, which should cover all cases but still the problem was occurring at random intervals. The only thing I could think of going wrong is in the following file "administrator\components\com_virtuemart\classes\shipping\standard_shipping.php" in lines 329 and 334 the following check is made
if(($db->f( "shipping_rate_zip_start" ) > $zip ) {
$vmLogger->debug( 'The ZIP ' . $zip . ' is smaller than the supported ZIP code range of this shipping rate.' ) ;
$valid = false ;
}

the "shipping_rate_zip_start" field in the database is defined as varchar(32) shouldn't it be casted to int before making the comparison? I believe the correct way would have been
if( is_numeric( $zip ) && is_numeric($db->f( "shipping_rate_zip_start" )) && is_numeric($db->f( "shipping_rate_zip_end" ))) {
if((int)$db->f( "shipping_rate_zip_start" ) > $zip ) {
$vmLogger->debug( 'The ZIP ' . $zip . ' is smaller than the supported ZIP code range of this shipping rate.' ) ;
$valid = false ;
}
if((int)$db->f( "shipping_rate_zip_end" ) < $zip ) {
$vmLogger->debug( 'The ZIP ' . $zip . ' is higher than the supported ZIP code range of this shipping rate.' ) ;
$valid = false ;
}
}


I will implement it like this and I would let you know after some time if this has resolved my problem.
If anyone could thing of something else that causes the above problem please let me know.
Title: Re: ERROR - Please select another Shipping Method
Post by: Rachelwu on December 14, 2010, 06:50:01 AM
Chakkos, I'm so glad that I found your post today and solved my problem. In China mainland, Hongkong and Macau, the zipcode is 6 digit. After changing the zipcodes to 0-999999, my store is working.
Title: Re: ERROR - Please select another Shipping Method
Post by: QubeSys Technologies on March 02, 2011, 16:36:58 PM
That doesnt work.
Title: Re: ERROR - Please select another Shipping Method
Post by: chakkos on March 02, 2011, 19:54:13 PM
What do you mean it doesn't work QubeSys?
Did you try changing the zipcodes or did you try the code change?

By the way after the code change I never had this problem again.
Title: Re: ERROR - Please select another Shipping Method
Post by: QubeSys Technologies on March 02, 2011, 20:06:52 PM
What version of VM are you using ?
I dont see any such code.
Title: Re: ERROR - Please select another Shipping Method
Post by: chakkos on March 02, 2011, 21:55:09 PM
I use VM 1.1.5
Title: Re: ERROR - Please select another Shipping Method
Post by: QubeSys Technologies on March 03, 2011, 03:26:00 AM
Ok, I too use the VM 1.1.5 .
Title: Re: ERROR - Please select another Shipping Method
Post by: QubeSys Technologies on March 03, 2011, 03:55:03 AM
Attached is my file from 1.1.5 package

[attachment cleanup by admin]
Title: Re: ERROR - Please select another Shipping Method
Post by: chakkos on March 03, 2011, 22:21:14 PM
The code that needs to be changed is in function rate_id_valid and as in my original post check line 329 you will find the code that need to be replaced there. You have exactly the same code.
PS: this problem appears only if zip code entered is numeric and in some cases not always
Title: Re: ERROR - Please select another Shipping Method
Post by: QubeSys Technologies on March 03, 2011, 22:22:38 PM
yes my case comes in that "SOME CASE" category, which no one knows.
Title: Re: ERROR - Please select another Shipping Method
Post by: chakkos on March 03, 2011, 22:41:32 PM
Try my solution for some time and if it works I think we should report it to the virtuemart team to include it in future releases.
Most probably they did not pick that up because not many countries use numeric zip codes.
Title: Re: ERROR - Please select another Shipping Method
Post by: QubeSys Technologies on March 03, 2011, 22:42:15 PM
Already tried mate.
Title: Re: ERROR - Please select another Shipping Method
Post by: pencaitland on March 26, 2011, 11:55:20 AM
I've had this issue too, with Australian zipcodes; I had left the start and end fields empty; I have now entered '00000' and 99999 (ie from string to number) this has solved the immediate error, but is there anywhere a guide to the correct way to configure these fields?
As far as I can tell, this error check in the code applies to USA codes only, where shipping rates might be based on the zips; could the check just be limited to 'country = USA', or are there other countries that need the same zip-based shipping rate systems?

The same error message, by the way, can be generated by wrongly configuring the weight ranges; overlapping entries, for instance, will cause it