Jump to content

Job Offer - Zip Code as dropdown list


sooroos

Recommended Posts

the thing is that i have an online pizza shop (check it here) and i deliver just in the nearby area. (10-20 different zip codes, Germany)

I need these zip codes to work in OPC and user registration process . I dont really know what involves this, but i need only the customers in the area  to order and register

Link to comment
Share on other sites

And I am simply pointing out that there are other areas in Prestashop that one can alter the zip code (outside of OPC/registration), including the My Account Addresses section.

 

Would you like to leave those alone and just focus on OPC?  Since these are your requirements, you need to educate your self on how your store works, and then base your requirements around that.

Link to comment
Share on other sites

Hi sooroos,

Here the free solution that i have mentioned by PM.

 

Open the file: themes\your_active_theme\authentication.tpl

Locate (there are 2 coincidence):

<input type="text" class="text" name="postcode" id="postcode" value="{if isset($smarty.post.postcode)}{$smarty.post.postcode}{/if}" onblur="$('#postcode').val($('#postcode').val().toUpperCase());" />

Replace the 2 coincidence by:

<select id="postcode" name="postcode">
    <option value="">-</option>
    <option value="80000">81400</option>
    <option value="80001">81401</option>
    <option value="80002">81401</option>
    <option value="80003">81401</option>
</select>

NOTE: Here you can add all default zip codes as you need, this is only an example.

 

 

 

Repeat this in the file: themes\your_active_theme\address.tpl

Locate (there are 2 coincidence):

<input type="text" id="postcode" name="postcode" value="{if isset($smarty.post.postcode)}{$smarty.post.postcode}{else}{if isset($address->postcode)}{$address->postcode|escape:'html'}{/if}{/if}" onkeyup="$('#postcode').val($('#postcode').val().toUpperCase());" />

Replace the 2 coincidence by:

<select id="postcode" name="postcode">
    <option value="">-</option>
    <option value="80000">81400</option>
    <option value="80001">81401</option>
    <option value="80002">81401</option>
    <option value="80003">81401</option>
</select>

Force compile and let me know if works.

 

Regards.

Link to comment
Share on other sites

COTOKO, your solution works partially

the zipcode appears as dropdownlist indeed but in backoffice the customer appear with a different code as the selected one

This solution is only for the Front Office, if you change the 4 blocks of code (2 in authentication.tpl and 2 in address.tpl) works perfectly, in the Back Office you will see the zip code selected by customer but here will appear without dropdown list, i have tested and works perfectly.

Link to comment
Share on other sites

  • 7 years later...

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...