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.