News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

ERROR - Please select another Shipping Method

Started by chakkos, December 13, 2010, 14:16:56 PM

Previous topic - Next topic

chakkos

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.

Rachelwu

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.

QubeSys Technologies

Blissful!

chakkos

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.

QubeSys Technologies

What version of VM are you using ?
I dont see any such code.
Blissful!


QubeSys Technologies

Blissful!

QubeSys Technologies

Attached is my file from 1.1.5 package

[attachment cleanup by admin]
Blissful!

chakkos

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

QubeSys Technologies

yes my case comes in that "SOME CASE" category, which no one knows.
Blissful!

chakkos

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.

QubeSys Technologies

Blissful!

pencaitland

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