I notice that another user raised the same issue and it is marked as ‘resolved’. But I am still experiencing the problem withy UK postcodes.
Please advise
Norman
I am also seeing this behaviour with UK post codes, both with a space in the post code and not.
Further to this I have checked, Jigoshop setting to validate post code is disabled but clearly javascript is still doing so.
Normski, I believe I have found the issue.
jigoshop/classes/jigoshop_validation.class.php
There is a function as follows:
/**
* Checks for a valid postcode for a country
*
* @param string postcode
* @param string country
* @return boolean
*/
public static function is_postcode($postcode, $country)
{
if (strlen(trim(preg_replace('/[\s\-A-Za-z0-9]/', '', $postcode))) > 0) {
return false;
}
$country = strtoupper(trim($country));
$postcode = strtoupper(trim($postcode));
if (!isset(self::$postcodes[$country])) {
return false;
}
if (Jigoshop_Base::get_options()->get_option('jigoshop_enable_postcode_validating') == 'yes') {
$regex = '/'.self::$postcodes[$country].'/';
jigoshop_log("VALIDATE POSTCODE: country = ".$country." & regex = ".$regex);
switch ($country) {
case 'GB':
return self::is_GB_postcode($postcode);
default:
$match = preg_match($regex, $postcode);
if ($match !== 1) {
return false;
}
}
}
return true;
}
Specifically the line
case 'GB':
Caused me to look further up, adjusting the line
'UK' => '^(GIR|[A-Z]\d[A-Z\d]??|[A-Z]{2}\d[A-Z\d]??)[ ]??(\d[A-Z]{2})$',
From UK to GB fixes the issue for me.
Jigoshop, strangely this only occurs on my live environment and not test.
Many thanks Ragnar.
That works for me too.
I wonder if you can help with another matter. Is there a way of editing or changing the fields on the billing details/order form?
All hte best
Normski
My suspicion is that there is an underlying issue with this though, my test site doesn’t need this fix on 1.10.5 whilst the live site does.
Jigoshop team – can you replicate?
I use the Checkout Fields Manager currently: https://www.jigoshop.com/product/checkout-fields-manager/
we are looking into it now…
Thanks Paul much appreciated.
Can I get the postcode you are having problems with? I tested it on a few things and moreover the code for validationg was not changed. The only thing is adding frontend validation in JavaScript (to speed up validation).
I tried using PL9 7YB (pinched direct from Royal Mail website)
Please note that the javascript validation doesn’t appear to be the issue I’m facing but rather jigoshop_validation.class.php
I can send system info to support@jigoshop.com if that is of help?
OK, the problem exists – will be fixed in 1.10.6
Thank you Ragnar and Amadeusz.
Great that it will be fixed, but what about all the folks that can’t order on my shop at the moment? when will 1.10.6 be available?
where do I find: jigoshop/classes/jigoshop_validation.class.php as posted up on Ragnar’s post
Andy