
Buyers are unlikely to fall foul of the 'PA22 problem' if they enter a valid and complete UK postcode in the shipping estimator or in the checkout.
The module is designed to estimate or apply shipping costs in the checkout based on the buyer entering a complete UK 5 or 6 digit postcode.
Your 'solution' will continue to cause incorrect shipping values to be returned in response to partial postcodes being entered.
If you want to create a partial 'idiot' trap in the module then.. UK postcodes are either 5 or 6 digits long, so you could do a test on the string to see if it's less than 5 characters, and return an error message if it is.
To do that...
if you open /includes/modules/shipping/ukpost.php
Insert the line
if ($len <= 4) {$error2 = true;} after $len = strlen($pcode); (around line 115)
Then add the line
if ($error2 == true) $this->quotes['error'] = MODULE_SHIPPING_UKPOST_INVALID_POSTCODE; After the line if ($error == true) $this->quotes['error'] = MODULE_SHIPPING_UKPOST_INVALID_CODE;
Then open /includes/languages/english/modules/shipping/ukpost.php
Add the line
define('MODULE_SHIPPING_UKPOST_INVALID_POSTCODE', 'Invalid Postcode Entered');
Bookmarks