I have just implemented a custom shipping script that will choose a shipping cost depending on order value/country chosen.
The post code/zip code entry box always appears and I understand there is no way of removing this. We are using UK post codes mostly which have a space in them, and when I enter a post code with a space it appears to break the shipping script (not all variables are sent to the shipping script like sXprice).
This could be an error in my script (I have taken the script off this forum) or is there a reason for not passing all variables when the post code has a space in it? Spaces at the beginning or end of the post code are fine, its just when there is a space inside the post code.
The script is as follows:
-----------------------------------------------------
#!/usr/local/bin/php -q
<?PHP
// Note: $_POST variable not available since this script is called as a
// CGI script, so we have to read in our params from stdin, with length
// determined by the CONTENT_LENGTH environment variable.
// Read in POST parameters sent by ShopSite
$stdin = fopen("php://stdin","r");
fscanf($stdin,"%{$SERVER['CONTENT_LENGTH']}s",$query_string);
// And now we split the params into the $params array.
parse_str($query_string,$params);
if ( $params['cust_country'] && $params['item_total'] )
-----------------------------------------------------
The final if statement is evaluated as false when there is a space in the post code.
I have tried giving the zip code a value by default using javascript(then my plan was to try and hide the zip code entry box as we dont need it).
I tried:
document.order.zip_code.value = "12345";
But this seems to be ignored - does anyone know if there is a way to hide the zip entry using javascript and giving it a default value (or if my script is just in fact wrong)?