allkeysmusic Posted July 1, 2013 Share Posted July 1, 2013 (edited) I wish to only allow certain postcode within London to be able to place an order. It's a restaurant business so the delivery is only limited to 4-5miles. So please help on how to limit the delivery to area within certain postcode. And also, once the order has been placed, how can I get the order list to be faxed to the restaurant straight away? Many thanks in advance. Edited July 1, 2013 by allkeysmusic (see edit history) Link to comment Share on other sites More sharing options...
PascalVG Posted July 1, 2013 Share Posted July 1, 2013 IF your area covered has a common begin code, you could define a new 'country' (you can give the area name to be the 'country' name to make it more clear which area you serve) and then give the postal code some fixed begin numbers that cover the area Example: USA normally NNNNN where N = any digit. You could limit it using '975NN', so it must start with 975 with the last two digits as desired. (N.B. You can use 'L' for variable letters (like UK postal code with letters and digits mixed) Of course this only works if the whole area allowed is covered by ANY postal code, starting with 975. If this doesn't work, we need to delve into the code... Let me know if this works for you pascal Link to comment Share on other sites More sharing options...
allkeysmusic Posted July 1, 2013 Author Share Posted July 1, 2013 NO, I was not able to do it. The postcode starting with NW2 is what I wanted to allow. So I tried to enter 'NWN NLL'. That didn't work Link to comment Share on other sites More sharing options...
El Patron Posted July 1, 2013 Share Posted July 1, 2013 About the only thing I can think of is to use a shipping module that works at the zip/postal code level. If the shipping module does not cover that area, the customer would receive no shipping for your address. Once you have that piece working then you can modify the module/native prestashop to state we do not deliver to that address. The obvious problem is that the visitor is not going to be happy to find out you do not deliver until they have registered, then you will probably get some hate mail. What I think you really need is a module that will ask the customer up front their postal code, it would then simply check the defined postal codes and tell the visitor if you deliver to that address. That would be a fairly easy module to write and if you find this might be acceptable and there is (via search) no similar module you could post in the paid section to get quotes for it's creation. Hope this helps a little. Link to comment Share on other sites More sharing options...
El Patron Posted July 1, 2013 Share Posted July 1, 2013 I did find a module, but it may be more than you need are willing to pay but worth checking out. http://addons.prestashop.com/en/shipping-logistics-delivery-prestashop-modules/20[spam-filter]myowndeliveries.html Link to comment Share on other sites More sharing options...
PascalVG Posted July 2, 2013 Share Posted July 2, 2013 your start code 'NW2' has the problem that it contains the 'N' which Prestashop will translate to "any digit" so if you add the keystring NWN NLL it takes 1W3, 4W6, 2W8 etc as start code. So we have to change the 'N'(any digit) 'wild card' into something else like 'D' for digit or so. Then you could add the Postal code string 'NW2 DLL' (NW2 is literal string, D=any digit, L= any letter) so then they all must start with NW2. So now we have to find where the Wild card 'N' is defined and modify for you into 'D'... I'll have a quick look and see if I can find it... pascal. Link to comment Share on other sites More sharing options...
PascalVG Posted July 2, 2013 Share Posted July 2, 2013 OK, there we go. We have to change 6 files (Prestashop 1.5.4.0 at least) Note: To make this solution useful for more people, Let's wildcard character 'N' change into '#' instead of 'D' as I suggested above, to not have problems with any literal 'D' some other Prestashop user may want to use literally. So we change 'N' to '#' instead: Open file /classes/Country.php Find public function checkZipCode($zip_code) Inside this function find and change 'N' into '#' Open file: /modules/carriercompare/carriercompare.php: Find: private function checkZipcode($zipcode, $id_country) Inside this function find and change 'N' into '#' Open file: /controllers/front/AddressController.php Find: protected function processSubmitAddress() Inside this function find and change 'N' into '#' (2 times) Open file: /controllers/admin/AdminAddressesController.php Find: public function processSave() Inside this function find and change 'N' into '#' (2 times) Open file: /controllers/admin/AdminTaxRulesGroupController.php Find: protected function processCreateRule() Inside this function find and change 'N' into '#' Open file: /controllers/front/AuthController.php Find: protected function processSubmitAccount() Inside this function find and change 'N' into '#' So change all the 'N's into '#'. After this any 'N' you add to the postal code will be a literal N instead of a wildcard 'N' (any digit) so then add as postal code template 'NW2 #LL' and you should be able to add NW2 5DE, NW2 2AD, NW2 9KK etc, all postal codes starting with NW2, as you wanted. Give it a try, and let me know if it works. pascal. Note 2: if anyone wants to use the 'L' as well literally, instead of as wildcard for 'any letter', we can change the 'L' into '$' in all files above, in the same functions. Then the Postal code example above would be 'NW2 #$$' where last three characters would be anydigit/anyletter/anyletter Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now