Jump to content

Checking postcode and city name


Recommended Posts

HI,

 

I need to check the postcode where I am going to deliver before accepting payment. if the post code matched then proceed to payment else display an error message.

 

I know its a very easy thing and am sure one of you can help me figure this out.

 

Thank you.

Link to comment
Share on other sites

It's not such a quick fix, especially if you do it right and not use a simple Javascript for it.

 

One approach would be to modify the function that validates a zipcode, and return an invalid response if the post code does not match the ones you wish to use.

 

Keep in mind that it requires some coding language, and may have other effects that I am not thinking about at the moment.

 

A simpler option would be the following shipping module http://www.prestashop.com/forums/index.php?/topic/148747-module-localized-shipping-set-shipping-rates-by-country-state-or-zipcode-range-or-wildcard/

It lets you specify shipping by country state or post code (including ranges and wildcard), which would allow you to limit shipping only to certain post codes, without having to modify any code.

Link to comment
Share on other sites

Hmm.. ya but that would just complicate things for me as of today.

 

However, is it possible As currently I am only delivering in one pin-code area and city. I wanted to know if its possible to set the city and pincode to a default value and prevent the customer from editing it (disable in form).

Link to comment
Share on other sites

Hmm... thanks for your help but I had figured that class based on my limited programming lang but don't know how to set the values, that's why I posted here. Hoping someone might have a better solution.

 

As I am not a programmer but an entrepreneur.

Link to comment
Share on other sites

Sure was, and I'm sure you get more satisfaction from figuring it out (which is always the way I chose to go).

 

However, it didn't sound like you were interested in doing any changes before, but rather have someone else do them for you (which is the easiest way)

Link to comment
Share on other sites

LOL!

I only post here only after trying out everything I know about programming and searching the forum about similar topics.

 

As far as I know the whole point of having a forum is to help users out (programmers & "merchants") but currently the whole point of this forum is to sell modules irrespective of the users needs.I am not criticizing this approach as its a very effective way of selling but trying to highlight that a certain level of discretion is necessary.

 

PS: you had just told me to look into Validate.php ,I would have done the rest as I did not know where the code gets validated.

Link to comment
Share on other sites

The forum is indeed for helping people, which is often done with a module, especially when the question is not really a specific code related question, but rather a "how do I do X and Y", rather than "I tried X and Y and got the following error"

 

While those also get answered, as I did trying to point you in the right direction, and told you how to troubleshoot the white screen you got, you never mentioned an error you got, or any of the things you tried to do.

 

Instead you took the "I'm not a developer approach" which is not likely going to get you many answers.

 

I can't speak for others, but I try to help people that seem to want help resolving issues and not have others solve their problems...

  • Like 1
Link to comment
Share on other sites

  • 4 weeks later...

OK! Solved!

 

All I needed to do was edit the isPostCode($postcode) & isCityName($city) in Validate.php to check the city name and post code entered. Preferably override it.

 

well tomreg this was easier wasn't it ;):)

 

Hi there, I would like accept order from City ABC only What changes I should do in validate.php or in isCityName($city) to make this work. Looking forward for your help. Thanks in advance

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...