# International Phone Input (dfphoneintl)

> Overview DataFirefly International Phone Input (dfphoneintl) adds a dial code selector with country flag on the PrestaShop Phone and Mobile phone fields, and normalizes numbers to the international E.164 format…

- Page: <https://www.datafirefly.com/en/documentation/dfphoneintl/>
- Language: en
- Last updated: 2026-07-01
- Other languages: [fr](https://www.datafirefly.com/documentation/dfphoneintl/index.md), [es](https://www.datafirefly.com/es/documentation/dfphoneintl/index.md), [de](https://www.datafirefly.com/de/documentation/dfphoneintl/index.md), [it](https://www.datafirefly.com/it/documentation/dfphoneintl/index.md), [pl](https://www.datafirefly.com/pl/documentation/dfphoneintl/index.md), [nl](https://www.datafirefly.com/nl/documentation/dfphoneintl/index.md), [pt](https://www.datafirefly.com/pt/documentation/dfphoneintl/index.md)
- Index: <https://www.datafirefly.com/en/documentation/llms.txt>

## Overview

DataFirefly International Phone Input (`dfphoneintl`) adds a dial code selector with country flag on the PrestaShop **Phone** and **Mobile phone** fields, and normalizes numbers to the international E.164 format in the database. The module operates on two levels: browser-side for user experience, and server-side to guarantee that every address insert or update — including via API, back office or import — produces a normalized number.

Storage format: for a French customer entering `0633547864`, the value stored in the database is `+33633547864` — country dial code, leading 0 (trunk prefix) removed, no spaces or separators.

## Requirements

- PrestaShop 8.0.0 to 9.99.99
- PHP 7.4 minimum (8.1+ recommended)
- No external dependency — the module ships no third-party library

## Installation

1. Download the `dfphoneintl-1.0.0.zip` archive from your DataFirefly customer account.
2. In the PrestaShop back office, go to **Modules → Module Manager → Upload a module**.
3. Drag and drop the ZIP file, then click **Install**.
4. The module registers itself on the required hooks automatically. No SQL table is created — dial codes are read from the native `ps_country` table.

## Configuration

Go to **Modules → Module Manager → DataFirefly International Phone Input → Configure**. Three settings are available:

- **Enable on "Phone" field** — toggles the selector and normalization on the `phone` field.
- **Enable on "Mobile Phone" field** — same for the `phone_mobile` field.
- **Preferred countries** — comma-separated ISO2 codes (e.g. `fr,be,lu,ch,gb,us,de`). These countries are pinned at the top of the dropdown. Default: `fr,be,lu,ch,gb,us,de,es,it,nl`.

The countries shown in the selector come from the countries **enabled** in your store (Shipping → Locations → Countries). A disabled country, or one with no dial code set in the `call_prefix` column, does not appear.

## Client-side behavior

### Covered pages

The selector appears on every front-office page featuring phone fields: account creation, registration, address management, checkout (5-step and one-page), identity page, contact page and guest order tracking.

### Country synchronization

When the customer changes the country in the address form, the selector's dial code updates automatically. Selecting Belgium switches the code to +32, Germany to +49, and so on. This synchronization also works during AJAX reloads of the native checkout: the module listens for the PrestaShop events `updatedAddressForm`, `updatedAddress`, `updateCustomerAddressForm` and `changedCheckoutStep`, with a debounced MutationObserver as a safety net for heavily customized themes.

### Detection on existing addresses

If the field already contains a number in international format (editing an existing address), the module detects the corresponding country using longest dial-code matching: `+1242...` is recognized as Bahamas, not United States.

## Server-side behavior

Server-side normalization is hooked into `actionObjectAddressAddBefore` and `actionObjectAddressUpdateBefore`. Before every INSERT or UPDATE on the `ps_address` table, the `phone` and `phone_mobile` fields go through the `DfPhoneFormatter` class. This covers every write channel: front-office forms, back office, webservice, CSV imports, and third-party modules manipulating the `Address` class.

### Normalization rules

For an address tied to a country with dial code +33:

- Number starting with `+` → kept as-is, only separators are removed: `+33 6 33 54 78 64` becomes `+33633547864`.
- Number starting with `00` → the `00` is replaced with `+`: `0033633547864` becomes `+33633547864`.
- Number starting with `0` (trunk prefix) → the `0` is removed and the dial code is prepended: `0633547864` becomes `+33633547864`.
- Number already starting with the dial code without `+` → the `+` is simply added: `33633547864` becomes `+33633547864`.
- Any other digits-only number → the dial code is prepended.

Existing addresses are **not** retroactively modified at installation. Normalization applies on the next save of each address. For a bulk normalization of existing data, contact support — a SQL script following the same logic is available on request.

## Theme and checkout compatibility

- PS 8 Classic theme (Bootstrap 4) and PS 9 theme (Bootstrap 5) supported natively.
- 5-step checkout and one-page checkout (OPC) supported.
- Flags are Unicode emojis (Regional Indicator Symbols): no sprite, no CDN, rendered natively by all modern browsers and operating systems.
- Multistore: global settings, country list filtered per store.
- Multilingual: country names displayed in the visitor's language.

## Troubleshooting

### The selector does not appear

- Check that the field is enabled in the module configuration.
- Check that your theme uses the standard field names `phone` / `phone_mobile` (or `address[phone]` / `address[phone_mobile]`). For a field renamed by a custom theme, contact support.
- Clear the PrestaShop cache (Advanced Parameters → Performance) after installation.

### Flags show as letters (FR, BE...)

Expected behavior on some older Windows systems that don't render flag emojis. The `+33` dial code stays visible and the module remains fully functional.

### The dial code doesn't follow country changes

On a heavily customized theme whose country select doesn't use the `id_country` name, automatic synchronization can't attach. The MutationObserver still re-initializes the widget, and the customer can pick the dial code manually. Contact support with your store URL for an adaptation.

## Uninstallation

Uninstalling removes the module's three configuration keys. Numbers already normalized in the database stay in international format — no customer data is modified or deleted.

## Support

Email support included, updates included for 12 months. 14-day money-back guarantee on all DataFirefly modules.
