Mc_Gregor Posted June 15, 2011 Share Posted June 15, 2011 Hi.. How can i limit the Post Code in "Create Account"??.. My store is an delivery shop but i want to limit the shipping to one zone.. For example my customers only can put "41000" other Post Code insert and have an error: "Sorry we only ship in the 41000 zone" Apreciate any help... Thanks!!! Link to comment Share on other sites More sharing options...
burt Posted June 15, 2011 Share Posted June 15, 2011 Find this: tep_draw_input_field('postcode') Change to: tep_draw_input_field('postcode', '41000', 'readonly="readonly"') Link to comment Share on other sites More sharing options...
Mc_Gregor Posted June 15, 2011 Author Share Posted June 15, 2011 Hey burt!!.. Thanks!!.. But that would be a problem for me because anyone can put an address that not correspond to the Post Code "41000".. I think it would be best to leave it blank and if the customer enters another Post Code, an error would occur.. Some If maybe? Thanks again burt!! Find this: tep_draw_input_field('postcode') Change to: tep_draw_input_field('postcode', '41000', 'readonly="readonly"') Link to comment Share on other sites More sharing options...
burt Posted June 15, 2011 Share Posted June 15, 2011 A piece of javascript that fires a warning message. Hunt google for a tutorial. Try searching for "jquery input text" or somesuch. Link to comment Share on other sites More sharing options...
Mc_Gregor Posted June 16, 2011 Author Share Posted June 16, 2011 Problem Solved!.. The solution: 1-Running this piece of SQL code "in PHPMyAdmin". INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('Enter the Postal Code to limit a Shipping Area', 'SHIPPING_POSTCODE_LIMIT', '0', 'The postal code to limit an area to ship. 0 = unlimited.', '7', '6', now()); That should add "Enter the Postal Code to limit a Shipping Area" in Administration/Configuration/ Shipping/Packaging. For default is "0" you can put there the Postal Code you whant (Is for only one for now, if you want to improve more, share it). 2- Open up create_account.php and find these lines of code: if (strlen($postcode) < ENTRY_POSTCODE_MIN_LENGTH) { $error = true; $messageStack->add('create_account', ENTRY_POST_CODE_ERROR); } Add just under add if ((SHIPPING_POSTCODE_LIMIT > 0) && ($postcode != SHIPPING_POSTCODE_LIMIT)) { $error = true; $messageStack->add('create_account', ENTRY_POST_CODE_LIMIT_ERROR); } 3- Add the Error Message to the language file /includes/languages/english.php (and other if you whant) define('ENTRY_POST_CODE_LIMIT_ERROR', ' The shipping is limited to the area with Postal Code ' . SHIPPING_POSTCODE_LIMIT . ' For more information, see "Shipping Zone".'); // If you have one Shiping Zone And that's all. I hope it's useful to others Cheers!!... Link to comment Share on other sites More sharing options...
Mc_Gregor Posted June 16, 2011 Author Share Posted June 16, 2011 One more, sorry i forget that.. You have to add to in: 1- address_book_process.php if ((SHIPPING_POSTCODE_LIMIT > 0) && ($postcode != SHIPPING_POSTCODE_LIMIT)) { $error = true; $messageStack->add('addressbook', ENTRY_POST_CODE_LIMIT_ERROR); } 2- checkout_payment_address.php if ((SHIPPING_POSTCODE_LIMIT > 0) && ($postcode != SHIPPING_POSTCODE_LIMIT)) { $error = true; $messageStack->add('checkout_address', ENTRY_POST_CODE_LIMIT_ERROR); } 3- checkout_shipping_address.php if ((SHIPPING_POSTCODE_LIMIT > 0) && ($postcode != SHIPPING_POSTCODE_LIMIT)) { $error = true; $messageStack->add('checkout_address', ENTRY_POST_CODE_LIMIT_ERROR); } ENJOY!! :) Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.