// Performance optimizations

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@16024 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
rGaillard
2012-06-14 14:11:11 +00:00
parent 3e46c466a8
commit b2b29c4270
14 changed files with 98 additions and 93 deletions
+6 -3
View File
@@ -278,9 +278,12 @@ class AddressCore extends ObjectModel
{ {
if (isset(self::$_idCountries[$id_address])) if (isset(self::$_idCountries[$id_address]))
return self::$_idCountries[$id_address]; return self::$_idCountries[$id_address];
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow(' if ($id_address)
SELECT `id_country`, `id_state`, `vat_number`, `postcode` FROM `'._DB_PREFIX_.'address` $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
WHERE `id_address` = '.(int)$id_address); SELECT `id_country`, `id_state`, `vat_number`, `postcode` FROM `'._DB_PREFIX_.'address`
WHERE `id_address` = '.(int)$id_address);
else
$result = false;
self::$_idCountries[$id_address] = $result; self::$_idCountries[$id_address] = $result;
return $result; return $result;
} }
+10 -10
View File
@@ -93,9 +93,9 @@ class ConfigurationCore extends ObjectModel
*/ */
public static function getIdByName($key, $id_shop_group = null, $id_shop = null) public static function getIdByName($key, $id_shop_group = null, $id_shop = null)
{ {
if (is_null($id_shop)) if ($id_shop === null)
$id_shop = Shop::getContextShopID(); $id_shop = Shop::getContextShopID();
if (is_null($id_shop_group)) if ($id_shop_group === null)
$id_shop_group = Shop::getContextShopGroupID(); $id_shop_group = Shop::getContextShopGroupID();
$sql = 'SELECT id_configuration $sql = 'SELECT id_configuration
@@ -147,9 +147,9 @@ class ConfigurationCore extends ObjectModel
public static function get($key, $id_lang = null, $id_shop_group = null, $id_shop = null) public static function get($key, $id_lang = null, $id_shop_group = null, $id_shop = null)
{ {
$id_lang = (int)$id_lang; $id_lang = (int)$id_lang;
if (is_null($id_shop)) if ($id_shop === null)
$id_shop = Shop::getContextShopID(); $id_shop = Shop::getContextShopID();
if (is_null($id_shop_group)) if ($id_shop_group === null)
$id_shop_group = Shop::getContextShopGroupID(); $id_shop_group = Shop::getContextShopGroupID();
if (!isset(self::$_CONF[$id_lang])) if (!isset(self::$_CONF[$id_lang]))
@@ -203,9 +203,9 @@ class ConfigurationCore extends ObjectModel
throw new PrestaShopException('keys var is not an array'); throw new PrestaShopException('keys var is not an array');
$id_lang = (int)$id_lang; $id_lang = (int)$id_lang;
if (is_null($id_shop)) if ($id_shop === null)
$id_shop = Shop::getContextShopID(); $id_shop = Shop::getContextShopID();
if (is_null($id_shop_group)) if ($id_shop_group === null)
$id_shop_group = Shop::getContextShopGroupID(); $id_shop_group = Shop::getContextShopGroupID();
$results = array(); $results = array();
@@ -246,9 +246,9 @@ class ConfigurationCore extends ObjectModel
if (!Validate::isConfigName($key)) if (!Validate::isConfigName($key))
die(Tools::displayError()); die(Tools::displayError());
if (is_null($id_shop)) if ($id_shop === null)
$id_shop = Shop::getContextShopID(); $id_shop = Shop::getContextShopID();
if (is_null($id_shop_group)) if ($id_shop_group === null)
$id_shop_group = Shop::getContextShopGroupID(); $id_shop_group = Shop::getContextShopGroupID();
if (!is_array($values)) if (!is_array($values))
@@ -293,9 +293,9 @@ class ConfigurationCore extends ObjectModel
if (!Validate::isConfigName($key)) if (!Validate::isConfigName($key))
die(Tools::displayError()); die(Tools::displayError());
if (is_null($id_shop)) if ($id_shop === null)
$id_shop = Shop::getContextShopID(); $id_shop = Shop::getContextShopID();
if (is_null($id_shop_group)) if ($id_shop_group === null)
$id_shop_group = Shop::getContextShopGroupID(); $id_shop_group = Shop::getContextShopGroupID();
if (!is_array($values)) if (!is_array($values))
+1 -1
View File
@@ -531,7 +531,7 @@ class CustomerCore extends ObjectModel
public static function getGroupsStatic($id_customer) public static function getGroupsStatic($id_customer)
{ {
if (!Group::isFeatureActive()) if (!Group::isFeatureActive() || $id_customer = 0)
return array(Configuration::get('PS_CUSTOMER_GROUP')); return array(Configuration::get('PS_CUSTOMER_GROUP'));
if (!isset(self::$_customer_groups[$id_customer])) if (!isset(self::$_customer_groups[$id_customer]))
+4 -4
View File
@@ -209,7 +209,7 @@ class MediaCore
*/ */
public static function getJSPath($js_uri) public static function getJSPath($js_uri)
{ {
if (is_array($js_uri) || is_null($js_uri) || empty($js_uri)) if (is_array($js_uri) || $js_uri === null || empty($js_uri))
return false; return false;
$url_data = parse_url($js_uri); $url_data = parse_url($js_uri);
if (!array_key_exists('host', $url_data)) if (!array_key_exists('host', $url_data))
@@ -258,14 +258,14 @@ class MediaCore
public static function getJqueryPath($version = null, $folder = null, $minifier = true) public static function getJqueryPath($version = null, $folder = null, $minifier = true)
{ {
$add_no_conflict = false; $add_no_conflict = false;
if (is_null($version)) if ($version === null)
$version = _PS_JQUERY_VERSION_; //set default version $version = _PS_JQUERY_VERSION_; //set default version
else if (preg_match('/^([0-9]+\.)+[0-9]$/Ui', $version)) else if (preg_match('/^([0-9]+\.)+[0-9]$/Ui', $version))
$add_no_conflict = true; $add_no_conflict = true;
else else
return false; return false;
if (is_null($folder)) if ($folder === null)
$folder = _PS_JS_DIR_.'jquery/'; //set default folder $folder = _PS_JS_DIR_.'jquery/'; //set default folder
//check if file exist //check if file exist
$file = $folder.'jquery-'.$version.($minifier ? '.min.js' : '.js'); $file = $folder.'jquery-'.$version.($minifier ? '.min.js' : '.js');
@@ -345,7 +345,7 @@ class MediaCore
public static function getJqueryPluginPath($name, $folder) public static function getJqueryPluginPath($name, $folder)
{ {
$plugin_path = array('js' => array(), 'css' => array()); $plugin_path = array('js' => array(), 'css' => array());
if (is_null($folder)) if ($folder === null)
$folder = _PS_JS_DIR_.'jquery/plugins/'; //set default folder $folder = _PS_JS_DIR_.'jquery/plugins/'; //set default folder
$file = 'jquery.'.$name.'.js'; $file = 'jquery.'.$name.'.js';
+4 -4
View File
@@ -166,7 +166,7 @@ abstract class ObjectModelCore
$this->def = self::getDefinition($this); $this->def = self::getDefinition($this);
$this->setDefinitionRetrocompatibility(); $this->setDefinitionRetrocompatibility();
if (!is_null($id_lang)) if ($id_lang !== null)
$this->id_lang = (Language::getLanguage($id_lang) !== false) ? $id_lang : Configuration::get('PS_LANG_DEFAULT'); $this->id_lang = (Language::getLanguage($id_lang) !== false) ? $id_lang : Configuration::get('PS_LANG_DEFAULT');
if ($id_shop && $this->isMultishop()) if ($id_shop && $this->isMultishop())
@@ -299,7 +299,7 @@ abstract class ObjectModelCore
$is_lang_multishop = $this->isLangMultishop(); $is_lang_multishop = $this->isLangMultishop();
$fields = array(); $fields = array();
if (is_null($this->id_lang)) if ($this->id_lang === null)
foreach (Language::getLanguages(false) as $language) foreach (Language::getLanguages(false) as $language)
{ {
$fields[$language['id_lang']] = $this->formatFields(self::FORMAT_LANG, $language['id_lang']); $fields[$language['id_lang']] = $this->formatFields(self::FORMAT_LANG, $language['id_lang']);
@@ -943,7 +943,7 @@ abstract class ObjectModelCore
), ),
); );
if (is_null($ws_params_attribute_name)) if ($ws_params_attribute_name === null)
$ws_params_attribute_name = 'webserviceParameters'; $ws_params_attribute_name = 'webserviceParameters';
if (!isset($this->{$ws_params_attribute_name}['objectNodeName'])) if (!isset($this->{$ws_params_attribute_name}['objectNodeName']))
@@ -1068,7 +1068,7 @@ abstract class ObjectModelCore
*/ */
public function isAssociatedToShop($id_shop = null) public function isAssociatedToShop($id_shop = null)
{ {
if (is_null($id_shop)) if ($id_shop === null)
$id_shop = Context::getContext()->shop->id; $id_shop = Context::getContext()->shop->id;
$sql = 'SELECT id_shop $sql = 'SELECT id_shop
+1 -2
View File
@@ -963,8 +963,7 @@ class ToolsCore
// Remove all non-whitelist chars. // Remove all non-whitelist chars.
$str = preg_replace('/[^a-zA-Z0-9\s\'\:\/\[\]-\pL]/u', '', $str); $str = preg_replace('/[^a-zA-Z0-9\s\'\:\/\[\]-\pL]/u', '', $str);
$str = preg_replace('/[\s\'\:\/\[\]-]+/', ' ', $str); $str = preg_replace('/[\s\'\:\/\[\]-]+/', ' ', $str);
$str = preg_replace('/[ ]/', '-', $str); $str = str_replace(array(' ', '/'), '-', $str);
$str = preg_replace('/[\/]/', '-', $str);
// If it was not possible to lowercase the string with mb_strtolower, we do it after the transformations. // If it was not possible to lowercase the string with mb_strtolower, we do it after the transformations.
// This way we lose fewer special chars. // This way we lose fewer special chars.
+5 -5
View File
@@ -490,7 +490,7 @@ class ValidateCore
*/ */
public static function isBool($bool) public static function isBool($bool)
{ {
return is_null($bool) || is_bool($bool) || preg_match('/^0|1$/', $bool); return $bool === null || is_bool($bool) || preg_match('/^0|1$/', $bool);
} }
/** /**
@@ -655,7 +655,7 @@ class ValidateCore
public static function isNullOrUnsignedId($id) public static function isNullOrUnsignedId($id)
{ {
return is_null($id) || Validate::isUnsignedId($id); return $id === null || Validate::isUnsignedId($id);
} }
/** /**
@@ -803,7 +803,7 @@ class ValidateCore
*/ */
public static function isSortDirection($value) public static function isSortDirection($value)
{ {
return (!is_null($value) && ($value === 'ASC' || $value === 'DESC')); return ($value !== null && ($value === 'ASC' || $value === 'DESC'));
} }
/** /**
@@ -909,7 +909,7 @@ class ValidateCore
*/ */
public static function isSerializedArray($data) public static function isSerializedArray($data)
{ {
return is_null($data) || (is_string($data) && preg_match('/^a:[0-9]+:{.*;}$/s', $data)); return $data === null || (is_string($data) && preg_match('/^a:[0-9]+:{.*;}$/s', $data));
} }
/** /**
@@ -920,7 +920,7 @@ class ValidateCore
*/ */
public static function isCoordinate($data) public static function isCoordinate($data)
{ {
return is_null($data) || preg_match('/^\-?[0-9]{1,8}\.[0-9]{1,8}$/s', $data); return $data === null || preg_match('/^\-?[0-9]{1,8}\.[0-9]{1,8}$/s', $data);
} }
/** /**
+1 -1
View File
@@ -841,7 +841,7 @@ class FrontControllerCore extends Controller
return array(); return array();
$context = Context::getContext(); $context = Context::getContext();
if (!isset($context->customer)) if (!isset($context->customer) || !$context->customer->id)
return array(); return array();
if (!is_array(self::$currentCustomerGroups)) if (!is_array(self::$currentCustomerGroups))
+1 -1
View File
@@ -96,7 +96,7 @@ class DbQueryCore
*/ */
public function leftJoin($table, $alias = null, $on = null) public function leftJoin($table, $alias = null, $on = null)
{ {
return $this->join('LEFT JOIN `'._DB_PREFIX_.bqSQL($table).'`'.($alias ? ' '.pSQL($alias) : '').($on ? ' ON '.$on : '')); return $this->join('LEFT JOIN `'._DB_PREFIX_.bqSQL($table).'`'.($alias ? ' `'.pSQL($alias).'`' : '').($on ? ' ON '.$on : ''));
} }
/** /**
+2 -2
View File
@@ -1430,7 +1430,7 @@ abstract class ModuleCore
protected static $exceptionsCache = null; protected static $exceptionsCache = null;
public function getExceptions($hookID, $dispatch = false) public function getExceptions($hookID, $dispatch = false)
{ {
if (is_null(self::$exceptionsCache)) if (self::$exceptionsCache === null)
{ {
self::$exceptionsCache = array(); self::$exceptionsCache = array();
$sql = 'SELECT * FROM `'._DB_PREFIX_.'hook_module_exceptions` $sql = 'SELECT * FROM `'._DB_PREFIX_.'hook_module_exceptions`
@@ -1557,7 +1557,7 @@ abstract class ModuleCore
public function getTemplatePath($template) public function getTemplatePath($template)
{ {
$overloaded = $this->_isTemplateOverloaded($template); $overloaded = $this->_isTemplateOverloaded($template);
if (is_null($overloaded)) if ($overloaded === null)
return null; return null;
if ($overloaded) if ($overloaded)
return _PS_THEME_DIR_.'modules/'.$this->name.'/'.$template; return _PS_THEME_DIR_.'modules/'.$this->name.'/'.$template;
+11 -11
View File
@@ -100,7 +100,7 @@ class StockAvailableCore extends ObjectModel
$query->from('stock_available'); $query->from('stock_available');
$query->where('id_product = '.(int)$id_product); $query->where('id_product = '.(int)$id_product);
if (!is_null($id_product_attribute)) if ($id_product_attribute !== null)
$query->where('id_product_attribute = '.(int)$id_product_attribute); $query->where('id_product_attribute = '.(int)$id_product_attribute);
$query = StockAvailable::addSqlShopRestriction($query, $id_shop); $query = StockAvailable::addSqlShopRestriction($query, $id_shop);
@@ -219,7 +219,7 @@ class StockAvailableCore extends ObjectModel
*/ */
public static function setProductDependsOnStock($id_product, $depends_on_stock = true, $id_shop = null, $id_product_attribute = 0) public static function setProductDependsOnStock($id_product, $depends_on_stock = true, $id_shop = null, $id_product_attribute = 0)
{ {
if (is_null($id_shop)) if ($id_shop === null)
$id_shop = Context::getContext()->shop->id; $id_shop = Context::getContext()->shop->id;
$existing_id = StockAvailable::getStockAvailableIdByProductId((int)$id_product, (int)$id_product_attribute, (int)$id_shop); $existing_id = StockAvailable::getStockAvailableIdByProductId((int)$id_product, (int)$id_product_attribute, (int)$id_shop);
@@ -257,7 +257,7 @@ class StockAvailableCore extends ObjectModel
*/ */
public static function setProductOutOfStock($id_product, $out_of_stock = false, $id_shop = null, $id_product_attribute = 0) public static function setProductOutOfStock($id_product, $out_of_stock = false, $id_shop = null, $id_product_attribute = 0)
{ {
if (is_null($id_shop)) if ($id_shop === null)
$id_shop = Context::getContext()->shop->id; $id_shop = Context::getContext()->shop->id;
$existing_id = StockAvailable::getStockAvailableIdByProductId((int)$id_product, (int)$id_product_attribute, (int)$id_shop); $existing_id = StockAvailable::getStockAvailableIdByProductId((int)$id_product, (int)$id_product_attribute, (int)$id_shop);
@@ -295,11 +295,11 @@ class StockAvailableCore extends ObjectModel
*/ */
public static function getQuantityAvailableByProduct($id_product = null, $id_product_attribute = null, $id_shop = null) public static function getQuantityAvailableByProduct($id_product = null, $id_product_attribute = null, $id_shop = null)
{ {
if (is_null($id_shop)) if ($id_shop === null)
$id_shop = Context::getContext()->shop->id; $id_shop = Context::getContext()->shop->id;
// if null, it's a product without attributes // if null, it's a product without attributes
if (is_null($id_product_attribute)) if ($id_product_attribute === null)
$id_product_attribute = 0; $id_product_attribute = 0;
$query = new DbQuery(); $query = new DbQuery();
@@ -307,7 +307,7 @@ class StockAvailableCore extends ObjectModel
$query->from('stock_available'); $query->from('stock_available');
// if null, it's a product without attributes // if null, it's a product without attributes
if (!is_null($id_product)) if ($id_product !== null)
$query->where('id_product = '.(int)$id_product); $query->where('id_product = '.(int)$id_product);
$query->where('id_product_attribute = '.(int)$id_product_attribute); $query->where('id_product_attribute = '.(int)$id_product_attribute);
@@ -415,7 +415,7 @@ class StockAvailableCore extends ObjectModel
$context = Context::getContext(); $context = Context::getContext();
// if there is no $id_shop, gets the context one // if there is no $id_shop, gets the context one
if (is_null($id_shop)) if ($id_shop === null)
$id_shop = (int)$context->shop->id; $id_shop = (int)$context->shop->id;
$depends_on_stock = StockAvailable::dependsOnStock($id_product); $depends_on_stock = StockAvailable::dependsOnStock($id_product);
@@ -529,7 +529,7 @@ class StockAvailableCore extends ObjectModel
*/ */
public static function dependsOnStock($id_product, $id_shop = null) public static function dependsOnStock($id_product, $id_shop = null)
{ {
if (is_null($id_shop)) if ($id_shop === null)
$id_shop = Context::getContext()->shop->id; $id_shop = Context::getContext()->shop->id;
$query = new DbQuery(); $query = new DbQuery();
@@ -552,7 +552,7 @@ class StockAvailableCore extends ObjectModel
*/ */
public static function outOfStock($id_product, $id_shop = null) public static function outOfStock($id_product, $id_shop = null)
{ {
if (is_null($id_shop)) if ($id_shop === null)
$id_shop = Context::getContext()->shop->id; $id_shop = Context::getContext()->shop->id;
$query = new DbQuery(); $query = new DbQuery();
@@ -583,7 +583,7 @@ class StockAvailableCore extends ObjectModel
$alias .= '.'; $alias .= '.';
// if there is no $id_shop, gets the context one // if there is no $id_shop, gets the context one
if (is_null($id_shop)) if ($id_shop === null)
$id_shop = $context->shop->id; $id_shop = $context->shop->id;
// if we are in $shop_group context // if we are in $shop_group context
@@ -636,7 +636,7 @@ class StockAvailableCore extends ObjectModel
$group_ok = false; $group_ok = false;
// if there is no $id_shop, gets the context one // if there is no $id_shop, gets the context one
if (is_null($id_shop)) if ($id_shop === null)
$id_shop = $context->shop->id; $id_shop = $context->shop->id;
$shop_group = new ShopGroup((int)Shop::getContextShopGroupID()); $shop_group = new ShopGroup((int)Shop::getContextShopGroupID());
+6 -6
View File
@@ -45,23 +45,23 @@ function smartyTranslate($params, &$smarty)
if (isset($smarty->source) && (strpos($smarty->source->filepath, DIRECTORY_SEPARATOR.'override'.DIRECTORY_SEPARATOR) !== false)) if (isset($smarty->source) && (strpos($smarty->source->filepath, DIRECTORY_SEPARATOR.'override'.DIRECTORY_SEPARATOR) !== false))
$key = 'override_'.$key; $key = 'override_'.$key;
$lang_array = $_LANG;
if ($params['mod']) if ($params['mod'])
return Translate::getModuleTranslation($params['mod'], $params['s'], $basename, $params['sprintf']); return Translate::getModuleTranslation($params['mod'], $params['s'], $basename, $params['sprintf']);
else if ($params['pdf']) else if ($params['pdf'])
return Translate::getPdfTranslation($params['s']); return Translate::getPdfTranslation($params['s']);
if ($lang_array != null && isset($lang_array[$key])) if ($_LANG != null && isset($_LANG[$key]))
$msg = $lang_array[$key]; $msg = $_LANG[$key];
elseif ($lang_array != null && isset($lang_array[Tools::strtolower($key)])) elseif ($_LANG != null && isset($_LANG[Tools::strtolower($key)]))
$msg = $lang_array[Tools::strtolower($key)]; $msg = $_LANG[Tools::strtolower($key)];
else else
$msg = $params['s']; $msg = $params['s'];
if ($msg != $params['s']) if ($msg != $params['s'])
$msg = $params['js'] ? addslashes($msg) : stripslashes($msg); $msg = $params['js'] ? addslashes($msg) : stripslashes($msg);
$msg = Translate::checkAndReplaceArgs($msg, $params['sprintf']); if ($params['sprintf'] !== null)
$msg = Translate::checkAndReplaceArgs($msg, $params['sprintf']);
return $params['js'] ? $msg : Tools::htmlentitiesUTF8($msg); return $params['js'] ? $msg : Tools::htmlentitiesUTF8($msg);
} }
+43 -43
View File
@@ -45,49 +45,6 @@ class Blockreinsurance extends Module
$this->displayName = $this->l('Bloc reinsurance'); $this->displayName = $this->l('Bloc reinsurance');
$this->description = $this->l('Add a block to display more infos to reassure your customers'); $this->description = $this->l('Add a block to display more infos to reassure your customers');
$this->fields_list = array(
'id_reinsurance' => array(
'title' => $this->l('Id'),
'width' => 120,
'type' => 'text',
),
'text' => array(
'title' => $this->l('Text'),
'width' => 140,
'type' => 'text',
'filter_key' => 'a!lastname'
),
);
if (Shop::isFeatureActive())
$this->fields_list['id_shop'] = array('title' => $this->l('ID Shop'), 'align' => 'center', 'width' => 25, 'type' => 'int');
$this->fields_form[0]['form'] = array(
'legend' => array(
'title' => $this->l('Reinsurance new block'),
),
'input' => array(
array(
'type' => 'file',
'label' => $this->l('Image:'),
'name' => 'image',
'value' => true
),
array(
'type' => 'textarea',
'label' => $this->l('Text:'),
'lang' => true,
'name' => 'text',
'cols' => 40,
'rows' => 10
)
),
'submit' => array(
'title' => $this->l(' Save '),
'class' => 'button'
)
);
} }
public function install() public function install()
@@ -254,6 +211,32 @@ class Blockreinsurance extends Module
{ {
$default_lang = (int)Configuration::get('PS_LANG_DEFAULT'); $default_lang = (int)Configuration::get('PS_LANG_DEFAULT');
$this->fields_form[0]['form'] = array(
'legend' => array(
'title' => $this->l('Reinsurance new block'),
),
'input' => array(
array(
'type' => 'file',
'label' => $this->l('Image:'),
'name' => 'image',
'value' => true
),
array(
'type' => 'textarea',
'label' => $this->l('Text:'),
'lang' => true,
'name' => 'text',
'cols' => 40,
'rows' => 10
)
),
'submit' => array(
'title' => $this->l(' Save '),
'class' => 'button'
)
);
$helper = new HelperForm(); $helper = new HelperForm();
$helper->module = $this; $helper->module = $this;
$helper->name_controller = 'blockreinsurance'; $helper->name_controller = 'blockreinsurance';
@@ -290,6 +273,23 @@ class Blockreinsurance extends Module
protected function initList() protected function initList()
{ {
$this->fields_list = array(
'id_reinsurance' => array(
'title' => $this->l('Id'),
'width' => 120,
'type' => 'text',
),
'text' => array(
'title' => $this->l('Text'),
'width' => 140,
'type' => 'text',
'filter_key' => 'a!lastname'
),
);
if (Shop::isFeatureActive())
$this->fields_list['id_shop'] = array('title' => $this->l('ID Shop'), 'align' => 'center', 'width' => 25, 'type' => 'int');
$helper = new HelperList(); $helper = new HelperList();
$helper->shopLinkType = ''; $helper->shopLinkType = '';
$helper->simple_header = true; $helper->simple_header = true;
@@ -96,6 +96,9 @@ class FavoriteProduct extends ObjectModel
public static function isCustomerFavoriteProduct($id_customer, $id_product, Shop $shop = null) public static function isCustomerFavoriteProduct($id_customer, $id_product, Shop $shop = null)
{ {
if (!$id_customer)
return false;
if (!$shop) if (!$shop)
$shop = Context::getContext()->shop; $shop = Context::getContext()->shop;