Warning: You are browsing the documentation for PrestaShop 1.7, which is outdated.

You might want to look at the current version, PrestaShop 8. Read the updated version of the documentation

Learn how to upgrade to the latest version.

Notable changes in PrestaShop 1.7.6

CLDR

The CLDR is a component responsible of displaying data such as the date & time, prices depending on a given language. It was reworked during several versions of PrestaShop 1.7, and will be enabled with 1.7.6. The previous one has been removed, and trying to use it will end to an exception.

A new variable is now available in the Context when going through a controller:

<?php
class ContextCore
{
    /**
     * Current locale instance.
     *
     * @var PrestaShop\PrestaShop\Core\Localization\Locale
     */
    public $currentLocale;

    [...]
}

This property is the link to format properly a number:

<?php
Context::getContext()->currentLocale->formatNumber(123.45);

or a price:

<?php
Context::getContext()->currentLocale->formatPrice(123.45, 'EUR');

Remember that you can retrieve the contextual currency code as follows:

<?php
Context::getContext()->currency->iso_code; // returns 'EUR' for Euro, 'USD' for US dollars, ...

Also, note that Tools::displayNumber(...) andTools::displayPrice(...) work as before, although deprecated.

The summary of removed elements is the following:

  • The IcanBoogie/CLDR library has been removed in favor of the new native implementation.
  • Old CLDR files in the “/translations” directory have been removed as well.
  • The PrestaShop\PrestaShop\Core\Cldr namespace has been removed along with all classes in it.
  • The Currency ObjectModel is now multilingual

Deprecated methods:

  • Tools::getCldr(). Calls to this method will throw a PrestaShopException.
  • Tools::displayNumber() andTools::displayPrice() are still functional, but discouraged.

The following currencies are no longer available:

  • BYR: Belarusian Ruble (2000–2016)
  • LTL: Lithuanian Litas (end 2014-12-31)
  • STD: São Tomé & Príncipe Dobra (end 2017-12-31)

For more details, please see the related pull request on GitHub.

New SQL tables

In order to correctly handle user session expiration, two new SQL tables have been added to PrestaShop MySQL schema: ps_customer_session and ps_employee_session. These SQL tables are used for security purposes.

Other notable changes

  • Import: It’s no longer possible to just add categories to current categories with import to a force ID. You will have to set them all and the first will become the default_category – (See related change).
  • Replaced library: PhpExcel (no longer supported) has been replaced by PHPSpreadsheet – (See related change).
  • Version comparison: AppKernel::MAJOR_VERSION is now “7” instead of “17”. “1.2.4” is no longer greater than “1.2.3.4” (the latter is now interpreted as “2.3.4”) – (See related change).
  • URLs:
    • Endpoints other than index.php have been deprecated – (See related change).
    • Module developers are strongly discouraged from using routes that don’t go through a controller (see this issue).
    • All Back Office endpoints now require a token.
    • AdminModelAdapter.php now requires the Router in its constructor.
  • Escaping:
    • Slashes are no longer removed from $_GET and $_POST variables. Make sure you validate user input accordingly. – (See related change).
    • HTML characters are no longer escaped from error messages – (See related change).
  • Other:
    • src/Core/Addon/Module/ModuleManager.php::_construct() receives an instance of CacheClearerInterface instead of CacheClearer – (See related change).
    • Permissions for files created by PrestaShop are no longer set to 0777. Permissions are now set to 0755 for directories and 0644 for files.
    • To prevent having jQuery included twice, It is no longer possible to add jQuery in BO controllers based on the new theme using addJquery() – (See related change).
  • Module:
    • Dashboard modules can no longer use AdminDashboardController::ajaxProcessSaveDashConfig() to save values without implementing the saveDashConfig method and if needed the validateDashConfig method. This is not possible anymore from PrestaShop 1.7.6.6 in order to enforce the shop’s security.
  • Theme:
    • A new generic selector has been added: .product-container. Theme developers need to make sure to add this class to the appropriate container on product page in order to allow the product page to be refreshed on changes.