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
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:
PrestaShop\PrestaShop\Core\Cldr
namespace has been removed along with all classes in it.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:
For more details, please see the related pull request on GitHub.
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.
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).AdminModelAdapter.php
now requires the Router in its constructor.$_GET
and $_POST
variables. Make sure you validate user input accordingly. – (See related change).src/Core/Addon/Module/ModuleManager.php::_construct()
receives an instance of CacheClearerInterface
instead of CacheClearer
– (See related change).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..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.