Allow store pickup to work with postcodes that start with one letter

Description

By default the store pickup module only works with postcodes that start with two letters. However local to us is Glasgow which only uses a single letter (G).

The following edit will get the spu module to check and see if the customers postcode starts with a letter followed by a number (e.g. G8), and if so will only take the G to be checked against the array of allowed postcodes. Otherwise it will take the usual two letters (e.g. ML) and check them.

Open /catalog/includes/modules/shipping/spu.php

Find around line 67;
$cust_cp = substr($codep['entry_postcode'], 0, 2);
Change to;
$cust_cp = ((preg_match("/^[A-Z][0-9]/", $codep['entry_postcode'])) ? substr($codep['entry_postcode'], 0, 1) : substr($codep['entry_postcode'], 0, 2));

Environment

None

Steps to reproduce

None

Assignee

Giles Marshall

Reporter

Scott Murphy

Labels

None

Severity

Tweak

Components

Fix versions

Affects versions

Priority

Configure