Set up Locality, Date Format and Currency

From Phoenix Cart User Guide
Back

If you are in U.S. or have installed another language pack the following changes might not be necessary.

This step makes changes to the 2 main language files.

There is a main language file for the Store side - /includes/languages/english/english.php

There is a main language file for the Admin side of the site - /admin/includes/languages/english/english.php

Changes to any language file for the Store side are made to a copy which is saved in a new location in the override template.

This prevents them being overwritten in updates.

Changes to any language file for the Admin side are saved in the original location.



Backup files before and after any changes.

Double check that the files are uploaded to the correct locations.

Using the server control panel or FTP software, navigate to the main language file for the Store side /includes/languages/english.php

Save a copy of this file, then upload to /templates/override/includes/languages/english.php.

Create the new folder/directory languages in the /templates/override/includes/ if necessary.

Open this copy to edit.

Note that override is the template that is set in a new installation. Ensure to upload to the template set in Configuration → My Store → Template Selection

CE Phoenix Cart is set for U.S. English with USD currency and m/d/y date format by default.

Set Up Locality

Find the following lines:

@setlocale(LC_ALL, ['en_US.UTF-8', 'en_US.UTF8', 'enu_usa']);

$long_date_formatter = new IntlDateFormatter('en', IntlDateFormatter::FULL, IntlDateFormatter::NONE);
$short_date_formatter = new IntlDateFormatter('en', IntlDateFormatter::SHORT, IntlDateFormatter::NONE);
$date_time_formatter = new IntlDateFormatter('en', IntlDateFormatter::SHORT, IntlDateFormatter::LONG);

const DATE_FORMAT = 'm/d/Y'; // this is used for date()

For example, for Great Britain change:

@setlocale(LC_ALL, ['en_US.UTF-8', 'en_US.UTF8', 'enu_usa']);

to:

@setlocale(LC_ALL, array('en_GB.UTF-8', 'en_GB.UTF8', 'eng_gb'));

Set the Date Format

For example, for Great Britain change:

$long_date_formatter = new IntlDateFormatter('en', IntlDateFormatter::FULL, IntlDateFormatter::NONE);
$short_date_formatter = new IntlDateFormatter('en', IntlDateFormatter::SHORT, IntlDateFormatter::NONE);
$date_time_formatter = new IntlDateFormatter('en', IntlDateFormatter::SHORT, IntlDateFormatter::LONG);

to:

$long_date_formatter = new IntlDateFormatter('en_GB', IntlDateFormatter::FULL, IntlDateFormatter::NONE);
$short_date_formatter = new IntlDateFormatter('en_GB', IntlDateFormatter::SHORT, IntlDateFormatter::NONE);
$date_time_formatter = new IntlDateFormatter('en_GB', IntlDateFormatter::SHORT, IntlDateFormatter::LONG);

Change:

const DATE_FORMAT = 'm/d/Y'; // this is used for date()

to:

const DATE_FORMAT = 'd/m/Y'; // this is used for date()

Change the order of month, day and year to your requirements - see Date Formats Explained

Set the Currency

Find the following line:

const LANGUAGE_CURRENCY = 'USD';

For example, for Great Britain change to:

const LANGUAGE_CURRENCY = 'GBP';


To find your 3 letter currency code, internet search ISO 4217 Codes.

Save the file.




Open the main language file for the Admin side - /youradmin/includes/languages/english.php

Repeat the Set Up Locality changes as above.

Save the file.



Previous Step Next Step


Many Addons and Extensions available in the CE Phoenix Cart Addons Library

If help is needed, support is available in the CE Phoenix Cart Support Forum

Phoenix Cart User Guide, like CE Phoenix Cart, is free to use but is maintained by unpaid volunteers.

Code references are licensed under a Commons Attribution-NonCommercial-ShareAlike 2.0 UK: England & Wales License.
All other content is the reserved Intellectual Property and Copyright of phoenixcart.org