Search code examples
prestashopprestashop-1.7

Add countries in form field Prestashop 1.7.x


I am trying to display a dropdown with all the countries that prestashop has in his database. When a customer is adding a new address, a field ask for the country, but displays only United States.

ask1

How can I make to display all the countries? Because when I edit the customer I can see all the countries.

ask2

What I have tried:

In the location: /public_html/Project/themes/myTemplate/templates/_partials/form-fields.tpl

I realized there is a Foreach to fill the dropdown, but load United States.

{elseif $field.type === 'countrySelect'}

{block name='form_field_item_country'}
  <select
  class="custom-select js-country"
  name="{$field.name}"
  {if $field.required}required{/if}
  >
    <option value disabled selected>{$field.label}</option>
    {foreach from=$field.availableValues item="label" key="value"}
      <option value="{$value}" {if $value eq $field.value} selected {/if}>{$label}</option>
    {/foreach}
  </select>
{/block}

I can see in console, actually, loads one value only.

ask3

Could anybody has the same error? How can you help me to fix it?


Solution

  • Go in International > Locations , check Countries tab and make sure the other countries are active (they aren't in a standard US / UK Prestashop installation)