// FO : more optimizations with unnecessary instantiations
This commit is contained in:
1 parent
dcf89d909d
commit
180a0eb37c
2 files changed
+11
-10
No files matched your search
+8
-5
@@ -376,12 +376,15 @@ class ToolsCore
|
|||||||
{
|
{
|
||||||
if (!$context)
|
if (!$context)
|
||||||
$context = Context::getContext();
|
$context = Context::getContext();
|
||||||
if (($id_lang = (int)Tools::getValue('id_lang')) && Validate::isUnsignedId($id_lang))
|
|
||||||
$context->cookie->id_lang = $id_lang;
|
|
||||||
|
|
||||||
$language = new Language($id_lang);
|
// update language only if new id is different from old id
|
||||||
if (Validate::isLoadedObject($language))
|
if (($id_lang = (int)Tools::getValue('id_lang')) && Validate::isUnsignedId($id_lang) && $context->cookie->id_lang != (int)$id_lang)
|
||||||
$context->language = $language;
|
{
|
||||||
|
$context->cookie->id_lang = $id_lang;
|
||||||
|
$language = new Language($id_lang);
|
||||||
|
if (Validate::isLoadedObject($language))
|
||||||
|
$context->language = $language;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -49,12 +49,10 @@ class BlockCart extends Module
|
|||||||
global $errors;
|
global $errors;
|
||||||
|
|
||||||
// Set currency
|
// Set currency
|
||||||
if (!(int)($params['cart']->id_currency))
|
if ((int)$params['cart']->id_currency && (int)$params['cart']->id_currency != $this->context->currency->id)
|
||||||
$currency = new Currency((int)$params['cookie']->id_currency);
|
|
||||||
else
|
|
||||||
$currency = new Currency((int)$params['cart']->id_currency);
|
$currency = new Currency((int)$params['cart']->id_currency);
|
||||||
if (!Validate::isLoadedObject($currency))
|
else
|
||||||
$currency = new Currency((int)(Configuration::get('PS_CURRENCY_DEFAULT')));
|
$currency = $this->context->currency;
|
||||||
|
|
||||||
if ($params['cart']->id_customer)
|
if ($params['cart']->id_customer)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in new issue
Block a user