From 5d090a25b3716654bdb4e00a7a560d1a814e8a5c Mon Sep 17 00:00:00 2001 From: tDidierjean Date: Fri, 29 Jul 2011 14:29:57 +0000 Subject: [PATCH] // Context part 27 git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@7812 b9a71923-0436-4b27-9f14-aed3839534dd --- modules/bankwire/bankwire.php | 11 +- modules/blockadvertising/blockadvertising.php | 12 +- modules/blockbestsellers/blockbestsellers.php | 9 +- modules/blockcart/blockcart.php | 18 +-- modules/blockcategories/blockcategories.php | 55 ++++--- modules/blockcms/blockcms.php | 33 ++--- .../blockcustomerprivacy.php | 8 +- modules/blocklayered/blocklayered.php | 54 ++++--- modules/blocklink/blocklink.php | 14 +- .../blockmanufacturer/blockmanufacturer.php | 8 +- modules/blockmyaccount/blockmyaccount.php | 6 +- modules/blocknewproducts/blocknewproducts.php | 6 +- modules/blocknewsletter/blocknewsletter.php | 13 +- modules/blockpaymentlogo/blockpaymentlogo.php | 11 +- modules/blockrss/blockrss.php | 6 +- modules/blocksearch/blocksearch.php | 17 ++- modules/blockstore/blockstore.php | 6 +- modules/blocksupplier/blocksupplier.php | 8 +- modules/blocktags/blocktags.php | 6 +- modules/blockuserinfo/blockuserinfo.php | 18 ++- modules/blockviewed/blockviewed.php | 8 +- modules/blockwishlist/WishList.php | 7 +- modules/blockwishlist/blockwishlist.php | 20 ++- modules/carriercompare/carriercompare.php | 18 ++- modules/cashondelivery/cashondelivery.php | 3 +- modules/cashticket/PrepaidServices.php | 21 ++- modules/cheque/cheque.php | 13 +- modules/criteo/criteo.php | 14 +- modules/crossselling/crossselling.php | 12 +- modules/dateofdelivery/dateofdelivery.php | 9 +- modules/dejala/dejala.php | 135 ++++++++---------- modules/dejala/deliveries_csv.php | 5 +- modules/dibs/dibs.php | 15 +- modules/ebay/ebay.php | 61 +++----- modules/editorial/editorial.php | 15 +- modules/envoimoinscher/envoimoinscher.php | 15 +- modules/envoimoinscher/tracking.php | 8 +- modules/fedexcarrier/fedexcarrier.php | 19 +-- modules/feeder/feeder.php | 4 +- modules/fianetfraud/fianetfraud.php | 6 +- modules/fianetsceau/fianetsceau.php | 3 +- modules/ganalytics/ganalytics.php | 21 ++- modules/gcheckout/gcheckout.php | 34 ++--- modules/hipay/hipay.php | 45 +++--- modules/iadvize/iadvize.php | 4 +- modules/importerosc/importerosc.php | 2 - modules/livezilla/livezilla.php | 9 +- modules/loyalty/LoyaltyModule.php | 23 ++- modules/loyalty/loyalty.php | 16 +-- modules/mailalerts/mailalerts.php | 15 +- modules/mondialrelay/AdminMondialRelay.php | 10 +- modules/mondialrelay/mondialrelay.php | 60 ++++---- modules/moneybookers/moneybookers.php | 25 ++-- modules/newsletter/newsletter.php | 4 +- modules/ogone/ogone.php | 15 +- modules/paypal/express/paypalexpress.php | 10 +- modules/paypal/express/submit.php | 77 +++++----- modules/paypal/payment/paypalpayment.php | 3 +- modules/paypal/payment/submit.php | 57 ++++---- modules/paypal/paypal.php | 78 +++------- modules/paysafecard/PrepaidServices.php | 21 +-- modules/prestafraud/prestafraud.php | 12 +- modules/productcomments/ProductComment.php | 4 +- modules/productcomments/productcomments.php | 53 +++---- modules/productscategory/productscategory.php | 6 +- modules/statscatalog/statscatalog.php | 11 +- 66 files changed, 532 insertions(+), 813 deletions(-) diff --git a/modules/bankwire/bankwire.php b/modules/bankwire/bankwire.php index d72b1e59b..f59d800a3 100644 --- a/modules/bankwire/bankwire.php +++ b/modules/bankwire/bankwire.php @@ -169,9 +169,8 @@ class BankWire extends PaymentModule if (!$this->_checkCurrency($cart)) Tools::redirect('index.php?controller=order'); - $context = Context::getContext(); - $context->smarty->assign(array( + $this->context->smarty->assign(array( 'nbProducts' => $cart->nbProducts(), 'cust_currency' => $cart->id_currency, 'currencies' => $this->getCurrency((int)$cart->id_currency), @@ -190,9 +189,8 @@ class BankWire extends PaymentModule if (!$this->_checkCurrency($params['cart'])) return ; - $context = Context::getContext(); - $context->smarty->assign(array( + $this->context->smarty->assign(array( 'this_path' => $this->_path, 'this_path_ssl' => Tools::getShopDomainSsl(true, true).__PS_BASE_URI__.'modules/'.$this->name.'/' )); @@ -204,10 +202,9 @@ class BankWire extends PaymentModule if (!$this->active) return ; - $context = Context::getContext(); $state = $params['objOrder']->getCurrentState(); if ($state == Configuration::get('PS_OS_BANKWIRE') OR $state == Configuration::get('PS_OS_OUTOFSTOCK')) - $context->smarty->assign(array( + $this->context->smarty->assign(array( 'total_to_pay' => Tools::displayPrice($params['total_to_pay'], $params['currencyObj'], false), 'bankwireDetails' => Tools::nl2br($this->details), 'bankwireAddress' => Tools::nl2br($this->address), @@ -216,7 +213,7 @@ class BankWire extends PaymentModule 'id_order' => $params['objOrder']->id )); else - $context->smarty->assign('status', 'failed'); + $this->context->smarty->assign('status', 'failed'); return $this->display(__FILE__, 'payment_return.tpl'); } diff --git a/modules/blockadvertising/blockadvertising.php b/modules/blockadvertising/blockadvertising.php index 57ab447c3..83e015595 100644 --- a/modules/blockadvertising/blockadvertising.php +++ b/modules/blockadvertising/blockadvertising.php @@ -165,7 +165,6 @@ class BlockAdvertising extends Module */ public function getContent() { - $context = Context::getContext(); $this->postProcess(); $output = ''; @@ -175,7 +174,7 @@ class BlockAdvertising extends Module '; if ($this->adv_img) { - $output .= ''.$this->adv_title.''; + $output .= ''.$this->adv_title.''; $output .= ''; } else @@ -208,11 +207,10 @@ class BlockAdvertising extends Module */ function hookRightColumn($params) { - $context = Context::getContext(); - $context->controller->addCSS($this->_path.'blockadvertising.css', 'all'); - $context->smarty->assign('image', $context->link->protocol_content.$this->adv_img); - $context->smarty->assign('adv_link', $this->adv_link); - $context->smarty->assign('adv_title', $this->adv_title); + $this->context->controller->addCSS($this->_path.'blockadvertising.css', 'all'); + $this->context->smarty->assign('image', $this->context->link->protocol_content.$this->adv_img); + $this->context->smarty->assign('adv_link', $this->adv_link); + $this->context->smarty->assign('adv_title', $this->adv_title); return $this->display(__FILE__, 'blockadvertising.tpl'); } diff --git a/modules/blockbestsellers/blockbestsellers.php b/modules/blockbestsellers/blockbestsellers.php index f8cfc6aa0..8db005a4a 100644 --- a/modules/blockbestsellers/blockbestsellers.php +++ b/modules/blockbestsellers/blockbestsellers.php @@ -99,7 +99,6 @@ class BlockBestSellers extends Module if (Configuration::get('PS_CATALOG_MODE')) return ; - $context = Context::getContext(); $currency = new Currency((int)($params['cookie']->id_currency)); $bestsellers = ProductSale::getBestSalesLight((int)($params['cookie']->id_lang), 0, 5); if (!$bestsellers AND !Configuration::get('PS_BLOCK_BESTSELLERS_DISPLAY')) @@ -113,7 +112,7 @@ class BlockBestSellers extends Module $best_sellers[] = $bestseller; } - $context->smarty->assign(array( + $this->context->smarty->assign(array( 'best_sellers' => $best_sellers, 'mediumSize' => Image::getSize('medium'), )); @@ -129,8 +128,7 @@ class BlockBestSellers extends Module { if (Configuration::get('PS_CATALOG_MODE')) return ; - $context = Context::getContext(); - $context->controller->addCSS(($this->_path).'blockbestsellers.css', 'all'); + $this->context->controller->addCSS(($this->_path).'blockbestsellers.css', 'all'); } public function hookHome($params) @@ -138,7 +136,6 @@ class BlockBestSellers extends Module if (Configuration::get('PS_CATALOG_MODE')) return ; - global $smarty; $currency = new Currency((int)($params['cookie']->id_currency)); $bestsellers = ProductSale::getBestSalesLight((int)($params['cookie']->id_lang), 0, 4); if (!$bestsellers AND !Configuration::get('PS_BLOCK_BESTSELLERS_DISPLAY')) @@ -152,7 +149,7 @@ class BlockBestSellers extends Module $best_sellers[] = $bestseller; } - $smarty->assign(array( + $this->context->smarty->assign(array( 'best_sellers' => $best_sellers, 'homeSize' => Image::getSize('home'))); return $this->display(__FILE__, 'blockbestsellers-home.tpl'); diff --git a/modules/blockcart/blockcart.php b/modules/blockcart/blockcart.php index b26418ff1..3e631d471 100644 --- a/modules/blockcart/blockcart.php +++ b/modules/blockcart/blockcart.php @@ -47,7 +47,6 @@ class BlockCart extends Module public function smartyAssigns(&$smarty, &$params) { global $errors; - $context = Context::getContext(); // Set currency if (!(int)($params['cart']->id_currency)) @@ -100,8 +99,8 @@ class BlockCart extends Module )); if (sizeof($errors)) $smarty->assign('errors', $errors); - if(isset($context->cookie->ajax_blockcart_display)) - $smarty->assign('colapseExpandStatus', $context->cookie->ajax_blockcart_display); + if(isset($this->context->cookie->ajax_blockcart_display)) + $smarty->assign('colapseExpandStatus', $this->context->cookie->ajax_blockcart_display); } public function getContent() @@ -160,9 +159,8 @@ class BlockCart extends Module if (Configuration::get('PS_CATALOG_MODE')) return; - $context = Context::getContext(); - $context->smarty->assign('order_page', strpos($_SERVER['PHP_SELF'], 'order') !== false); - $this->smartyAssigns($context->smarty, $params); + $this->context->smarty->assign('order_page', strpos($_SERVER['PHP_SELF'], 'order') !== false); + $this->smartyAssigns($this->context->smarty, $params); return $this->display(__FILE__, 'blockcart.tpl'); } @@ -176,8 +174,7 @@ class BlockCart extends Module if (Configuration::get('PS_CATALOG_MODE')) return; - $context = Context::getContext(); - $this->smartyAssigns($context->smarty, $params); + $this->smartyAssigns($this->context->smarty, $params); $res = $this->display(__FILE__, 'blockcart-json.tpl'); return $res; } @@ -186,10 +183,9 @@ class BlockCart extends Module { if (Configuration::get('PS_CATALOG_MODE')) return; - $context = Context::getContext(); - $context->controller->addCSS(($this->_path).'blockcart.css', 'all'); + $this->context->controller->addCSS(($this->_path).'blockcart.css', 'all'); if ((int)(Configuration::get('PS_BLOCK_CART_AJAX'))) - $context->controller->addJS(($this->_path).'ajax-cart.js'); + $this->context->controller->addJS(($this->_path).'ajax-cart.js'); } } diff --git a/modules/blockcategories/blockcategories.php b/modules/blockcategories/blockcategories.php index 0a63f4ebc..ce7a75be9 100644 --- a/modules/blockcategories/blockcategories.php +++ b/modules/blockcategories/blockcategories.php @@ -138,8 +138,7 @@ class BlockCategories extends Module public function hookLeftColumn($params) { - $context = Context::getContext(); - $id_current_shop = $context->shop->getID(); + $id_current_shop = $this->context->shop->getID(); $id_customer = (int)($params['cookie']->id_customer); // Get all groups for this customer and concatenate them as a string: "1,2,3..." @@ -182,34 +181,34 @@ class BlockCategories extends Module unset($resultIds); //TODO clean that $res = $blockCategTree; - $shopcurrentroot = $context->shop->getCategory(); + $shopcurrentroot = $this->context->shop->getCategory(); if ($blockCategTree['id'] != $shopcurrentroot) $blockCategTree = $this->cleanTree($blockCategTree['children']); $isDhtml = (Configuration::get('BLOCK_CATEG_DHTML') == 1 ? true : false); if (Tools::isSubmit('id_category')) { - $context->cookie->last_visited_category = $id_category; - $context->smarty->assign('currentCategoryId', $context->cookie->last_visited_category); + $this->context->cookie->last_visited_category = $id_category; + $this->context->smarty->assign('currentCategoryId', $this->context->cookie->last_visited_category); } if (Tools::isSubmit('id_product')) { - if (!isset($context->cookie->last_visited_category) OR !Product::idIsOnCategoryId($id_product, array('0' => array('id_category' => $context->cookie->last_visited_category)))) + if (!isset($this->context->cookie->last_visited_category) OR !Product::idIsOnCategoryId($id_product, array('0' => array('id_category' => $this->context->cookie->last_visited_category)))) { $product = new Product($id_product); if (isset($product) AND Validate::isLoadedObject($product)) - $context->cookie->last_visited_category = (int)($product->id_category_default); + $this->context->cookie->last_visited_category = (int)($product->id_category_default); } - $context->smarty->assign('currentCategoryId', (int)($context->cookie->last_visited_category)); + $this->context->smarty->assign('currentCategoryId', (int)($this->context->cookie->last_visited_category)); } - $context->smarty->assign('blockCategTree', $blockCategTree); + $this->context->smarty->assign('blockCategTree', $blockCategTree); if (file_exists(_PS_THEME_DIR_.'modules/blockcategories/blockcategories.tpl')) - $context->smarty->assign('branche_tpl_path', _PS_THEME_DIR_.'modules/blockcategories/category-tree-branch.tpl'); + $this->context->smarty->assign('branche_tpl_path', _PS_THEME_DIR_.'modules/blockcategories/category-tree-branch.tpl'); else - $context->smarty->assign('branche_tpl_path', _PS_MODULE_DIR_.'blockcategories/category-tree-branch.tpl'); - $context->smarty->assign('isDhtml', $isDhtml); + $this->context->smarty->assign('branche_tpl_path', _PS_MODULE_DIR_.'blockcategories/category-tree-branch.tpl'); + $this->context->smarty->assign('isDhtml', $isDhtml); } - $context->smarty->cache_lifetime = 31536000; // 1 Year + $this->context->smarty->cache_lifetime = 31536000; // 1 Year $display = $this->display(__FILE__, 'blockcategories.tpl', $smartyCacheId); Tools::restoreCacheSettings(); return $display; @@ -217,8 +216,8 @@ class BlockCategories extends Module public function hookFooter($params) { - $context = $this->context; - $id_current_shop = $context->shop->getID(); + $this->context = $this->context; + $id_current_shop = $this->context->shop->getID(); $id_customer = (int)($params['cookie']->id_customer); // Get all groups for this customer and concatenate them as a string: "1,2,3..." @@ -257,43 +256,43 @@ class BlockCategories extends Module $nbrColumns=3; $numberColumn = abs(sizeof($result)/$nbrColumns); $widthColumn= floor(100/$nbrColumns); - $context->smarty->assign('numberColumn', $numberColumn); - $context->smarty->assign('widthColumn', $widthColumn); + $this->context->smarty->assign('numberColumn', $numberColumn); + $this->context->smarty->assign('widthColumn', $widthColumn); $blockCategTree = $this->getTree($resultParents, $resultIds, Configuration::get('BLOCK_CATEG_MAX_DEPTH')); unset($resultParents); unset($resultIds); //TODO clean that $res = $blockCategTree; - if($blockCategTree['id'] != $context->shop->getCategory()) + if($blockCategTree['id'] != $this->context->shop->getCategory()) $blockCategTree = $this->cleanTree($blockCategTree['children']); $isDhtml = (Configuration::get('BLOCK_CATEG_DHTML') == 1 ? true : false); $isDhtml = (Configuration::get('BLOCK_CATEG_DHTML') == 1 ? true : false); if (Tools::isSubmit('id_category')) { - $context->cookie->last_visited_category = $id_category; - $context->smarty->assign('currentCategoryId', $context->cookie->last_visited_category); + $this->context->cookie->last_visited_category = $id_category; + $this->context->smarty->assign('currentCategoryId', $this->context->cookie->last_visited_category); } if (Tools::isSubmit('id_product')) { - if (!isset($context->cookie->last_visited_category) OR !Product::idIsOnCategoryId($id_product, array('0' => array('id_category' => $context->cookie->last_visited_category)))) + if (!isset($this->context->cookie->last_visited_category) OR !Product::idIsOnCategoryId($id_product, array('0' => array('id_category' => $this->context->cookie->last_visited_category)))) { $product = new Product($id_product); if (isset($product) AND Validate::isLoadedObject($product)) - $context->cookie->last_visited_category = (int)($product->id_category_default); + $this->context->cookie->last_visited_category = (int)($product->id_category_default); } - $context->smarty->assign('currentCategoryId', (int)($context->cookie->last_visited_category)); + $this->context->smarty->assign('currentCategoryId', (int)($this->context->cookie->last_visited_category)); } - $context->smarty->assign('blockCategTree', $blockCategTree); + $this->context->smarty->assign('blockCategTree', $blockCategTree); if (file_exists(_PS_THEME_DIR_.'modules/blockcategories/blockcategories_footer.tpl')) - $context->smarty->assign('branche_tpl_path', _PS_THEME_DIR_.'modules/blockcategories/category-tree-branch.tpl'); + $this->context->smarty->assign('branche_tpl_path', _PS_THEME_DIR_.'modules/blockcategories/category-tree-branch.tpl'); else - $context->smarty->assign('branche_tpl_path', _PS_MODULE_DIR_.'blockcategories/category-tree-branch.tpl'); - $context->smarty->assign('isDhtml', $isDhtml); + $this->context->smarty->assign('branche_tpl_path', _PS_MODULE_DIR_.'blockcategories/category-tree-branch.tpl'); + $this->context->smarty->assign('isDhtml', $isDhtml); } - $context->smarty->cache_lifetime = 31536000; // 1 Year + $this->context->smarty->cache_lifetime = 31536000; // 1 Year $display = $this->display(__FILE__, 'blockcategories_footer.tpl', $smartyCacheId); Tools::restoreCacheSettings(); return $display; diff --git a/modules/blockcms/blockcms.php b/modules/blockcms/blockcms.php index 37af200d9..48da22861 100755 --- a/modules/blockcms/blockcms.php +++ b/modules/blockcms/blockcms.php @@ -117,14 +117,13 @@ class BlockCms extends Module private function getBlocksCMS($location) { - $context = Context::getContext(); return Db::getInstance()->ExecuteS(' SELECT bc.`id_cms_block`, bcl.`name` block_name, ccl.`name` category_name, bc.`position`, bc.`id_cms_category`, bc.`display_store` FROM `'._DB_PREFIX_.'cms_block` bc INNER JOIN `'._DB_PREFIX_.'cms_category_lang` ccl ON (bc.`id_cms_category` = ccl.`id_cms_category`) INNER JOIN `'._DB_PREFIX_.'cms_block_lang` bcl ON (bc.`id_cms_block` = bcl.`id_cms_block`) - WHERE ccl.`id_lang` = '.(int)$context->language->id.' AND bc.`location` = '.(int)$location.' AND bcl.`id_lang` = '.(int)$context->language->id.' + WHERE ccl.`id_lang` = '.(int)$this->context->language->id.' AND bc.`location` = '.(int)$location.' AND bcl.`id_lang` = '.(int)$this->context->language->id.' ORDER BY bc.`position`'); } @@ -133,10 +132,9 @@ class BlockCms extends Module return array_merge($this->getBlocksCMS(self::LEFT_COLUMN), $this->getBlocksCMS(self::RIGHT_COLUMN)); } - static public function getCMStitlesFooter($context = null) + static public function getCMStitlesFooter() { - if (!$context) - $context = Context::getContext(); + $context = Context::getContext(); $footerCms = Configuration::get('FOOTER_CMS'); if (empty($footerCms)) @@ -176,10 +174,9 @@ class BlockCms extends Module return $content; } - static public function getCMStitles($location, $context = null) + static public function getCMStitles($location) { - if (!$context) - $context = Context::getContext(); + $context = Context::getContext(); $cmsCategories = Db::getInstance()->ExecuteS(' SELECT bc.`id_cms_block`, bc.`id_cms_category`, bc.`display_store`, ccl.`link_rewrite`, ccl.`name` category_name, bcl.`name` block_name @@ -301,7 +298,7 @@ class BlockCms extends Module private function _displayForm() { - $context = Context::getContext(); + $this->context = Context::getContext(); $cms_blocks_left = $this->getBlocksCMS(0); $cms_blocks_right = $this->getBlocksCMS(1); @@ -412,7 +409,7 @@ class BlockCms extends Module '.$this->l('ID').' '.$this->l('Name').' '; - $this->displayRecurseCheckboxes(CMSCategory::getRecurseCategory($context->language->id), explode('|', Configuration::get('FOOTER_CMS'))); + $this->displayRecurseCheckboxes(CMSCategory::getRecurseCategory($this->context->language->id), explode('|', Configuration::get('FOOTER_CMS'))); $this->_html .= '

@@ -422,7 +419,6 @@ class BlockCms extends Module private function _displayAddForm() { - $context = Context::getContext(); $defaultLanguage = (int)Configuration::get('PS_LANG_DEFAULT'); $languages = Language::getLanguages(false); $divLangName = 'name'; @@ -461,7 +457,7 @@ class BlockCms extends Module
@@ -705,9 +701,9 @@ class BlockCms extends Module public function hookLeftColumn() { - $context = Context::getContext(); + $this->context = Context::getContext(); $cms_titles = self::getCMStitles(self::LEFT_COLUMN); - $context->smarty->assign(array( + $this->context->smarty->assign(array( 'block' => 1, 'cms_titles' => $cms_titles, 'theme_dir' => _PS_THEME_DIR_ @@ -717,10 +713,9 @@ class BlockCms extends Module public function hookRightColumn() { - $context = Context::getContext(); $cms_titles = self::getCMStitles(self::RIGHT_COLUMN); - $context->smarty->assign(array( + $this->context->smarty->assign(array( 'block' => 1, 'cms_titles' => $cms_titles, 'theme_dir' => _PS_THEME_DIR_ @@ -730,12 +725,11 @@ class BlockCms extends Module public function hookFooter() { - $context = Context::getContext(); if (Configuration::get('FOOTER_BLOCK_ACTIVATION')) { $cms_titles = self::getCMStitlesFooter(); - $context->smarty->assign(array( + $this->context->smarty->assign(array( 'block' => 0, 'cmslinks' => $cms_titles, 'theme_dir' => _PS_THEME_DIR_, @@ -749,8 +743,7 @@ class BlockCms extends Module public function hookHeader($params) { - $context = Context::getContext(); - $context->controller->addCSS(($this->_path).'blockcms.css', 'all'); + $this->context->controller->addCSS(($this->_path).'blockcms.css', 'all'); } public function getL($key) diff --git a/modules/blockcustomerprivacy/blockcustomerprivacy.php b/modules/blockcustomerprivacy/blockcustomerprivacy.php index ebd84e553..d3b8a1e88 100644 --- a/modules/blockcustomerprivacy/blockcustomerprivacy.php +++ b/modules/blockcustomerprivacy/blockcustomerprivacy.php @@ -54,10 +54,9 @@ class blockcustomerprivacy extends Module public function getContent() { - $context = Context::getContext(); $defaultLanguage = (int)(Configuration::get('PS_LANG_DEFAULT')); $languages = Language::getLanguages(false); - $iso = $context->language->iso_code; + $iso = $this->context->language->iso_code; if (Tools::isSubmit('submitCustPrivMess')) { @@ -151,10 +150,9 @@ class blockcustomerprivacy extends Module { if (!$this->active) return ; - $context = Context::getContext(); - $context->smarty->assign(array( - 'privacy_message' => Configuration::get('CUSTPRIV_MESSAGE', $context->language->id), + $this->context->smarty->assign(array( + 'privacy_message' => Configuration::get('CUSTPRIV_MESSAGE', $this->context->language->id), 'error_message' => $this->l('Please agree with the customer data privacy by ticking the checkbox below.') )); return $this->display(__FILE__, 'blockcustomerprivacy.tpl'); diff --git a/modules/blocklayered/blocklayered.php b/modules/blocklayered/blocklayered.php index 092aa0e5f..6abdde663 100644 --- a/modules/blocklayered/blocklayered.php +++ b/modules/blocklayered/blocklayered.php @@ -91,11 +91,10 @@ class BlockLayered extends Module if ($id_parent == 1) return; - $context = Context::getContext(); - $context->controller->addJS($this->_path.'blocklayered.js'); - $context->controller->addJS(_PS_JS_DIR_.'jquery/jquery-ui-1.8.10.custom.min.js'); - $context->controller->addCSS(_PS_CSS_DIR_.'jquery-ui-1.8.10.custom.css', 'all'); - $context->controller->addCSS(($this->_path).'blocklayered.css', 'all'); + $this->context->controller->addJS($this->_path.'blocklayered.js'); + $this->context->controller->addJS(_PS_JS_DIR_.'jquery/jquery-ui-1.8.10.custom.min.js'); + $this->context->controller->addCSS(_PS_CSS_DIR_.'jquery-ui-1.8.10.custom.css', 'all'); + $this->context->controller->addCSS(($this->_path).'blocklayered.css', 'all'); } public function hookFooter($params) @@ -134,7 +133,6 @@ class BlockLayered extends Module public function getContent() { - $context = Context::getContext(); $errors = array(); $html = ''; @@ -313,7 +311,7 @@ class BlockLayered extends Module '.(int)$filtersTemplate['id_layered_filter'].' '.$filtersTemplate['name'].' '.(int)$filtersTemplate['n_categories'].' - '.Tools::displayDate($filtersTemplate['date_add'], (int)$context->language->id, true).' + '.Tools::displayDate($filtersTemplate['date_add'], (int)$this->context->language->id, true).' @@ -648,7 +646,6 @@ class BlockLayered extends Module if (!empty($this->products)) return $this->products; - $context = Context::getContext(); /* If the current category isn't defined of if it's homepage, we have nothing to display */ $id_parent = (int)Tools::getValue('id_category', Tools::getValue('id_category_layered', 1)); @@ -736,14 +733,14 @@ class BlockLayered extends Module p.ean13, pl.available_later, pl.description_short, pl.link_rewrite, pl.name, i.id_image, il.legend, m.name manufacturer_name, p.condition, p.id_manufacturer, stock.quantity, DATEDIFF(p.`date_add`, DATE_SUB(NOW(), INTERVAL '.(Validate::isUnsignedInt(Configuration::get('PS_NB_DAYS_NEW_PRODUCT')) ? Configuration::get('PS_NB_DAYS_NEW_PRODUCT') : 20).' DAY)) > 0 AS new FROM '._DB_PREFIX_.'product p - '.$context->shop->sqlAsso('product', 'p').' - LEFT JOIN '._DB_PREFIX_.'product_lang pl ON (pl.id_product = p.id_product'.$context->shop->sqlLang('pl').') + '.$this->context->shop->sqlAsso('product', 'p').' + LEFT JOIN '._DB_PREFIX_.'product_lang pl ON (pl.id_product = p.id_product'.$this->context->shop->sqlLang('pl').') '.Product::sqlStock('p', 0).' LEFT JOIN '._DB_PREFIX_.'image i ON (i.id_product = p.id_product AND i.cover = 1) - LEFT JOIN '._DB_PREFIX_.'image_lang il ON (i.id_image = il.id_image AND il.id_lang = '.(int)$context->language->id.') + LEFT JOIN '._DB_PREFIX_.'image_lang il ON (i.id_image = il.id_image AND il.id_lang = '.(int)$this->context->language->id.') LEFT JOIN '._DB_PREFIX_.'manufacturer m ON (m.id_manufacturer = p.id_manufacturer) WHERE p.`active` = 1 - AND pl.id_lang = '.(int)$context->language->id + AND pl.id_lang = '.(int)$this->context->language->id .$queryFilters. ' ORDER BY '.Tools::getProductsOrder('by', Tools::getValue('orderby')).' '.Tools::getProductsOrder('way', Tools::getValue('orderway')). ' LIMIT '.(((int)(Tools::getValue('p', 1)) - 1) * $n.','.$n); @@ -754,7 +751,6 @@ class BlockLayered extends Module public function generateFiltersBlock($selectedFilters = array()) { - $context = Context::getContext(); /* If the current category isn't defined of if it's homepage, we have nothing to display */ $id_parent = (int)Tools::getValue('id_category', Tools::getValue('id_category_layered', 1)); @@ -771,7 +767,7 @@ class BlockLayered extends Module FROM '._DB_PREFIX_.'category c LEFT JOIN '._DB_PREFIX_.'category_group cg ON (cg.id_category = c.id_category) LEFT JOIN '._DB_PREFIX_.'category_lang cl ON (cl.id_category = c.id_category) - WHERE c.nleft > '.(int)$category->nleft.' and c.nright <= '.(int)$category->nright.' AND c.active = 1 AND c.id_parent = '.(int)$category->id.' AND cl.id_lang = '.(int)$context->language->id.' + WHERE c.nleft > '.(int)$category->nleft.' and c.nright <= '.(int)$category->nright.' AND c.active = 1 AND c.id_parent = '.(int)$category->id.' AND cl.id_lang = '.(int)$this->context->language->id.' AND cg.id_group '.pSQL(sizeof($groups) ? 'IN ('.implode(',', $groups).')' : '= 1').' GROUP BY c.id_category ORDER BY c.position ASC'); @@ -836,7 +832,7 @@ class BlockLayered extends Module SELECT fvl.id_feature_value, fvl.value FROM '._DB_PREFIX_.'feature_value fv LEFT JOIN '._DB_PREFIX_.'feature_value_lang fvl ON (fvl.id_feature_value = fv.id_feature_value) - WHERE (fv.custom IS NULL OR fv.custom = 0) AND fv.id_feature = '.(int)$filterBlocks[(int)$filter['position']]['id_key'].' AND fvl.id_lang = '.(int)$context->language->id); + WHERE (fv.custom IS NULL OR fv.custom = 0) AND fv.id_feature = '.(int)$filterBlocks[(int)$filter['position']]['id_key'].' AND fvl.id_lang = '.(int)$this->context->language->id); break; case 'id_attribute_group': @@ -846,7 +842,7 @@ class BlockLayered extends Module SELECT al.id_attribute, al.name, a.color FROM '._DB_PREFIX_.'attribute a LEFT JOIN '._DB_PREFIX_.'attribute_lang al ON (al.id_attribute = a.id_attribute) - WHERE a.id_attribute_group = '.(int)$filterBlocks[(int)$filter['position']]['id_key'].' AND al.id_lang = '.(int)$context->language->id); + WHERE a.id_attribute_group = '.(int)$filterBlocks[(int)$filter['position']]['id_key'].' AND al.id_lang = '.(int)$this->context->language->id); break; } } @@ -857,7 +853,7 @@ class BlockLayered extends Module $fNames = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS(' SELECT id_feature, name FROM '._DB_PREFIX_.'feature_lang - WHERE id_lang = '.(int)$context->language->id.' AND id_feature IN ('.implode(',', $f).')'); + WHERE id_lang = '.(int)$this->context->language->id.' AND id_feature IN ('.implode(',', $f).')'); $fNameByID = array(); foreach ($fNames AS $fName) $fNameByID[(int)$fName['id_feature']] = $fName['name']; @@ -870,7 +866,7 @@ class BlockLayered extends Module SELECT ag.id_attribute_group, agl.public_name, ag.is_color_group FROM '._DB_PREFIX_.'attribute_group ag LEFT JOIN '._DB_PREFIX_.'attribute_group_lang agl ON (agl.id_attribute_group = ag.id_attribute_group) - WHERE agl.id_lang = '.(int)$context->language->id.' AND ag.id_attribute_group IN ('.implode(',', $a).')'); + WHERE agl.id_lang = '.(int)$this->context->language->id.' AND ag.id_attribute_group IN ('.implode(',', $a).')'); $aNameByID = $colorGroups = array(); foreach ($aNames AS $aName) @@ -1085,9 +1081,9 @@ class BlockLayered extends Module foreach($_GET AS $key => $val) $params .= $key.'='.$val.'&'; - $share_url = $context->link->getCategoryLink((int)$category->id, $category->link_rewrite[(int)$context->language->id], $context->language->id).rtrim($params, '&'); + $share_url = $this->context->link->getCategoryLink((int)$category->id, $category->link_rewrite[(int)$this->context->language->id], $this->context->language->id).rtrim($params, '&'); - $context->smarty->assign(array( + $this->context->smarty->assign(array( 'display_share' => (int)Configuration::get('PS_LAYERED_SHARE'), 'share_url' => $this->getShortLink($share_url), 'layered_show_qties' => (int)Configuration::get('PS_LAYERED_SHOW_QTIES'), @@ -1102,7 +1098,6 @@ class BlockLayered extends Module public function ajaxCallBackOffice($categoryBox = array(), $id_layered_filter = NULL) { - $context = Context::getContext(); if (!empty($id_layered_filter)) { @@ -1123,7 +1118,7 @@ class BlockLayered extends Module LEFT JOIN '._DB_PREFIX_.'product_attribute_combination pac ON (pac.id_attribute = a.id_attribute) LEFT JOIN '._DB_PREFIX_.'product_attribute pa ON (pa.id_product_attribute = pac.id_product_attribute) LEFT JOIN '._DB_PREFIX_.'category_product cp ON (cp.id_product = pa.id_product)' : '').' - WHERE agl.id_lang = '.(int)$context->language->id. + WHERE agl.id_lang = '.(int)$this->context->language->id. (sizeof($categoryBox) ? ' AND cp.id_category IN ('.implode(',', $categoryBox).')' : '').' GROUP BY ag.id_attribute_group'); @@ -1134,7 +1129,7 @@ class BlockLayered extends Module '.(sizeof($categoryBox) ? ' LEFT JOIN '._DB_PREFIX_.'feature_product fp ON (fp.id_feature = fv.id_feature) LEFT JOIN '._DB_PREFIX_.'category_product cp ON (cp.id_product = fp.id_product)' : '').' - WHERE (fv.custom IS NULL OR fv.custom = 0) AND fl.id_lang = '.(int)$context->language->id. + WHERE (fv.custom IS NULL OR fv.custom = 0) AND fl.id_lang = '.(int)$this->context->language->id. (sizeof($categoryBox) ? ' AND cp.id_category IN ('.implode(',', $categoryBox).')' : '').' GROUP BY fl.id_feature'); @@ -1215,11 +1210,10 @@ class BlockLayered extends Module public function ajaxCall() { - $context = Context::getContext(); $selectedFilters = $this->getSelectedFilters(); $products = $this->getProductByFilters($selectedFilters); - $products = Product::getProductsProperties($context->language->id, $products); + $products = Product::getProductsProperties($this->context->language->id, $products); $nbProducts = $this->nbr_products; $range = 2; /* how many pages around page selected */ @@ -1241,7 +1235,7 @@ class BlockLayered extends Module if ($stop > $pages_nb) $stop = (int)($pages_nb); - $context->smarty->assign('nb_products', $nbProducts); + $this->context->smarty->assign('nb_products', $nbProducts); $pagination_infos = array( 'pages_nb' => (int)($pages_nb), 'p' => (int)$p, @@ -1251,15 +1245,15 @@ class BlockLayered extends Module 'stop' => (int)$stop, 'nArray' => $nArray = (int)Configuration::get('PS_PRODUCTS_PER_PAGE') != 10 ? array((int)Configuration::get('PS_PRODUCTS_PER_PAGE'), 10, 20, 50) : array(10, 20, 50) ); - $context->smarty->assign($pagination_infos); + $this->context->smarty->assign($pagination_infos); - $context->smarty->assign('products', $products); + $this->context->smarty->assign('products', $products); /* We are sending an array in jSon to the .js controller, it will update both the filters and the products zones */ return Tools::jsonEncode(array( 'filtersBlock' => $this->generateFiltersBlock($selectedFilters), - 'productList' => $context->smarty->fetch(_PS_THEME_DIR_.'product-list.tpl'), - 'pagination' => $context->smarty->fetch(_PS_THEME_DIR_.'pagination.tpl') + 'productList' => $this->context->smarty->fetch(_PS_THEME_DIR_.'product-list.tpl'), + 'pagination' => $this->context->smarty->fetch(_PS_THEME_DIR_.'pagination.tpl') )); } diff --git a/modules/blocklink/blocklink.php b/modules/blocklink/blocklink.php index 89060046c..ea2460d76 100644 --- a/modules/blocklink/blocklink.php +++ b/modules/blocklink/blocklink.php @@ -84,14 +84,13 @@ class BlockLink extends Module public function hookLeftColumn($params) { - $context = Context::getContext(); - $links = $this->getLinks(); + $links = $this->getLinks(); - $context->smarty->assign(array( + $this->context->smarty->assign(array( 'blocklink_links' => $links, - 'title' => Configuration::get('PS_BLOCKLINK_TITLE', $context->language->id), + 'title' => Configuration::get('PS_BLOCKLINK_TITLE', $this->context->language->id), 'url' => Configuration::get('PS_BLOCKLINK_URL'), - 'lang' => 'text_'.$context->language->id + 'lang' => 'text_'.$this->context->language->id )); if (!$links) return false; @@ -329,8 +328,7 @@ class BlockLink extends Module private function _list() { $links = $this->getLinks(); - $context = Context::getContext(); - $languages = Language::getLanguages(); + $languages = Language::getLanguages(); if ($links) { $this->_html .= ' @@ -370,7 +368,7 @@ class BlockLink extends Module $this->_html .= ' '.$link['id'].' - '.$link['text_'.$context->language->id].' + '.$link['text_'.$this->context->language->id].' '.$link['url'].' diff --git a/modules/blockmanufacturer/blockmanufacturer.php b/modules/blockmanufacturer/blockmanufacturer.php index 2f3c1079f..363259862 100644 --- a/modules/blockmanufacturer/blockmanufacturer.php +++ b/modules/blockmanufacturer/blockmanufacturer.php @@ -54,11 +54,10 @@ class BlockManufacturer extends Module function hookLeftColumn($params) { - $context = Context::getContext(); - $context->smarty->assign(array( + $this->context->smarty->assign(array( 'manufacturers' => Manufacturer::getManufacturers(), - 'link' => $context->link, + 'link' => $this->context->link, 'text_list' => Configuration::get('MANUFACTURER_DISPLAY_TEXT'), 'text_list_nb' => Configuration::get('MANUFACTURER_DISPLAY_TEXT_NB'), 'form_list' => Configuration::get('MANUFACTURER_DISPLAY_FORM'), @@ -128,7 +127,6 @@ class BlockManufacturer extends Module function hookHeader($params) { - $context = Context::getContext(); - $context->controller->addCSS(($this->_path).'blockmanufacturer.css', 'all'); + $this->context->controller->addCSS(($this->_path).'blockmanufacturer.css', 'all'); } } diff --git a/modules/blockmyaccount/blockmyaccount.php b/modules/blockmyaccount/blockmyaccount.php index 15214fa6b..40a50f7a4 100644 --- a/modules/blockmyaccount/blockmyaccount.php +++ b/modules/blockmyaccount/blockmyaccount.php @@ -58,10 +58,9 @@ class BlockMyAccount extends Module public function hookLeftColumn($params) { - $context = Context::getContext(); if (!$params['cookie']->isLogged()) return false; - $context->smarty->assign(array( + $this->context->smarty->assign(array( 'voucherAllowed' => (int)(Configuration::get('PS_VOUCHERS')), 'returnAllowed' => (int)(Configuration::get('PS_ORDER_RETURN')), 'HOOK_BLOCK_MY_ACCOUNT' => Module::hookExec('myAccountBlock') @@ -85,8 +84,7 @@ class BlockMyAccount extends Module } function hookHeader($params) { - $context = Context::getContext(); - $context->controller->addCSS(($this->_path).'blockmyaccount.css', 'all'); + $this->context->controller->addCSS(($this->_path).'blockmyaccount.css', 'all'); } } diff --git a/modules/blocknewproducts/blocknewproducts.php b/modules/blocknewproducts/blocknewproducts.php index dd55118f7..7437e7034 100644 --- a/modules/blocknewproducts/blocknewproducts.php +++ b/modules/blocknewproducts/blocknewproducts.php @@ -96,11 +96,10 @@ class BlockNewProducts extends Module public function hookRightColumn($params) { - $context = Context::getContext(); $newProducts = Product::getNewProducts((int)($params['cookie']->id_lang), 0, (int)(Configuration::get('NEW_PRODUCTS_NBR'))); if (!$newProducts AND !Configuration::get('PS_BLOCK_NEWPRODUCTS_DISPLAY')) return; - $context->smarty->assign(array('new_products' => $newProducts, 'mediumSize' => Image::getSize('medium'))); + $this->context->smarty->assign(array('new_products' => $newProducts, 'mediumSize' => Image::getSize('medium'))); return $this->display(__FILE__, 'blocknewproducts.tpl'); } @@ -112,8 +111,7 @@ class BlockNewProducts extends Module public function hookHeader($params) { - $context = Context::getContext(); - $context->controller->addCSS(($this->_path).'blocknewproducts.css', 'all'); + $this->context->controller->addCSS(($this->_path).'blocknewproducts.css', 'all'); } } diff --git a/modules/blocknewsletter/blocknewsletter.php b/modules/blocknewsletter/blocknewsletter.php index 45837bb61..94b3390e5 100644 --- a/modules/blocknewsletter/blocknewsletter.php +++ b/modules/blocknewsletter/blocknewsletter.php @@ -222,9 +222,8 @@ class Blocknewsletter extends Module private function sendVoucher($email) { - $context = Context::getContext(); if ($discount = Configuration::get('NW_VOUCHER_CODE')) - return Mail::Send($context->language->id, 'newsletter_voucher', Mail::l('Newsletter voucher'), array('{discount}' => $discount), $email, NULL, NULL, NULL, NULL, NULL, dirname(__FILE__).'/mails/'); + return Mail::Send($this->context->language->id, 'newsletter_voucher', Mail::l('Newsletter voucher'), array('{discount}' => $discount), $email, NULL, NULL, NULL, NULL, NULL, dirname(__FILE__).'/mails/'); return false; } @@ -235,14 +234,13 @@ class Blocknewsletter extends Module function hookLeftColumn($params) { - $context = Context::getContext(); if (Tools::isSubmit('submitNewsletter')) { $this->newsletterRegistration(); if ($this->error) { - $context->smarty->assign(array('color' => 'red', + $this->context->smarty->assign(array('color' => 'red', 'msg' => $this->error, 'nw_value' => isset($_POST['email']) ? pSQL($_POST['email']) : false, 'nw_error' => true, @@ -252,19 +250,18 @@ class Blocknewsletter extends Module { if (Configuration::get('NW_CONFIRMATION_EMAIL') AND isset($_POST['action']) AND (int)($_POST['action']) == 0) Mail::Send($params['cookie']->id_lang, 'newsletter_conf', Mail::l('Newsletter confirmation'), array(), pSQL($_POST['email']), NULL, NULL, NULL, NULL, NULL, dirname(__FILE__).'/mails/'); - $context->smarty->assign(array('color' => 'green', + $this->context->smarty->assign(array('color' => 'green', 'msg' => $this->valid, 'nw_error' => false)); } } - $context->smarty->assign('this_path', $this->_path); + $this->context->smarty->assign('this_path', $this->_path); return $this->display(__FILE__, 'blocknewsletter.tpl'); } function hookHeader($params) { - $context = Context::getContext(); - $context->controller->addCSS(($this->_path).'blocknewsletter.css', 'all'); + $this->context->controller->addCSS(($this->_path).'blocknewsletter.css', 'all'); } } diff --git a/modules/blockpaymentlogo/blockpaymentlogo.php b/modules/blockpaymentlogo/blockpaymentlogo.php index 22d66f3ef..0c6d28c87 100644 --- a/modules/blockpaymentlogo/blockpaymentlogo.php +++ b/modules/blockpaymentlogo/blockpaymentlogo.php @@ -64,7 +64,6 @@ class BlockPaymentLogo extends Module public function getContent() { - $context = Context::getContext(); $html = '

'.$this->l('Payment logo').'

'; @@ -76,7 +75,7 @@ class BlockPaymentLogo extends Module $html .= $this->displayConfirmation($this->l('Settings are updated')); } - $cmss = CMS::listCms($context->language->id); + $cmss = CMS::listCms($this->context->language->id); if (!sizeof($cmss)) $html .= $this->displayError($this->l('No CMS page is available')); @@ -112,14 +111,13 @@ class BlockPaymentLogo extends Module if (Configuration::get('PS_CATALOG_MODE')) return ; - $context = Context::getContext(); if (!Configuration::get('PS_PAYMENT_LOGO_CMS_ID')) return; - $cms = new CMS(Configuration::get('PS_PAYMENT_LOGO_CMS_ID'), $context->language->id); + $cms = new CMS(Configuration::get('PS_PAYMENT_LOGO_CMS_ID'), $this->context->language->id); if (!Validate::isLoadedObject($cms)) return; - $context->smarty->assign('cms_payement_logo', $cms); + $this->context->smarty->assign('cms_payement_logo', $cms); return $this->display(__FILE__, 'blockpaymentlogo.tpl'); } @@ -136,8 +134,7 @@ class BlockPaymentLogo extends Module { if (Configuration::get('PS_CATALOG_MODE')) return ; - $context = Context::getContext(); - $context->controller->addCSS(($this->_path).'blockpaymentlogo.css', 'all'); + $this->context->controller->addCSS(($this->_path).'blockpaymentlogo.css', 'all'); } } diff --git a/modules/blockrss/blockrss.php b/modules/blockrss/blockrss.php index f5f8d14a7..4b11557f4 100644 --- a/modules/blockrss/blockrss.php +++ b/modules/blockrss/blockrss.php @@ -132,7 +132,6 @@ class Blockrss extends Module function hookLeftColumn($params) { - $context = Context::getContext(); // Conf $title = strval(Configuration::get('RSS_FEED_TITLE')); @@ -148,7 +147,7 @@ class Blockrss extends Module $rss_links[] = array('title' => $item->title, 'url' => $item->link); // Display smarty - $context->smarty->assign(array('title' => ($title ? $title : $this->l('RSS feed')), 'rss_links' => $rss_links)); + $this->context->smarty->assign(array('title' => ($title ? $title : $this->l('RSS feed')), 'rss_links' => $rss_links)); return $this->display(__FILE__, 'blockrss.tpl'); } @@ -160,8 +159,7 @@ class Blockrss extends Module function hookHeader($params) { - $context = Context::getContext(); - $context->controller->addCSS(($this->_path).'blockrss.css', 'all'); + $this->context->controller->addCSS(($this->_path).'blockrss.css', 'all'); } } diff --git a/modules/blocksearch/blocksearch.php b/modules/blocksearch/blocksearch.php index 4a33fc872..ee2346f21 100644 --- a/modules/blocksearch/blocksearch.php +++ b/modules/blocksearch/blocksearch.php @@ -80,23 +80,22 @@ class BlockSearch extends Module */ private function _hookCommon($params) { - $context = Context::getContext(); - $context->smarty->assign('ENT_QUOTES', ENT_QUOTES); - $context->smarty->assign('search_ssl', (int)(!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off')); + $this->context->smarty->assign('ENT_QUOTES', ENT_QUOTES); + $this->context->smarty->assign('search_ssl', (int)(!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off')); $ajaxSearch=(int)(Configuration::get('PS_SEARCH_AJAX')); - $context->smarty->assign('ajaxsearch', $ajaxSearch); + $this->context->smarty->assign('ajaxsearch', $ajaxSearch); $instantSearch = (int)(Configuration::get('PS_INSTANT_SEARCH')); - $context->smarty->assign('instantsearch', $instantSearch); + $this->context->smarty->assign('instantsearch', $instantSearch); if ($ajaxSearch) { - $context->controller->addCSS(_PS_CSS_DIR_.'jquery.autocomplete.css'); - $context->controller->addJS(_PS_JS_DIR_.'jquery/jquery.autocomplete.js'); + $this->context->controller->addCSS(_PS_CSS_DIR_.'jquery.autocomplete.css'); + $this->context->controller->addJS(_PS_JS_DIR_.'jquery/jquery.autocomplete.js'); } - $context->controller->addCSS(_THEME_CSS_DIR_.'product_list.css'); - $context->controller->addCSS(($this->_path).'blocksearch.css', 'all'); + $this->context->controller->addCSS(_THEME_CSS_DIR_.'product_list.css'); + $this->context->controller->addCSS(($this->_path).'blocksearch.css', 'all'); return true; } } diff --git a/modules/blockstore/blockstore.php b/modules/blockstore/blockstore.php index 3d52714dd..6bc6ee8d0 100644 --- a/modules/blockstore/blockstore.php +++ b/modules/blockstore/blockstore.php @@ -63,17 +63,15 @@ class BlockStore extends Module function hookRightColumn($params) { - $context = Context::getContext(); - $context->smarty->assign('store_img', Configuration::get('BLOCKSTORE_IMG')); + $this->context->smarty->assign('store_img', Configuration::get('BLOCKSTORE_IMG')); return $this->display(__FILE__, 'blockstore.tpl'); } function hookHeader($params) { - $context = Context::getContext(); - $context->controller->addCSS($this->_path.'/blockstore.css', 'all'); + $this->context->controller->addCSS($this->_path.'/blockstore.css', 'all'); } public function postProcess() diff --git a/modules/blocksupplier/blocksupplier.php b/modules/blocksupplier/blocksupplier.php index 6de10179e..55ff162d8 100644 --- a/modules/blocksupplier/blocksupplier.php +++ b/modules/blocksupplier/blocksupplier.php @@ -60,10 +60,9 @@ class BlockSupplier extends Module function hookLeftColumn($params) { - $context = Context::getContext(); - $context->smarty->assign(array( + $this->context->smarty->assign(array( 'suppliers' => Supplier::getSuppliers(false), - 'link' => $context->link, + 'link' => $this->context->link, 'text_list' => Configuration::get('SUPPLIER_DISPLAY_TEXT'), 'text_list_nb' => Configuration::get('SUPPLIER_DISPLAY_TEXT_NB'), 'form_list' => Configuration::get('SUPPLIER_DISPLAY_FORM'), @@ -133,8 +132,7 @@ class BlockSupplier extends Module function hookHeader($params) { - $context = Context::getContext(); - $context->controller->addCSS(($this->_path).'blocksupplier.css', 'all'); + $this->context->controller->addCSS(($this->_path).'blocksupplier.css', 'all'); } } diff --git a/modules/blocktags/blocktags.php b/modules/blocktags/blocktags.php index ac10734e0..df6360d93 100644 --- a/modules/blocktags/blocktags.php +++ b/modules/blocktags/blocktags.php @@ -100,14 +100,13 @@ class BlockTags extends Module */ function hookLeftColumn($params) { - $context = Context::getContext(); $tags = Tag::getMainTags((int)($params['cookie']->id_lang), (int)(Configuration::get('BLOCKTAGS_NBR'))); if (!sizeof($tags)) return false; foreach ($tags AS &$tag) $tag['class'] = 'tag_level'.($tag['times'] > BLOCKTAGS_MAX_LEVEL ? BLOCKTAGS_MAX_LEVEL : $tag['times']); - $context->smarty->assign('tags', $tags); + $this->context->smarty->assign('tags', $tags); return $this->display(__FILE__, 'blocktags.tpl'); } @@ -119,8 +118,7 @@ class BlockTags extends Module function hookHeader($params) { - $context = Context::getContext(); - $context->controller->addCSS(($this->_path).'blocktags.css', 'all'); + $this->context->controller->addCSS(($this->_path).'blocktags.css', 'all'); } } diff --git a/modules/blockuserinfo/blockuserinfo.php b/modules/blockuserinfo/blockuserinfo.php index adf69acb9..205114b6d 100644 --- a/modules/blockuserinfo/blockuserinfo.php +++ b/modules/blockuserinfo/blockuserinfo.php @@ -59,14 +59,13 @@ class BlockUserInfo extends Module { if (!$this->active) return; - $context = Context::getContext(); - $context->smarty->assign(array( - 'cart' => $context->cart, - 'cart_qties' => $context->cart->nbProducts(), - 'logged' => $context->cookie->isLogged(), - 'customerName' => ($context->cookie->logged ? $context->customer->firstname.' '.$context->customer->lastname : false), - 'firstName' => ($context->cookie->logged ? $context->customer->firstname : false), - 'lastName' => ($context->cookie->logged ? $context->customer->lastname : false), + $this->context->smarty->assign(array( + 'cart' => $this->context->cart, + 'cart_qties' => $this->context->cart->nbProducts(), + 'logged' => $this->context->cookie->isLogged(), + 'customerName' => ($this->context->cookie->logged ? $this->context->customer->firstname.' '.$this->context->customer->lastname : false), + 'firstName' => ($this->context->cookie->logged ? $this->context->customer->firstname : false), + 'lastName' => ($this->context->cookie->logged ? $this->context->customer->lastname : false), 'order_process' => Configuration::get('PS_ORDER_PROCESS_TYPE') ? 'order-opc' : 'order' )); return $this->display(__FILE__, 'blockuserinfo.tpl'); @@ -74,8 +73,7 @@ class BlockUserInfo extends Module public function hookHeader($params) { - $context = Context::getContext(); - $context->controller->addCSS(($this->_path).'blockuserinfo.css', 'all'); + $this->context->controller->addCSS(($this->_path).'blockuserinfo.css', 'all'); } } diff --git a/modules/blockviewed/blockviewed.php b/modules/blockviewed/blockviewed.php index b217b060f..3dca50196 100644 --- a/modules/blockviewed/blockviewed.php +++ b/modules/blockviewed/blockviewed.php @@ -93,7 +93,6 @@ class BlockViewed extends Module function hookRightColumn($params) { - $context = Context::getContext(); $id_product = (int)(Tools::getValue('id_product')); $productsViewed = (isset($params['cookie']->viewed) AND !empty($params['cookie']->viewed)) ? array_slice(explode(',', $params['cookie']->viewed), 0, Configuration::get('PRODUCTS_VIEWED_NBR')) : array(); @@ -153,7 +152,7 @@ class BlockViewed extends Module LEFT JOIN `'._DB_PREFIX_.'category_group` cg ON (cg.`id_category` = cp.`id_category`) LEFT JOIN `'._DB_PREFIX_.'customer_group` cug ON (cug.`id_group` = cg.`id_group`) WHERE p.`id_product` = '.(int)($id_product).' - '.($context->customer->id ? 'AND cug.`id_customer` = '.(int)$context->customer->id : + '.($this->context->customer->id ? 'AND cug.`id_customer` = '.(int)$this->context->customer->id : 'AND cg.`id_group` = 1') ); if ($result['total']) @@ -167,7 +166,7 @@ class BlockViewed extends Module if (!sizeof($productsViewedObj)) return ; - $context->smarty->assign(array( + $this->context->smarty->assign(array( 'productsViewedObj' => $productsViewedObj, 'mediumSize' => Image::getSize('medium'))); @@ -185,7 +184,6 @@ class BlockViewed extends Module function hookHeader($params) { - $context = Context::getContext(); - $context->controller->addCSS(($this->_path).'blockviewed.css', 'all'); + $this->context->controller->addCSS(($this->_path).'blockviewed.css', 'all'); } } diff --git a/modules/blockwishlist/WishList.php b/modules/blockwishlist/WishList.php index 393391ca7..436d529af 100644 --- a/modules/blockwishlist/WishList.php +++ b/modules/blockwishlist/WishList.php @@ -68,12 +68,10 @@ class WishList extends ObjectModel public function delete() { - $context = Context::getContext(); - Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'wishlist_email` WHERE `id_wishlist` = '.(int)($this->id)); Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'wishlist_product` WHERE `id_wishlist` = '.(int)($this->id)); - if (isset($context->cookie->id_wishlist)) - unset($context->cookie->id_wishlist); + if (isset($this->context->cookie->id_wishlist)) + unset($this->context->cookie->id_wishlist); return (parent::delete()); } @@ -103,7 +101,6 @@ class WishList extends ObjectModel public static function isExistsByNameForUser($name) { $context = Context::getContext(); - return Db::getInstance()->getValue(' SELECT COUNT(*) AS total FROM `'._DB_PREFIX_.'wishlist` diff --git a/modules/blockwishlist/blockwishlist.php b/modules/blockwishlist/blockwishlist.php index 4f4cb793a..a4c6b3cff 100644 --- a/modules/blockwishlist/blockwishlist.php +++ b/modules/blockwishlist/blockwishlist.php @@ -169,15 +169,13 @@ class BlockWishList extends Module public function hookHeader($params) { - $context = Context::getContext(); - $context->controller->addCSS(($this->_path).'blockwishlist.css', 'all'); + $this->context->controller->addCSS(($this->_path).'blockwishlist.css', 'all'); return $this->display(__FILE__, 'blockwishlist-header.tpl'); } public function hookRightColumn($params) { global $errors; - $context = Context::getContext(); require_once(dirname(__FILE__).'/WishList.php'); if ($params['cookie']->isLogged()) @@ -196,7 +194,7 @@ class BlockWishList extends Module } else $id_wishlist = $params['cookie']->id_wishlist; - $context->smarty->assign(array( + $this->context->smarty->assign(array( 'id_wishlist' => $id_wishlist, 'isLogged' => true, 'wishlist_products' => ($id_wishlist == false ? false : WishList::getProductByIdCustomer($id_wishlist, $params['cookie']->id_customer, $params['cookie']->id_lang, null, true)), @@ -204,7 +202,7 @@ class BlockWishList extends Module 'ptoken' => Tools::getToken(false))); } else - $context->smarty->assign(array('wishlist_products' => false, 'wishlists' => false)); + $this->context->smarty->assign(array('wishlist_products' => false, 'wishlists' => false)); return ($this->display(__FILE__, 'blockwishlist.tpl')); } @@ -215,8 +213,7 @@ class BlockWishList extends Module public function hookProductActions($params) { - $context = Context::getContext(); - $context->smarty->assign('id_product', (int)(Tools::getValue('id_product'))); + $this->context->smarty->assign('id_product', (int)(Tools::getValue('id_product'))); return ($this->display(__FILE__, 'blockwishlist-extra.tpl')); } @@ -232,19 +229,18 @@ class BlockWishList extends Module private function _displayProducts($id_wishlist) { - $context = Context::getContext(); include_once(dirname(__FILE__).'/WishList.php'); $wishlist = new WishList($id_wishlist); - $products = WishList::getProductByIdCustomer($id_wishlist, $wishlist->id_customer, $context->language->id); + $products = WishList::getProductByIdCustomer($id_wishlist, $wishlist->id_customer, $this->context->language->id); for ($i = 0; $i < sizeof($products); ++$i) { - $obj = new Product((int)($products[$i]['id_product']), false, $context->language->id); + $obj = new Product((int)($products[$i]['id_product']), false, $this->context->language->id); if (!Validate::isLoadedObject($obj)) continue; else { - $images = $obj->getImages($context->language->id); + $images = $obj->getImages($this->context->language->id); foreach ($images AS $k => $image) { if ($image['cover']) @@ -254,7 +250,7 @@ class BlockWishList extends Module } } if (!isset($products[$i]['cover'])) - $products[$i]['cover'] = $context->language->iso_code.'-default'; + $products[$i]['cover'] = $this->context->language->iso_code.'-default'; } } $this->_html .= ' diff --git a/modules/carriercompare/carriercompare.php b/modules/carriercompare/carriercompare.php index 26112ac44..3d6156e59 100755 --- a/modules/carriercompare/carriercompare.php +++ b/modules/carriercompare/carriercompare.php @@ -55,9 +55,8 @@ class CarrierCompare extends Module { if (!$this->isModuleAvailable()) return; - $context = Context::getContext(); - $context->controller->addCSS(($this->_path).'style.css', 'all'); - $context->controller->addJS(($this->_path).'carriercompare.js'); + $this->context->controller->addCSS(($this->_path).'style.css', 'all'); + $this->context->controller->addJS(($this->_path).'carriercompare.js'); } /* @@ -68,7 +67,7 @@ class CarrierCompare extends Module if (!$this->isModuleAvailable()) return; - $context->smarty->assign(array( + $this->context->smarty->assign(array( 'countries' => Country::getCountries($this->context->language->id), 'id_carrier' => ($params['cart']->id_carrier ? $params['cart']->id_carrier : Configuration::get('PS_CARRIER_DEFAULT')), 'id_country' => (isset($this->context->customer->geoloc_id_country) ? $this->context->customer->geoloc_id_country : Configuration::get('PS_COUNTRY_DEFAULT')), @@ -112,7 +111,6 @@ class CarrierCompare extends Module public function saveSelection($id_country, $id_state, $zipcode, $id_carrier) { - $context = Context::getContext(); $errors = array(); if (!Validate::isInt($id_state)) @@ -138,11 +136,11 @@ class CarrierCompare extends Module if (sizeof($errors)) return $errors; - $context->cookie->id_country = $id_country; - $context->cookie->id_state = $id_state; - $context->cookie->postcode = $zipcode; - $context->cart->id_carrier = $id_carrier; - if (!$context->cart->update()) + $this->context->cookie->id_country = $id_country; + $this->context->cookie->id_state = $id_state; + $this->context->cookie->postcode = $zipcode; + $this->context->cart->id_carrier = $id_carrier; + if (!$this->context->cart->update()) return array($this->l('Can\'t update the cart')); return array(); } diff --git a/modules/cashondelivery/cashondelivery.php b/modules/cashondelivery/cashondelivery.php index d1fb00b46..60af84b3d 100644 --- a/modules/cashondelivery/cashondelivery.php +++ b/modules/cashondelivery/cashondelivery.php @@ -58,7 +58,6 @@ class CashOnDelivery extends PaymentModule if (!$this->active) return ; - $context = Context::getContext(); // Check if cart has product download foreach ($params['cart']->getProducts() AS $product) { @@ -67,7 +66,7 @@ class CashOnDelivery extends PaymentModule return false; } - $context->smarty->assign(array( + $this->context->smarty->assign(array( 'this_path' => $this->_path, 'this_path_ssl' => Tools::getShopDomainSsl(true, true).__PS_BASE_URI__.'modules/'.$this->name.'/' )); diff --git a/modules/cashticket/PrepaidServices.php b/modules/cashticket/PrepaidServices.php index b2503f0fc..479cebbb1 100644 --- a/modules/cashticket/PrepaidServices.php +++ b/modules/cashticket/PrepaidServices.php @@ -166,10 +166,9 @@ abstract class PrepaidServices extends PaymentModule public function createDisposition($cart) { - $context = Context::getContext(); $currency = new Currency((int)($cart->id_currency)); - $language = $this->_getSupportedLanguageIsoById($context->language->id); + $language = $this->_getSupportedLanguageIsoById($this->context->language->id); $mid = Configuration::get($this->prefix.'MERCHANT_ID_'.$currency->iso_code); $mtid = $cart->id.'-'.time(); $amount = number_format((float)($cart->getOrderTotal(true, Cart::BOTH)), 2, '.',''); @@ -353,14 +352,13 @@ abstract class PrepaidServices extends PaymentModule private function _displayInfos() { - $context = Context::getContext(); - + return '
'.$this->displayName.'
'.$this->getL('introduction').'

- '.$this->getL('register').' + '.$this->getL('register').'

'; } @@ -534,7 +532,6 @@ abstract class PrepaidServices extends PaymentModule public function hookPayment($params) { - $context = Context::getContext(); // check currency $currency = new Currency((int)($params['cart']->id_currency)); @@ -555,7 +552,7 @@ abstract class PrepaidServices extends PaymentModule if ($amount > $this->max_amount) return false; - $context->smarty->assign(array('pic_url' => _MODULE_DIR_.'/'.$this->name.'/img/payment-logo.png', + $this->context->smarty->assign(array('pic_url' => _MODULE_DIR_.'/'.$this->name.'/img/payment-logo.png', 'payment_name' => $this->displayName, 'module_name' => $this->name)); @@ -565,19 +562,17 @@ abstract class PrepaidServices extends PaymentModule public function hookPaymentReturn($params) { - $context = Context::getContext(); if ($params['objOrder']->module != $this->name) return; - $context->smarty->assign('payment_name', $this->displayName); + $this->context->smarty->assign('payment_name', $this->displayName); return $this->display(__FILE__, $this->name.'-confirmation.tpl'); } public function hookAdminOrder($params) { - $context = Context::getContext(); $error = 0; $order = new Order((int)($params['id_order'])); @@ -593,12 +588,12 @@ abstract class PrepaidServices extends PaymentModule // check disposition state $res = PrepaidServicesAPI::getSerialNumbers($this->getAPIConfiguration($disposition['currency']), Configuration::get($this->prefix.'MERCHANT_ID_'.$disposition['currency']), $disposition['mtid'], $disposition['currency']); - $currency = $context->currency; + $currency = $this->context->currency; // if the disposition is not "active" if ($res[5] != PrepaidServicesAPI::DISPOSITION_DISPOSED && $res[5] != PrepaidServicesAPI::DISPOSITION_DEBITED) { - $context->smarty->assign(array('disposition_state' => $res[5], 'payment_name' => $order->payment)); + $this->context->smarty->assign(array('disposition_state' => $res[5], 'payment_name' => $order->payment)); return $this->display($this->module_dir.'/'.$this->name, 'disposition-error.tpl'); } @@ -629,7 +624,7 @@ abstract class PrepaidServices extends PaymentModule if (Tools::getIsset('pp_error')) $error_msg = $this->_getErrorMsgFromErrorCode(Tools::getValue('pp_error')); - $context->smarty->assign(array('action' => Tools::safeOutput($_SERVER['PHP_SELF']).'?'.$_SERVER['QUERY_STRING'], + $this->context->smarty->assign(array('action' => Tools::safeOutput($_SERVER['PHP_SELF']).'?'.$_SERVER['QUERY_STRING'], 'payment_name' => $order->payment, 'error' => $error_msg, 'currency' => $currency->getSign('right'), diff --git a/modules/cheque/cheque.php b/modules/cheque/cheque.php index a096fa701..f702ac5d5 100644 --- a/modules/cheque/cheque.php +++ b/modules/cheque/cheque.php @@ -155,14 +155,13 @@ class Cheque extends PaymentModule if (!$this->_checkCurrency($cart)) Tools::redirect('index.php?controller=order'); - $context = Context::getContext(); - $context->smarty->assign(array( + $this->context->smarty->assign(array( 'nbProducts' => $cart->nbProducts(), 'cust_currency' => $cart->id_currency, 'currencies' => $this->getCurrency((int)$cart->id_currency), 'total' => $cart->getOrderTotal(true, Cart::BOTH), - 'isoCode' => $context->language->iso_code, + 'isoCode' => $this->context->language->iso_code, 'chequeName' => $this->chequeName, 'chequeAddress' => Tools::nl2br($this->address), 'this_path' => $this->_path, @@ -179,8 +178,7 @@ class Cheque extends PaymentModule if (!$this->_checkCurrency($params['cart'])) return ; - $context = Context::getContext(); - $context->smarty->assign(array( + $this->context->smarty->assign(array( 'this_path' => $this->_path, 'this_path_ssl' => Tools::getShopDomainSsl(true, true).__PS_BASE_URI__.'modules/'.$this->name.'/' )); @@ -192,10 +190,9 @@ class Cheque extends PaymentModule if (!$this->active) return ; - $context = Context::getContext(); $state = $params['objOrder']->getCurrentState(); if ($state == Configuration::get('PS_OS_CHEQUE') OR $state == Configuration::get('PS_OS_OUTOFSTOCK')) - $context->smarty->assign(array( + $this->context->smarty->assign(array( 'total_to_pay' => Tools::displayPrice($params['total_to_pay'], $params['currencyObj'], false), 'chequeName' => $this->chequeName, 'chequeAddress' => Tools::nl2br($this->address), @@ -203,7 +200,7 @@ class Cheque extends PaymentModule 'id_order' => $params['objOrder']->id )); else - $context->smarty->assign('status', 'failed'); + $this->context->smarty->assign('status', 'failed'); return $this->display(__FILE__, 'payment_return.tpl'); } diff --git a/modules/criteo/criteo.php b/modules/criteo/criteo.php index eb9ed3b53..5bb2a5419 100755 --- a/modules/criteo/criteo.php +++ b/modules/criteo/criteo.php @@ -115,11 +115,8 @@ class Criteo extends Module } } - public static function buildCSV(Context $context = null) + public static function buildCSV() { - if (!$context) - $context = Context::getContext(); - global $country_infos; $country_infos = array('id_group' => 0, 'id_tax' => 1); @@ -165,7 +162,7 @@ class Criteo extends Module $line[] = $product->manufacturer_name.' - '.$product->name[intval($conf['PS_LANG_DEFAULT'])]; $line[] = Tools::getProtocol().$_SERVER['HTTP_HOST']._THEME_PROD_DIR_.$imageObj->getExistingImgPath().'-small.jpg'; $line[] = Tools::getProtocol().$_SERVER['HTTP_HOST']._THEME_PROD_DIR_.$imageObj->getExistingImgPath().'-thickbox.jpg'; - $line[] = $context->link->getProductLink(intval($product->id), $product->link_rewrite[intval($conf['PS_LANG_DEFAULT'])], $product->ean13).'&utm_source=criteo&aff=criteo'; + $line[] = $this->context->link->getProductLink(intval($product->id), $product->link_rewrite[intval($conf['PS_LANG_DEFAULT'])], $product->ean13).'&utm_source=criteo&aff=criteo'; $line[] = str_replace(array("\n", "\r", "\t", '|'), '', strip_tags(html_entity_decode($product->description_short[intval($conf['PS_LANG_DEFAULT'])], ENT_COMPAT, 'UTF-8'))); $price = $product->getPrice(true, intval(Product::getDefaultAttribute($product->id))); @@ -184,12 +181,11 @@ class Criteo extends Module echo $html; } - public static function buildXML(Context $context = null) + public static function buildXML() { global $country_infos; - if (!$context) - $context = Context::getContext(); - + $context = Context::getContext(); + $country_infos = array('id_group' => 0, 'id_tax' => 1); $html = ''."\n"; /* First line, columns */ diff --git a/modules/crossselling/crossselling.php b/modules/crossselling/crossselling.php index 58f0daaa4..fc887aadf 100755 --- a/modules/crossselling/crossselling.php +++ b/modules/crossselling/crossselling.php @@ -96,8 +96,7 @@ class CrossSelling extends Module public function hookHeader() { - $context = Context::getContext(); - $context->controller->addCSS(($this->_path).'crossselling.css', 'all'); + $this->context->controller->addCSS(($this->_path).'crossselling.css', 'all'); } /** @@ -105,7 +104,6 @@ class CrossSelling extends Module */ public function hookProductFooter($params) { - $context = Context::getContext(); $orders = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS(' SELECT o.id_order @@ -127,7 +125,7 @@ class CrossSelling extends Module LEFT JOIN '._DB_PREFIX_.'product_lang pl ON (pl.id_product = od.product_id) LEFT JOIN '._DB_PREFIX_.'category_lang cl ON (cl.id_category = p.id_category_default) LEFT JOIN '._DB_PREFIX_.'image i ON (i.id_product = od.product_id) - WHERE od.id_order IN ('.$list.') AND pl.id_lang = '.(int)$context->language->id.' AND cl.id_lang = '.(int)$context->language->id.' + WHERE od.id_order IN ('.$list.') AND pl.id_lang = '.(int)$this->context->language->id.' AND cl.id_lang = '.(int)$this->context->language->id.' AND od.product_id != '.(int)$params['product']->id.' AND i.cover = 1 AND p.active = 1 ORDER BY RAND() LIMIT 10'); @@ -135,15 +133,15 @@ class CrossSelling extends Module $taxCalc = Product::getTaxCalculationMethod(); foreach ($orderProducts AS &$orderProduct) { - $orderProduct['image'] = $context->link->getImageLink($orderProduct['link_rewrite'], (int)$orderProduct['product_id'].'-'.(int)$orderProduct['id_image'], 'medium'); - $orderProduct['link'] = $context->link->getProductLink((int)$orderProduct['product_id'], $orderProduct['link_rewrite'], $orderProduct['category'], $orderProduct['ean13']); + $orderProduct['image'] = $this->context->link->getImageLink($orderProduct['link_rewrite'], (int)$orderProduct['product_id'].'-'.(int)$orderProduct['id_image'], 'medium'); + $orderProduct['link'] = $this->context->link->getProductLink((int)$orderProduct['product_id'], $orderProduct['link_rewrite'], $orderProduct['category'], $orderProduct['ean13']); if (Configuration::get('CROSSSELLING_DISPLAY_PRICE') AND ($taxCalc == 0 OR $taxCalc == 2)) $orderProduct['displayed_price'] = Product::getPriceStatic((int)$orderProduct['product_id'], true, NULL); elseif (Configuration::get('CROSSSELLING_DISPLAY_PRICE') AND $taxCalc == 1) $orderProduct['displayed_price'] = Product::getPriceStatic((int)$orderProduct['product_id'], false, NULL); } - $context->smarty->assign(array('orderProducts' => $orderProducts, 'middlePosition_crossselling' => round(sizeof($orderProducts) / 2, 0), + $this->context->smarty->assign(array('orderProducts' => $orderProducts, 'middlePosition_crossselling' => round(sizeof($orderProducts) / 2, 0), 'crossDisplayPrice' => Configuration::get('CROSSSELLING_DISPLAY_PRICE'))); } return $this->display(__FILE__, 'crossselling.tpl'); diff --git a/modules/dateofdelivery/dateofdelivery.php b/modules/dateofdelivery/dateofdelivery.php index 2cbf030ca..b00a6121d 100644 --- a/modules/dateofdelivery/dateofdelivery.php +++ b/modules/dateofdelivery/dateofdelivery.php @@ -98,7 +98,6 @@ class DateOfDelivery extends Module public function hookBeforeCarrier($params) { - $context = Context::getContext(); if (!sizeof($params['carriers'])) return false; @@ -111,7 +110,7 @@ class DateOfDelivery extends Module foreach ($params['carriers'] as $carrier) $datesDelivery[(int)($carrier['id_carrier'])] = $this->_getDatesOfDelivery((int)($carrier['id_carrier']), $oos); - $context->smarty->assign(array( + $this->context->smarty->assign(array( 'datesDelivery' => $datesDelivery, 'id_carrier' => ($params['cart']->id_carrier ? (int)($params['cart']->id_carrier) : (int)(Configuration::get('PS_CARRIER_DEFAULT'))) )); @@ -121,7 +120,6 @@ class DateOfDelivery extends Module public function hookOrderDetailDisplayed($params) { - $context = Context::getContext(); $oos = false; // For out of stock management foreach ($params['order']->getProducts() as $product) @@ -134,7 +132,7 @@ class DateOfDelivery extends Module if (!is_array($datesDelivery) OR !sizeof($datesDelivery)) return ; - $context->smarty->assign('datesDelivery', $datesDelivery); + $this->context->smarty->assign('datesDelivery', $datesDelivery); return $this->display(__FILE__, 'orderDetail.tpl'); } @@ -312,9 +310,8 @@ class DateOfDelivery extends Module private function _setCarrierRuleForm() { - $context = Context::getContext(); - $carriers = Carrier::getCarriers($context->language->id, true , false,false, NULL, ALL_CARRIERS); + $carriers = Carrier::getCarriers($this->context->language->id, true , false,false, NULL, ALL_CARRIERS); if (Tools::isSubmit('editCarrierRule') AND $this->_isCarrierRuleExists(Tools::getValue('id_carrier_rule'))) $carrier_rule = $this->_getCarrierRule(Tools::getValue('id_carrier_rule')); diff --git a/modules/dejala/dejala.php b/modules/dejala/dejala.php index 585e5b568..97f3f5477 100644 --- a/modules/dejala/dejala.php +++ b/modules/dejala/dejala.php @@ -33,7 +33,6 @@ class Dejala extends CarrierModule public function __construct() { - $context = Context::getContext(); //TODO Iso code of countries where the module can be used, if none module available for all countries $this->limited_countries = array('fr'); @@ -41,10 +40,10 @@ class Dejala extends CarrierModule $this->tab = 'shipping_logistics'; $this->version = 1.4; $this->internal_version = '1.3'; - $this->id_lang = $context->language->id; - $this->wday_labels = array($this->l('Sunday'), $this->l('Monday'), $this->l('Tuesday'), $this->l('Wednesday'), $this->l('Thursday'), $this->l('Friday'), $this->l('Saturday')); - parent::__construct(); + + $this->id_lang = $this->context->language->id; + $this->wday_labels = array($this->l('Sunday'), $this->l('Monday'), $this->l('Tuesday'), $this->l('Wednesday'), $this->l('Thursday'), $this->l('Friday'), $this->l('Saturday')); // The parent construct is required for translations $this->page = basename(__FILE__, '.php'); @@ -122,12 +121,11 @@ class Dejala extends CarrierModule public function uninstall() { - $context = Context::getContext(); // If Dejala is default carrier, try to set another one as default $djlCarrier = DejalaCarrierUtils::getCarrierByName($this->name) ; if (Configuration::get('PS_CARRIER_DEFAULT') == (int)($djlCarrier->id)) { - $carriers = Carrier::getCarriers($context->language->id, true, false, false, NULL, PS_CARRIERS_AND_CARRIER_MODULES_NEED_RANGE); + $carriers = Carrier::getCarriers($this->context->language->id, true, false, false, NULL, PS_CARRIERS_AND_CARRIER_MODULES_NEED_RANGE); foreach($carriers as $carrier) { if ($carrier['active'] AND !$carrier['deleted'] AND ($carrier['external_module_name'] != $this->name)) @@ -231,7 +229,6 @@ class Dejala extends CarrierModule **/ public function _postProcess() { - $context = Context::getContext(); $errors = array(); $method = Tools::getValue('method'); @@ -392,9 +389,8 @@ class Dejala extends CarrierModule public function getContent() { - $context = Context::getContext(); - //$context->smarty->assign('country', $this->dejalaConfig->country); + //$this->context->smarty->assign('country', $this->dejalaConfig->country); $output = $this->display(__FILE__, 'dejala_header.tpl'); if (!empty($_POST)) { @@ -420,18 +416,17 @@ class Dejala extends CarrierModule public function displayForm() { - $context = Context::getContext(); $errors = array(); $outputMain = ''; - $context->smarty->assign("djl_mode", $this->dejalaConfig->mode); - $context->smarty->assign("disabled", ''); + $this->context->smarty->assign("djl_mode", $this->dejalaConfig->mode); + $this->context->smarty->assign("disabled", ''); if ($this->dejalaConfig->mode == 'PROD') - $context->smarty->assign("disabled", 'disabled="disabled"'); + $this->context->smarty->assign("disabled", 'disabled="disabled"'); if (true !== extension_loaded('curl')) { $errors[] = $this->l('This module requires php extension cURL to function properly. Please install the php extension "cURL" first.'); - $context->smarty->assign("disabled", 'disabled="disabled"'); + $this->context->smarty->assign("disabled", 'disabled="disabled"'); } $registered = TRUE; @@ -453,7 +448,7 @@ class Dejala extends CarrierModule } } - $context->smarty->assign("registered", $registered?"1":"0"); + $this->context->smarty->assign("registered", $registered?"1":"0"); if (!isset($_GET['cat']) || ($_GET['cat']==='home') || ($_GET['cat']==='')) @@ -461,19 +456,19 @@ class Dejala extends CarrierModule else $currentTab=$_GET['cat']; - $context->smarty->assign("currentTab", $currentTab); - $context->smarty->assign("moduleConfigURL", 'index.php?tab=AdminModules&configure=dejala&token='.$_GET['token']); - $context->smarty->assign("formAction", $_SERVER['REQUEST_URI']); + $this->context->smarty->assign("currentTab", $currentTab); + $this->context->smarty->assign("moduleConfigURL", 'index.php?tab=AdminModules&configure=dejala&token='.$_GET['token']); + $this->context->smarty->assign("formAction", $_SERVER['REQUEST_URI']); $outputMenu = $this->display(__FILE__, 'dejala_menu.tpl'); if ($currentTab==='home') { - $context->smarty->assign("login", html_entity_decode(Configuration::get('PS_SHOP_EMAIL'), ENT_COMPAT, 'UTF-8')); + $this->context->smarty->assign("login", html_entity_decode(Configuration::get('PS_SHOP_EMAIL'), ENT_COMPAT, 'UTF-8')); if ($registered) { - $context->smarty->assign("visibility_status", $this->dejalaConfig->visibility_status); - $context->smarty->assign("visible_users_list", $this->dejalaConfig->visible_users_list); - $context->smarty->assign("store_login", html_entity_decode($this->dejalaConfig->login, ENT_COMPAT, 'UTF-8')); + $this->context->smarty->assign("visibility_status", $this->dejalaConfig->visibility_status); + $this->context->smarty->assign("visible_users_list", $this->dejalaConfig->visible_users_list); + $this->context->smarty->assign("store_login", html_entity_decode($this->dejalaConfig->login, ENT_COMPAT, 'UTF-8')); $smartifyErrors = $this->smartyfyStoreAttributes(); if (isset($smartifyErrors) && count($smartifyErrors)) $errors = $smartifyErrors; @@ -483,7 +478,7 @@ class Dejala extends CarrierModule $shopName = Configuration::get('PS_SHOP_NAME'); if (strlen($shopName) >= 15) $shopName = substr($shopName, 0, 15); - $context->smarty->assign("store_name", html_entity_decode($shopName, ENT_COMPAT, 'UTF-8')); + $this->context->smarty->assign("store_name", html_entity_decode($shopName, ENT_COMPAT, 'UTF-8')); } $outputMain = $this->display(__FILE__, 'dejala_home.tpl'); } @@ -496,7 +491,7 @@ class Dejala extends CarrierModule { foreach ($contacts as $contactName=>$contactData) { foreach ($contactData as $key=>$value) { - $context->smarty->assign($contactName.'_'.$key, $value); + $this->context->smarty->assign($contactName.'_'.$key, $value); } } } @@ -510,7 +505,7 @@ class Dejala extends CarrierModule if ('200' == $responseArray['status']) { foreach ($location as $key=>$value) - $context->smarty->assign($key, $value); + $this->context->smarty->assign($key, $value); $outputMain = $this->display(__FILE__, 'dejala_location.tpl'); } @@ -523,7 +518,7 @@ class Dejala extends CarrierModule if ('200' == $responseArray['status']) { foreach ($processes as $key=>$value) - $context->smarty->assign($key, $value); + $this->context->smarty->assign($key, $value); $outputMain = $this->display(__FILE__, 'dejala_processes.tpl'); } @@ -544,7 +539,7 @@ class Dejala extends CarrierModule $product['public_price'] = number_format(round($product['price'] + $product['margin'], 2), 2, '.', ''); $product['public_price_notax'] = number_format(round($product['public_price']/$vat_factor, 2), 2, '.', ''); } - $context->smarty->assign('products', $products); + $this->context->smarty->assign('products', $products); $outputMain = $this->display(__FILE__, 'dejala_products.tpl'); } } @@ -582,10 +577,10 @@ class Dejala extends CarrierModule $delivery['delivery_time'] = date('H\hi', $delivery['delivery_utc']); } } - $context->smarty->assign('formAction', __PS_BASE_URI__ . 'modules/' . $this->name . '/deliveries_csv.php'); - $context->smarty->assign('defaultDateFrom', date('01/m/Y')); - $context->smarty->assign('defaultDateTo', date('d/m/Y')); - $context->smarty->assign('deliveries', $deliveries); + $this->context->smarty->assign('formAction', __PS_BASE_URI__ . 'modules/' . $this->name . '/deliveries_csv.php'); + $this->context->smarty->assign('defaultDateFrom', date('01/m/Y')); + $this->context->smarty->assign('defaultDateTo', date('d/m/Y')); + $this->context->smarty->assign('deliveries', $deliveries); $outputMain = $this->display(__FILE__, 'dejala_deliveries.tpl'); } } @@ -608,9 +603,9 @@ class Dejala extends CarrierModule $m_status['checked'] = '0'; $orderStatuses[] = $m_status; } - $context->smarty->assign('statuses', $orderStatuses); + $this->context->smarty->assign('statuses', $orderStatuses); - $context->smarty->assign('trigerringStatuses', $this->dejalaConfig->trigerringStatuses); + $this->context->smarty->assign('trigerringStatuses', $this->dejalaConfig->trigerringStatuses); $outputMain = $this->display(__FILE__, 'dejala_technical_options.tpl'); } @@ -630,7 +625,6 @@ class Dejala extends CarrierModule // put in smarty context store attributes function smartyfyStoreAttributes() { - $context = Context::getContext(); $errors = array(); $djlUtil = new DejalaUtils(); $storeAttrs = array(); @@ -639,20 +633,20 @@ class Dejala extends CarrierModule $errors[] = $this->l('An error occurred while getting store, please try again later or contact Dejala.com'); else { - $context->smarty->assign("account_balance", $storeAttrs['account_balance']); - $context->smarty->assign("store_name", $storeAttrs['name']); + $this->context->smarty->assign("account_balance", $storeAttrs['account_balance']); + $this->context->smarty->assign("store_name", $storeAttrs['name']); // Check if account exists in production $responsePing = $djlUtil->ping($this->dejalaConfig, 'PROD'); if ('200' == $responsePing['status']) - $context->smarty->assign('isLiveReady', '1'); + $this->context->smarty->assign('isLiveReady', '1'); else { - $context->smarty->assign('isLiveReady', '0'); + $this->context->smarty->assign('isLiveReady', '0'); if (isset($storeAttrs['attributes']) && isset($storeAttrs['attributes']['request_live']) && ($storeAttrs['attributes']['request_live']=='true')) - $context->smarty->assign('isLiveRequested', '1'); + $this->context->smarty->assign('isLiveRequested', '1'); else - $context->smarty->assign('isLiveRequested', '0'); + $this->context->smarty->assign('isLiveRequested', '0'); } } return ($errors); @@ -665,7 +659,6 @@ class Dejala extends CarrierModule } function displayDeliveryOptions(){ - $context = Context::getContext(); /* Au moment du choix du créneau Pour déterminer le créneau de départ proposé : @@ -682,26 +675,26 @@ class Dejala extends CarrierModule $response = $djlUtil->getStoreAttributes($this->dejalaConfig, $store); if ($response['status'] == 200) { - $context->smarty->assign('nb_days', $store['attributes']['nb_days_displayed']); - $context->smarty->assign('delivery_delay', $store['attributes']['delivery_delay']); + $this->context->smarty->assign('nb_days', $store['attributes']['nb_days_displayed']); + $this->context->smarty->assign('delivery_delay', $store['attributes']['delivery_delay']); if (isset($store['attributes']['delivery_partial'])) - $context->smarty->assign('delivery_partial', $store['attributes']['delivery_partial']); + $this->context->smarty->assign('delivery_partial', $store['attributes']['delivery_partial']); } $wday_selected = array(1, 1, 1, 1, 1, 1, 1); - $context->smarty->assign('timetable_css', _MODULE_DIR_.$this->name.'/timetable.css'); - $context->smarty->assign("timetable_js", _MODULE_DIR_.$this->name.'/timetable.js'); - $context->smarty->assign("weekdayLabels", $this->wday_labels); - $context->smarty->assign("weekdaySelected", $wday_selected); + $this->context->smarty->assign('timetable_css', _MODULE_DIR_.$this->name.'/timetable.css'); + $this->context->smarty->assign("timetable_js", _MODULE_DIR_.$this->name.'/timetable.js'); + $this->context->smarty->assign("weekdayLabels", $this->wday_labels); + $this->context->smarty->assign("weekdaySelected", $wday_selected); $calendar = array(); $response = $djlUtil->getStoreCalendar($this->dejalaConfig, $calendar); if ($response['status'] == 200) { - $context->smarty->assign("calendar", $calendar); - $context->smarty->assign("timetableTpl", dirname(__FILE__)."/dejala_picking_timetable.tpl"); + $this->context->smarty->assign("calendar", $calendar); + $this->context->smarty->assign("timetableTpl", dirname(__FILE__)."/dejala_picking_timetable.tpl"); } $output = $output . $this->display(__FILE__, 'dejala_delivery_options.tpl'); @@ -733,7 +726,6 @@ class Dejala extends CarrierModule */ public function hookExtraCarrier($params) { - $context = Context::getContext(); $cart = $params['cart']; @@ -743,9 +735,9 @@ class Dejala extends CarrierModule if ($this->dejalaConfig->visibility_status == "invisible") return ; - if (($this->dejalaConfig->visibility_status == "visible_limited") && ((int)$context->customer->id > 0)) + if (($this->dejalaConfig->visibility_status == "visible_limited") && ((int)$this->context->customer->id > 0)) { - $customer = $context->customer; + $customer = $this->context->customer; if (!in_array($customer->email, preg_split("/[\s,]+/", $this->dejalaConfig->visible_users_list))) return ; } @@ -771,7 +763,7 @@ class Dejala extends CarrierModule if (isset($cart->id_address_delivery) AND $cart->id_address_delivery) $id_zone = (int)Address::getZoneById((int)($cart->id_address_delivery)); else - $id_zone = (int)$context->country->id_zone; + $id_zone = (int)$this->context->country->id_zone; $djlCarrier = DejalaCarrierUtils::getCarrierByName($this->name) ; @@ -871,8 +863,8 @@ class Dejala extends CarrierModule $this->mylog("date$=" . $this->logValue($dates,1)); - $context->smarty->assign('nb_days', $nbDeliveryDates); - $context->smarty->assign('dates', $dates); + $this->context->smarty->assign('nb_days', $nbDeliveryDates); + $this->context->smarty->assign('dates', $dates); for ($i=0; $i < 24; $i++) { $endHour = (($i+$electedProduct['timelimit'])%24); @@ -880,10 +872,10 @@ class Dejala extends CarrierModule $endHour = 24; $hourLabels[] = $i . 'h-' . $endHour . 'h'; } - $context->smarty->assign('hourLabels', $hourLabels); + $this->context->smarty->assign('hourLabels', $hourLabels); - $context->smarty->assign('timetable_css', _MODULE_DIR_.$this->name.'/timetable.css'); - $context->smarty->assign("timetable_js", _MODULE_DIR_.$this->name.'/timetable.js'); + $this->context->smarty->assign('timetable_css', _MODULE_DIR_.$this->name.'/timetable.css'); + $this->context->smarty->assign("timetable_js", _MODULE_DIR_.$this->name.'/timetable.js'); $this->mylog("electedCarrier->id=" . $this->logValue($djlCarrier->id)); $mCarrier = $djlCarrier; @@ -896,9 +888,9 @@ class Dejala extends CarrierModule $resultsArray[] = $row; - $context->smarty->assign('carriers', $resultsArray); - $context->smarty->assign('my_carrier_selected', (isset($cart->id_carrier) && $cart->id_carrier == $djlCarrier->id)) ; - $context->smarty->assign('product', $electedProduct); + $this->context->smarty->assign('carriers', $resultsArray); + $this->context->smarty->assign('my_carrier_selected', (isset($cart->id_carrier) && $cart->id_carrier == $djlCarrier->id)) ; + $this->context->smarty->assign('product', $electedProduct); $djlCart = new DejalaCart($cart->id); @@ -915,21 +907,21 @@ class Dejala extends CarrierModule { if ($l_date['value'] == $deliveryDateSelected) { - $context->smarty->assign("deliveryDateIndexSelected", $l_key); - $context->smarty->assign("deliveryDateSelected", $deliveryDateSelected); - $context->smarty->assign("deliveryHourSelected", $m_hour); + $this->context->smarty->assign("deliveryDateIndexSelected", $l_key); + $this->context->smarty->assign("deliveryDateSelected", $deliveryDateSelected); + $this->context->smarty->assign("deliveryHourSelected", $m_hour); $setDefaultDate = FALSE; } } } if ($setDefaultDate) { - $context->smarty->assign("deliveryDateIndexSelected", 0); - $context->smarty->assign("deliveryDateSelected", date("Y/m/d", $dateUtc)); - $context->smarty->assign("deliveryHourSelected", (int)(date("H", $dateUtc))); + $this->context->smarty->assign("deliveryDateIndexSelected", 0); + $this->context->smarty->assign("deliveryDateSelected", date("Y/m/d", $dateUtc)); + $this->context->smarty->assign("deliveryHourSelected", (int)(date("H", $dateUtc))); } - $context->smarty->assign("isCartOutOfStock", $isCartOutOfStock); + $this->context->smarty->assign("isCartOutOfStock", $isCartOutOfStock); if (!$isCartOutOfStock) { $buffer = $this->display(__FILE__, 'dejala_carrier.tpl'); @@ -937,7 +929,7 @@ class Dejala extends CarrierModule } else { - $context->smarty->assign('nostock_info', $this->l('I will select my shipping date when my product is available.')); + $this->context->smarty->assign('nostock_info', $this->l('I will select my shipping date when my product is available.')); $buffer = $this->display(__FILE__, 'dejala_carrier_nostock.tpl'); } return $buffer; @@ -1025,7 +1017,6 @@ class Dejala extends CarrierModule public function hookProcessCarrier($params) { // FO: Temporary. Necessary to go around the product's cart re-instanciation bug. - $context = Context::getContext(); $cartParams = $params['cart']; $this->hooklog("processCarrier", $params) ; @@ -1073,7 +1064,7 @@ class Dejala extends CarrierModule } // FO: VERY DIRTY HACK.... Re-assign the global cart to what it was before. - $context->cart = $cartParams ; + $this->context->cart = $cartParams ; } /** diff --git a/modules/dejala/deliveries_csv.php b/modules/dejala/deliveries_csv.php index c806f0319..2d324bf34 100644 --- a/modules/dejala/deliveries_csv.php +++ b/modules/dejala/deliveries_csv.php @@ -15,7 +15,6 @@ return ($l_array); } - global $smarty; $dejalaConfig = new DejalaConfig(); $dejalaConfig->loadConfig(); @@ -66,7 +65,7 @@ } $l_deliveries[$key] = $l_delivery; } - $smarty->assign('deliveries', $l_deliveries); - $smarty->display(dirname(__FILE__).'/dejala_deliveries_csv.tpl'); + Context::getContext()->smarty->assign('deliveries', $l_deliveries); + Context::getContext()->smarty->display(dirname(__FILE__).'/dejala_deliveries_csv.tpl'); } } diff --git a/modules/dibs/dibs.php b/modules/dibs/dibs.php index 3602f3625..63c2fb1a9 100644 --- a/modules/dibs/dibs.php +++ b/modules/dibs/dibs.php @@ -66,11 +66,6 @@ class dibs extends PaymentModule * @staticvar */ private static $site_url; - /** - * Set the smarty object - * @var Smarty - */ - private $smarty; /** * Only this langs array are allowed in DIBS API @@ -91,8 +86,6 @@ class dibs extends PaymentModule public function __construct() { - global $smarty; - $this->smarty = $smarty; $this->name = 'dibs'; $this->tab = 'payments_gateways'; $this->version = '1.0'; @@ -153,9 +146,9 @@ class dibs extends PaymentModule return; if ($params['objOrder']->valid) - $this->smarty->assign(array('status' => 'ok', 'id_order' => $params['objOrder']->id)); + $this->context->smarty->assign(array('status' => 'ok', 'id_order' => $params['objOrder']->id)); else - $this->smarty->assign('status', 'failed'); + $this->context->smarty->assign('status', 'failed'); return $this->display(__FILE__, 'hookorderconfirmation.tpl'); } @@ -397,8 +390,8 @@ class dibs extends PaymentModule $dibsParams['priceinfo2.ProductsAmount'] = $params['cart']->getOrderTotal(true, Cart::BOTH_WITHOUT_SHIPPING); $dibsParams['priceinfo3.AmountWithoutTax'] = $params['cart']->getOrderTotal(false, Cart::BOTH); $dibsParams['priceinfo4.AmountTotalTax'] = (float)($params['cart']->getOrderTotal(true, Cart::BOTH) - $params['cart']->getOrderTotal(false, Cart::BOTH)); - $this->smarty->assign('p', $dibsParams); - $this->smarty->assign('logo_color', self::$MORE_SETTINGS['logo_color']); + $this->context->smarty->assign('p', $dibsParams); + $this->context->smarty->assign('logo_color', self::$MORE_SETTINGS['logo_color']); return $this->display(__FILE__, 'dibs.tpl'); } } diff --git a/modules/ebay/ebay.php b/modules/ebay/ebay.php index e093438f7..daa2979b0 100755 --- a/modules/ebay/ebay.php +++ b/modules/ebay/ebay.php @@ -54,8 +54,6 @@ class Ebay extends Module public function __construct() { - global $cookie; - $this->name = 'ebay'; $this->tab = 'market_place'; $this->version = '1.1'; @@ -65,7 +63,7 @@ class Ebay extends Module $this->id_lang = Language::getIdByIso('fr'); // Check the country and ask the bypass if not 'fr' - if (strtolower(Country::getIsoById(Configuration::get('PS_COUNTRY_DEFAULT'))) != 'fr' && !isset($cookie->ebay_country_default_fr)) + if (strtolower(Country::getIsoById(Configuration::get('PS_COUNTRY_DEFAULT'))) != 'fr' && !isset($this->context->cookie->ebay_country_default_fr)) { $this->warning = $this->l('eBay module currently works only for eBay.fr'); return false; @@ -144,8 +142,6 @@ class Ebay extends Module public function install() { - global $cookie; - // Install SQL include(dirname(__FILE__).'/sql-install.php'); foreach ($sql as $s) @@ -181,8 +177,6 @@ class Ebay extends Module public function uninstall() { - global $cookie; - // Uninstall Config foreach ($this->_fieldsList as $keyConfiguration => $name) if (!Configuration::deleteByName($keyConfiguration)) @@ -225,8 +219,8 @@ class Ebay extends Module return false; // Clean Cookie - $cookie->eBaySession = ''; - $cookie->eBayUsername = ''; + $this->context->cookie->eBaySession = ''; + $this->context->cookie->eBayUsername = ''; return true; } @@ -415,14 +409,12 @@ class Ebay extends Module public function getContent() { - global $cookie; $this->_html .= '

' . $this->l('eBay').'

'; - // Checking Country if (Tools::getValue('ebay_country_default_fr') == 'ok') - $cookie->ebay_country_default_fr = true; - if (strtolower(Country::getIsoById(Configuration::get('PS_COUNTRY_DEFAULT'))) != 'fr' && !isset($cookie->ebay_country_default_fr)) + $this->context->cookie->ebay_country_default_fr = true; + if (strtolower(Country::getIsoById(Configuration::get('PS_COUNTRY_DEFAULT'))) != 'fr' && !isset($this->context->cookie->ebay_country_default_fr)) return $this->_html.$this->displayError($this->l('eBay module currently works only for eBay.fr').'. '.$this->l('Continue anyway ?').''); @@ -466,7 +458,7 @@ class Ebay extends Module // Displaying Information from Prestashop $context = stream_context_create(array('http' => array('method'=>"GET", 'timeout' => 5))); - $prestashopContent = @file_get_contents('http://www.prestashop.com/partner/modules/ebay.php?version='.$this->version.'&shop='.urlencode(Configuration::get('PS_SHOP_NAME')).'®istered='.($alert['registration'] == 1 ? 'no' : 'yes').'&url='.urlencode($_SERVER['HTTP_HOST']).'&iso_country='.$isoCountry.'&iso_lang='.Tools::strtolower($isoUser).'&id_lang='.(int)$cookie->id_lang.'&email='.urlencode(Configuration::get('PS_SHOP_EMAIL')).'&security='.md5(Configuration::get('PS_SHOP_EMAIL')._COOKIE_IV_), false, $context); + $prestashopContent = @file_get_contents('http://www.prestashop.com/partner/modules/ebay.php?version='.$this->version.'&shop='.urlencode(Configuration::get('PS_SHOP_NAME')).'®istered='.($alert['registration'] == 1 ? 'no' : 'yes').'&url='.urlencode($_SERVER['HTTP_HOST']).'&iso_country='.$isoCountry.'&iso_lang='.Tools::strtolower($isoUser).'&id_lang='.(int)$this->context->language->id.'&email='.urlencode(Configuration::get('PS_SHOP_EMAIL')).'&security='.md5(Configuration::get('PS_SHOP_EMAIL')._COOKIE_IV_), false, $context); // Displaying page @@ -528,18 +520,17 @@ class Ebay extends Module private function _displayFormRegister() { - global $cookie; $ebay = new eBayRequest(); - if (!empty($cookie->eBaySession) && isset($_GET['action']) && $_GET['action'] == 'logged') + if (!empty($this->context->cookie->eBaySession) && isset($_GET['action']) && $_GET['action'] == 'logged') { if (isset($_POST['eBayUsername'])) { - $cookie->eBayUsername = $_POST['eBayUsername']; + $this->context->cookie->eBayUsername = $_POST['eBayUsername']; Configuration::updateValue('EBAY_API_USERNAME', $_POST['eBayUsername']); } - $ebay->session = $cookie->eBaySession; - $ebay->username = $cookie->eBayUsername; + $ebay->session = $this->context->cookie->eBaySession; + $ebay->username = $this->context->cookie->eBayUsername; $html = ' @@ -593,7 +584,7 @@ class Ebay extends Module

- +

@@ -667,8 +658,6 @@ class Ebay extends Module private function _displayFormParameters() { - global $cookie; - // Loading config currency $configCurrency = new Currency((int)(Configuration::get('PS_CURRENCY_DEFAULT'))); @@ -797,8 +786,6 @@ class Ebay extends Module private function _displayFormCategory() { - global $cookie; - // Check if the module is configured if (!Configuration::get('EBAY_PAYPAL_EMAIL')) return '

'.$this->l('You have to configure "General Settings" tab before using this tab.').'


'; @@ -818,7 +805,7 @@ class Ebay extends Module $categoryConfigListTmp = Db::getInstance()->ExecuteS('SELECT * FROM `'._DB_PREFIX_.'ebay_category_configuration`'); foreach ($categoryConfigListTmp as $c) $categoryConfigList[$c['id_category']] = $c; - $categoryList = $this->_getChildCategories(Category::getCategories($cookie->id_lang), 0); + $categoryList = $this->_getChildCategories(Category::getCategories($this->context->language->id), 0); $eBayCategoryList = Db::getInstance()->ExecuteS('SELECT * FROM `'._DB_PREFIX_.'ebay_category` WHERE `id_category_ref` = `id_category_ref_parent`'); @@ -917,7 +904,6 @@ class Ebay extends Module private function _postProcessCategory() { // Init Var - global $cookie; $date = date('Y-m-d H:i:s'); $services = Tools::getValue('service'); @@ -992,13 +978,11 @@ class Ebay extends Module private function _displayFormTemplateManager() { - global $cookie; - // Check if the module is configured if (!Configuration::get('EBAY_PAYPAL_EMAIL')) return '

'.$this->l('You have to configure "General Settings" tab before using this tab.').'


'; - $iso = Language::getIsoById((int)($cookie->id_lang)); + $iso = $context->language->iso_code; $isoTinyMCE = (file_exists(_PS_ROOT_DIR_.'/js/tiny_mce/langs/'.$iso.'.js') ? $iso : 'en'); $ad = dirname($_SERVER["PHP_SELF"]); @@ -1083,8 +1067,6 @@ class Ebay extends Module private function _displayFormEbaySync() { - global $cookie; - // Check if the module is configured if (!Configuration::get('EBAY_PAYPAL_EMAIL')) return '

'.$this->l('You have to configure "General Settings" tab before using this tab.').'


'; @@ -1170,7 +1152,7 @@ class Ebay extends Module $categoryConfigListTmp = Db::getInstance()->ExecuteS('SELECT * FROM `'._DB_PREFIX_.'ebay_category_configuration`'); foreach ($categoryConfigListTmp as $c) $categoryConfigList[$c['id_category']] = $c; - $categoryList = $this->_getChildCategories(Category::getCategories($cookie->id_lang), 0); + $categoryList = $this->_getChildCategories(Category::getCategories($this->context->language->id), 0); $html .= ' @@ -1256,7 +1238,6 @@ class Ebay extends Module private function _syncProducts($productsList) { - global $link; $fees = 0; $count = 0; $count_success = 0; @@ -1288,9 +1269,9 @@ class Ebay extends Module $images = $product->getImages($this->id_lang); foreach ($images as $image) { - $pictures[] = $prefix.$link->getImageLink('', $product->id.'-'.$image['id_image'], NULL); - $picturesMedium[] = $prefix.$link->getImageLink('', $product->id.'-'.$image['id_image'], 'medium'); - $picturesLarge[] = $prefix.$link->getImageLink('', $product->id.'-'.$image['id_image'], 'large'); + $pictures[] = $prefix.$this->context->link->getImageLink('', $product->id.'-'.$image['id_image'], NULL); + $picturesMedium[] = $prefix.$this->context->link->getImageLink('', $product->id.'-'.$image['id_image'], 'medium'); + $picturesLarge[] = $prefix.$this->context->link->getImageLink('', $product->id.'-'.$image['id_image'], 'large'); } // Load Variations @@ -1326,7 +1307,7 @@ class Ebay extends Module if (isset($combinationsImages) && !empty($combinationsImages) && count($combinationsImages) > 0) foreach ($combinationsImages as $ci) foreach ($ci as $i) - $variations[$product->id.'-'.$i['id_product_attribute']]['pictures'][] = $prefix.$link->getImageLink('', $product->id.'-'.$i['id_image'], NULL); + $variations[$product->id.'-'.$i['id_product_attribute']]['pictures'][] = $prefix.$this->context->link->getImageLink('', $product->id.'-'.$i['id_image'], NULL); // Load basic price diff --git a/modules/editorial/editorial.php b/modules/editorial/editorial.php index be29cf78e..f9264ac78 100644 --- a/modules/editorial/editorial.php +++ b/modules/editorial/editorial.php @@ -117,7 +117,6 @@ class Editorial extends Module public function getContent() { - $context = Context::getContext(); /* display the module name */ $this->_html = '

'.$this->displayName.'

'; @@ -132,7 +131,7 @@ class Editorial extends Module { unlink(dirname(__FILE__).'/homepage_logo.jpg'); Configuration::updateValue('EDITORIAL_IMAGE_DISABLE', 1); - Tools::redirectAdmin('index.php?tab=AdminModules&configure='.$this->name.'&token='.Tools::getAdminToken('AdminModules'.(int)(Tab::getIdFromClassName('AdminModules')).(int)$context->employee->id)); + Tools::redirectAdmin('index.php?tab=AdminModules&configure='.$this->name.'&token='.Tools::getAdminToken('AdminModules'.(int)(Tab::getIdFromClassName('AdminModules')).(int)$this->context->employee->id)); } $this->_html .= $errors; } @@ -180,11 +179,10 @@ class Editorial extends Module private function _displayForm() { - $context = Context::getContext(); /* Languages preliminaries */ $defaultLanguage = (int)(Configuration::get('PS_LANG_DEFAULT')); $languages = Language::getLanguages(false); - $iso = $context->language->iso_code; + $iso = $this->context->language->iso_code; $divLangName = 'title¤subheading¤cpara¤logo_subheading'; $editorial = new EditorialClass(1); @@ -294,15 +292,14 @@ class Editorial extends Module public function hookHome($params) { - $context = Context::getContext(); - $editorial = new EditorialClass(1, $context->language->id); - $context->smarty->assign(array( + $editorial = new EditorialClass(1, $this->context->language->id); + $this->context->smarty->assign(array( 'editorial' => $editorial, - 'default_lang' => (int)$context->language->id, + 'default_lang' => (int)$this->context->language->id, 'image_width' => Configuration::get('EDITORIAL_IMAGE_WIDTH'), 'image_height' => Configuration::get('EDITORIAL_IMAGE_HEIGHT'), - 'id_lang' => $context->language->id, + 'id_lang' => $this->context->language->id, 'homepage_logo' => !Configuration::get('EDITORIAL_IMAGE_DISABLE') && file_exists('modules/editorial/homepage_logo.jpg'), 'image_path' => $this->_path.'homepage_logo.jpg' )); diff --git a/modules/envoimoinscher/envoimoinscher.php b/modules/envoimoinscher/envoimoinscher.php index a6051255f..fcb8272d2 100755 --- a/modules/envoimoinscher/envoimoinscher.php +++ b/modules/envoimoinscher/envoimoinscher.php @@ -36,8 +36,6 @@ class Envoimoinscher extends Module const INSTALL_SQL_FILE = 'install.sql'; function __construct() { - global $cookie; - $this->name = 'envoimoinscher'; $this->tab = 'shipping_logistics'; $this->version = '1.0'; @@ -81,8 +79,6 @@ class Envoimoinscher extends Module */ public function install() { - global $cookie; - if (!file_exists(dirname(__FILE__).'/'.self::INSTALL_SQL_FILE)) return false; elseif (!$sql = file_get_contents(dirname(__FILE__).'/'.self::INSTALL_SQL_FILE)) @@ -121,8 +117,6 @@ class Envoimoinscher extends Module */ public function uninstall() { - global $cookie; - Db::getInstance()->Execute('DROP TABLE `'._DB_PREFIX_.'envoimoinscher_contenu`'); $tab = new Tab(Tab::getIdFromClassName('AdminEnvoiMoinsCher')); @@ -158,12 +152,11 @@ class Envoimoinscher extends Module private function _displayForm() { - global $cookie; $genderTab = array(1 => 'M.', 2 => 'Mme', 9 => '', 0 => ''); - $features = Feature::getFeatures($cookie->id_lang); - $order_states = OrderState::getOrderStates($cookie->id_lang); - $carriers = Carrier::getCarriers($cookie->id_lang); - $countries = Country::getCountries($cookie->id_lang); + $features = Feature::getFeatures($this->context->language->id); + $order_states = OrderState::getOrderStates($this->context->language->id); + $carriers = Carrier::getCarriers($this->context->language->id); + $countries = Country::getCountries($this->context->language->id); $confs = Configuration::getMultiple(array('PS_SHOP_NAME', 'EMC_LOGIN', 'EMC_GENDER', 'EMC_LAST_NAME', 'EMC_FIRST_NAME', 'EMC_ADDRESS', 'EMC_ZIP_CODE', 'EMC_CITY', 'EMC_COUNTRY', 'EMC_PHONE', 'EMC_EMAIL')); $link = ' '; $idcountries = array(); - foreach (Country::getCountries($cookie->id_lang) as $v) + foreach (Country::getCountries($this->context->language->id) as $v) { $html .= ''; $idcountries[] = $v['id_country']; @@ -715,8 +714,6 @@ class FedexCarrier extends CarrierModule private function _getPathInTab($id_category) { - global $cookie; - $category = Db::getInstance()->getRow(' SELECT id_category, level_depth, nleft, nright FROM '._DB_PREFIX_.'category @@ -728,7 +725,7 @@ class FedexCarrier extends CarrierModule SELECT c.id_category, cl.name, cl.link_rewrite FROM '._DB_PREFIX_.'category c LEFT JOIN '._DB_PREFIX_.'category_lang cl ON (cl.id_category = c.id_category) - WHERE c.nleft <= '.(int)$category['nleft'].' AND c.nright >= '.(int)$category['nright'].' AND cl.id_lang = '.(int)($cookie->id_lang).' + WHERE c.nleft <= '.(int)$category['nleft'].' AND c.nright >= '.(int)$category['nright'].' AND cl.id_lang = '.(int)$this->context->language->id.' ORDER BY c.level_depth ASC LIMIT '.(int)($category['level_depth'] + 1)); @@ -773,8 +770,6 @@ class FedexCarrier extends CarrierModule private function _displayFormCategory() { - global $cookie; - // Check if the module is configured if (!$this->_webserviceTestResult) return '

'.$this->l('You have to configure "General Settings" tab before using this tab.').'


'; @@ -909,7 +904,7 @@ class FedexCarrier extends CarrierModule
@@ -1051,8 +1046,6 @@ class FedexCarrier extends CarrierModule private function _displayFormProduct() { - global $cookie; - // Check if the module is configured if (!$this->_webserviceTestResult) return '

'.$this->l('You have to configure "General Settings" tab before using this tab.').'


'; @@ -1080,7 +1073,7 @@ class FedexCarrier extends CarrierModule foreach ($configProductList as $k => $c) { // Loading Product - $product = new Product((int)$c['id_product'], false, (int)$cookie->id_lang); + $product = new Product((int)$c['id_product'], false, (int)$this->context->language->id); // Loading config currency $configCurrency = new Currency($c['id_currency']); @@ -1127,7 +1120,7 @@ class FedexCarrier extends CarrierModule { // Loading config $configSelected = Db::getInstance()->getRow('SELECT * FROM `'._DB_PREFIX_.'fedex_rate_config` WHERE `id_fedex_rate_config` = '.(int)(Tools::getValue('id_fedex_rate_config'))); - $product = new Product((int)$configSelected['id_product'], false, (int)$cookie->id_lang); + $product = new Product((int)$configSelected['id_product'], false, (int)$this->context->language->id); $html .= '

'.$this->l('Update a rule').' ('.$this->l('Add a rule').' ?)

@@ -1175,7 +1168,7 @@ class FedexCarrier extends CarrierModule '; $productsList = Db::getInstance()->ExecuteS(' SELECT pl.* FROM `'._DB_PREFIX_.'product` p - LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.`id_product` = p.`id_product` AND pl.`id_lang` = '.(int)$cookie->id_lang.') + LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON (pl.`id_product` = p.`id_product` AND pl.`id_lang` = '.(int)$this->context->language->id.') WHERE p.`active` = 1 ORDER BY pl.`name`'); foreach ($productsList as $product) diff --git a/modules/feeder/feeder.php b/modules/feeder/feeder.php index abaedcfd3..38cd75b67 100644 --- a/modules/feeder/feeder.php +++ b/modules/feeder/feeder.php @@ -58,8 +58,6 @@ class Feeder extends Module function hookHeader($params) { - global $smarty, $cookie; - $id_category = (int)(Tools::getValue('id_category')); if (!$id_category) { @@ -79,7 +77,7 @@ class Feeder extends Module $category = new Category($id_category); $orderBy = Tools::getProductsOrder('by', Tools::getValue('orderby')); $orderWay = Tools::getProductsOrder('way', Tools::getValue('orderway')); - $smarty->assign(array( + $this->context->smarty->assign(array( 'feedUrl' => Tools::getShopDomain(true, true).__PS_BASE_URI__.'modules/'.$this->name.'/rss.php?id_category='.$id_category.'&orderby='.$orderBy.'&orderway='.$orderWay, )); return $this->display(__FILE__, 'feederHeader.tpl'); diff --git a/modules/fianetfraud/fianetfraud.php b/modules/fianetfraud/fianetfraud.php index 69da20a9a..487fee8e0 100644 --- a/modules/fianetfraud/fianetfraud.php +++ b/modules/fianetfraud/fianetfraud.php @@ -157,8 +157,6 @@ class Fianetfraud extends Module private function _postProcess() { - global $cookie; - $error = false; Configuration::updateValue('SAC_PRODUCTION', ((Tools::getValue('fianetfraud_production') == 1 ) ? 1 : 0)); @@ -176,11 +174,11 @@ class Fianetfraud extends Module Configuration::updateValue('SAC_PAYMENT_TYPE_'.$payment,Tools::getValue($payment)); } - $categories = Category::getSimpleCategories($cookie->id_lang); + $categories = Category::getSimpleCategories($this->context->language->id); foreach ($categories AS $category) Configuration::updateValue('SAC_CATEGORY_TYPE_'.$category['id_category'],Tools::getValue('cat_'.$category['id_category'])); - $carriers = Carrier::getCarriers($cookie->id_lang); + $carriers = Carrier::getCarriers($this->context->language->id); foreach ($carriers as $carrier) { if (isset($_POST['carrier_'.$carrier['id_carrier']])) diff --git a/modules/fianetsceau/fianetsceau.php b/modules/fianetsceau/fianetsceau.php index cae2d1c39..aa15f3c57 100644 --- a/modules/fianetsceau/fianetsceau.php +++ b/modules/fianetsceau/fianetsceau.php @@ -231,8 +231,7 @@ class FianetSceau extends Module public function hookRightColumn($params) { - global $cookie; - return 'Voir la fiche marchand sur Fia-net.com'; + return 'Voir la fiche marchand sur Fia-net.com'; } } diff --git a/modules/ganalytics/ganalytics.php b/modules/ganalytics/ganalytics.php index 6e251d876..9302de3b5 100644 --- a/modules/ganalytics/ganalytics.php +++ b/modules/ganalytics/ganalytics.php @@ -126,20 +126,18 @@ class GAnalytics extends Module function hookHeader($params) { - global $smarty, $cookie; - // hookOrderConfirmation() already send the sats bypass this step if (strpos($_SERVER['REQUEST_URI'], __PS_BASE_URI__.'order-confirmation.php') === 0) return ''; // Otherwise, create Google Analytics stats $ganalytics_id = Configuration::get('GANALYTICS_ID'); $multilang = (Language::countActiveLanguages() > 1); - $defaultMetaOrder = Meta::getMetaByPage('order',(int)$cookie->id_lang); + $defaultMetaOrder = Meta::getMetaByPage('order',$this->context->language->id); $order = ($multilang?((string)Tools::getValue('isolang').'/'):'').$defaultMetaOrder['url_rewrite']; $pageTrack = ((strpos($_SERVER['REQUEST_URI'], __PS_BASE_URI__.'order.php') === 0 || strpos($_SERVER['REQUEST_URI'], __PS_BASE_URI__.($multilang?((string)Tools::getValue('isolang').'/'):'').$defaultMetaOrder['url_rewrite']) === 0) ? '/order/step'.(int)(Tools::getValue('step')).'.html' : ''); - $smarty->assign('ganalytics_id', $ganalytics_id); - $smarty->assign('pageTrack', $pageTrack); - $smarty->assign('isOrder', false); + $this->context->smarty->assign('ganalytics_id', $ganalytics_id); + $this->context->smarty->assign('pageTrack', $pageTrack); + $this->context->smarty->assign('isOrder', false); return $this->display(__FILE__, 'header.tpl'); } @@ -152,7 +150,6 @@ class GAnalytics extends Module function hookOrderConfirmation($params) { - global $smarty; // Setting parameters $parameters = Configuration::getMultiple(array('PS_LANG_DEFAULT')); @@ -198,11 +195,11 @@ class GAnalytics extends Module } $ganalytics_id = Configuration::get('GANALYTICS_ID'); $pageTrack = (strpos($_SERVER['REQUEST_URI'], __PS_BASE_URI__.'order.php') === 0 ? '/order/step'.intval($step).'.html' : ''); - $smarty->assign('items', $items); - $smarty->assign('trans', $trans); - $smarty->assign('ganalytics_id', $ganalytics_id); - $smarty->assign('pageTrack', $pageTrack); - $smarty->assign('isOrder', true); + $this->context->smarty->assign('items', $items); + $this->context->smarty->assign('trans', $trans); + $this->context->smarty->assign('ganalytics_id', $ganalytics_id); + $this->context->smarty->assign('pageTrack', $pageTrack); + $this->context->smarty->assign('isOrder', true); return $this->display(__FILE__, 'header.tpl'); } } diff --git a/modules/gcheckout/gcheckout.php b/modules/gcheckout/gcheckout.php index 80aaec926..97ceb607f 100644 --- a/modules/gcheckout/gcheckout.php +++ b/modules/gcheckout/gcheckout.php @@ -74,8 +74,6 @@ class GCheckout extends PaymentModule public function getContent() { - global $cookie; - if (Tools::isSubmit('submitGoogleCheckout')) { $errors = array(); @@ -177,9 +175,7 @@ class GCheckout extends PaymentModule if (!$this->active) return; - global $smarty; - - $smarty->assign('buttonText', $this->l('Pay with GoogleCheckout')); + $this->context->smarty->assign('buttonText', $this->l('Pay with GoogleCheckout')); return $this->display(__FILE__, 'payment.tpl'); } @@ -192,19 +188,17 @@ class GCheckout extends PaymentModule public function preparePayment() { - global $smarty, $cart, $cookie; - require_once(dirname(__FILE__).'/library/googlecart.php'); require_once(dirname(__FILE__).'/library/googleitem.php'); require_once(dirname(__FILE__).'/library/googleshipping.php'); - $currency = $this->getCurrency((int)$cart->id_currency); + $currency = $this->getCurrency($this->context->cart->id_currency); - if ($cart->id_currency != $currency->id) + if ($this->context->cart->id_currency != $currency->id) { - $cart->id_currency = (int)$currency->id; - $cookie->id_currency = (int)$cart->id_currency; - $cart->update(); + $this->context->cart->id_currency = (int)$currency->id; + $this->context->cookie->id_currency = (int)$this->context->cart->id_currency; + $this->context->cart->update(); Tools::redirect('modules/'.$this->name.'/payment.php'); } @@ -213,34 +207,34 @@ class GCheckout extends PaymentModule Configuration::get('GCHECKOUT_MERCHANT_KEY'), Configuration::get('GCHECKOUT_MODE'), $currency->iso_code); - foreach ($cart->getProducts() AS $product) + foreach ($this->context->cart->getProducts() AS $product) $googleCart->AddItem(new GoogleItem(utf8_decode($product['name']. ((isset($product['attributes']) AND !empty($product['attributes'])) ? ' - '.$product['attributes'] : '')), utf8_decode($product['description_short']), (int)$product['cart_quantity'], $product['price_wt'], strtoupper(Configuration::get('PS_WEIGHT_UNIT')), (float)$product['weight'])); - if ($wrapping = $cart->getOrderTotal(true, Cart::ONLY_WRAPPING)) + if ($wrapping = $this->context->cart->getOrderTotal(true, Cart::ONLY_WRAPPING)) $googleCart->AddItem(new GoogleItem(utf8_decode($this->l('Wrapping')), '', 1, $wrapping)); - foreach ($cart->getDiscounts() AS $voucher) + foreach ($this->context->cart->getDiscounts() AS $voucher) $googleCart->AddItem(new GoogleItem(utf8_decode($voucher['name']), utf8_decode($voucher['description']), 1, '-'.$voucher['value_real'])); if (!Configuration::get('GCHECKOUT_NO_SHIPPING')) { - $carrier = new Carrier((int)($cart->id_carrier), (int)($cookie->id_lang)); + $carrier = new Carrier((int)($this->context->cart->id_carrier), $this->context->language->id); $googleCart->AddShipping(new GoogleFlatRateShipping(utf8_decode($carrier->name), - $cart->getOrderShippingCost($cart->id_carrier))); + $this->context->cart->getOrderShippingCost($this->context->cart->id_carrier))); } $googleCart->SetEditCartUrl(Tools::getShopDomainSsl(true, true).__PS_BASE_URI__.'order.php'); $googleCart->SetContinueShoppingUrl(Tools::getShopDomainSsl(true, true).__PS_BASE_URI__.'order-confirmation.php'); $googleCart->SetRequestBuyerPhone(false); - $googleCart->SetMerchantPrivateData($cart->id.'|'.$cart->secure_key); + $googleCart->SetMerchantPrivateData($this->context->cart->id.'|'.$this->context->cart->secure_key); - $total = $cart->getOrderTotal(); + $total = $this->context->cart->getOrderTotal(); - $smarty->assign(array( + $this->context->smarty->assign(array( 'googleCheckoutExtraForm' => $googleCart->CheckoutButtonCode($this->l('Pay with GoogleCheckout'), 'LARGE'), 'total' => $total, 'googleTotal' => $total)); diff --git a/modules/hipay/hipay.php b/modules/hipay/hipay.php index 3fe2ac85d..f8eb9a61b 100644 --- a/modules/hipay/hipay.php +++ b/modules/hipay/hipay.php @@ -128,9 +128,7 @@ class Hipay extends PaymentModule public function hookPayment($params) { - global $smarty, $cart; - - $currency = new Currency($this->getModuleCurrency($cart)); + $currency = new Currency($this->getModuleCurrency($this->context->cart)); $hipayAccount = ($this->prod ? Configuration::get('HIPAY_ACCOUNT_'.$currency->iso_code) : Configuration::get('HIPAY_ACCOUNT_TEST_'.$currency->iso_code)); $hipayPassword = ($this->prod ? Configuration::get('HIPAY_PASSWORD_'.$currency->iso_code) : Configuration::get('HIPAY_PASSWORD_TEST_'.$currency->iso_code)); $hipaySiteId = ($this->prod ? Configuration::get('HIPAY_SITEID_'.$currency->iso_code) : Configuration::get('HIPAY_SITEID_TEST_'.$currency->iso_code)); @@ -138,8 +136,8 @@ class Hipay extends PaymentModule if ($hipayAccount AND $hipayPassword AND $hipaySiteId AND $hipayCategory AND Configuration::get('HIPAY_RATING')) { - $smarty->assign('hipay_prod', $this->prod); - $smarty->assign(array('this_path' => $this->_path, 'this_path_ssl' => self::getHttpHost(true, true).__PS_BASE_URI__.'modules/'.$this->name.'/')); + $this->context->smarty->assign('hipay_prod', $this->prod); + $this->context->smarty->assign(array('this_path' => $this->_path, 'this_path_ssl' => self::getHttpHost(true, true).__PS_BASE_URI__.'modules/'.$this->name.'/')); return $this->display(__FILE__, 'payment.tpl'); } } @@ -158,19 +156,17 @@ class Hipay extends PaymentModule public function payment() { - global $cookie, $cart; - - $id_currency = (int)$this->getModuleCurrency($cart); + $id_currency = (int)$this->getModuleCurrency($this->context->cart); // If the currency is forced to a different one than the current one, then the cart must be updated - if ($cart->id_currency != $id_currency) - if (Db::getInstance()->execute('UPDATE '._DB_PREFIX_.'cart SET id_currency = '.(int)$id_currency.' WHERE id_cart = '.(int)$cart->id)) - $cart->id_currency = $id_currency; + if ($this->context->cart->id_currency != $id_currency) + if (Db::getInstance()->execute('UPDATE '._DB_PREFIX_.'cart SET id_currency = '.(int)$id_currency.' WHERE id_cart = '.(int)$this->context->cart->id)) + $this->context->cart->id_currency = $id_currency; $currency = new Currency($id_currency); - $language = new Language($cart->id_lang); - $customer = new Customer($cart->id_customer); - $carrier = new Carrier($cart->id_carrier, $cart->id_lang); - $id_zone = self::MysqlGetValue('SELECT id_zone FROM '._DB_PREFIX_.'address a INNER JOIN '._DB_PREFIX_.'country c ON a.id_country = c.id_country WHERE id_address = '.(int)$cart->id_address_delivery); + $language = new Language($this->context->cart->id_lang); + $customer = new Customer($this->context->cart->id_customer); + $carrier = new Carrier($this->context->cart->id_carrier, $this->context->cart->id_lang); + $id_zone = self::MysqlGetValue('SELECT id_zone FROM '._DB_PREFIX_.'address a INNER JOIN '._DB_PREFIX_.'country c ON a.id_country = c.id_country WHERE id_address = '.(int)$this->context->cart->id_address_delivery); require_once(dirname(__FILE__).'/mapi/mapi_package.php'); @@ -188,12 +184,12 @@ class Hipay extends PaymentModule $paymentParams->setPaymentMethod(HIPAY_MAPI_METHOD_SIMPLE); $paymentParams->setCaptureDay(HIPAY_MAPI_CAPTURE_IMMEDIATE); $paymentParams->setCurrency(strtoupper($currency->iso_code)); - $paymentParams->setIdForMerchant($cart->id); + $paymentParams->setIdForMerchant($this->context->cart->id); $paymentParams->setMerchantSiteId($hipaySiteId); $paymentParams->setUrlCancel(self::getHttpHost(true, true).'index.php?controller=order&step=3'); - $paymentParams->setUrlNok(self::getHttpHost(true, true).__PS_BASE_URI__.'index.php?controller=order-confirmation&id_cart='.(int)$cart->id.'&id_module='.(int)$this->id.'&secure_key='.$customer->secure_key); - $paymentParams->setUrlOk(self::getHttpHost(true, true).__PS_BASE_URI__.'index.php?controller=order-confirmation&id_cart='.(int)$cart->id.'&id_module='.(int)$this->id.'&secure_key='.$customer->secure_key); - $paymentParams->setUrlAck(self::getHttpHost(true, true).__PS_BASE_URI__.'modules/'.$this->name.'/validation.php?token='.$cart->secure_key); + $paymentParams->setUrlNok(self::getHttpHost(true, true).__PS_BASE_URI__.'index.php?controller=order-confirmation&id_cart='.(int)$this->context->cart->id.'&id_module='.(int)$this->id.'&secure_key='.$customer->secure_key); + $paymentParams->setUrlOk(self::getHttpHost(true, true).__PS_BASE_URI__.'index.php?controller=order-confirmation&id_cart='.(int)$this->context->cart->id.'&id_module='.(int)$this->id.'&secure_key='.$customer->secure_key); + $paymentParams->setUrlAck(self::getHttpHost(true, true).__PS_BASE_URI__.'modules/'.$this->name.'/validation.php?token='.$this->context->cart->secure_key); $paymentParams->setBackgroundColor('#FFFFFF'); if (!$paymentParams->check()) @@ -203,9 +199,9 @@ class Hipay extends PaymentModule $item->setName($this->l('Cart')); $item->setInfo(''); $item->setquantity(1); - $item->setRef($cart->id); + $item->setRef($this->context->cart->id); $item->setCategory($hipaycategory); - $item->setPrice($cart->getOrderTotal()); + $item->setPrice($this->context->cart->getOrderTotal()); try { if (!$item->check()) @@ -237,12 +233,11 @@ class Hipay extends PaymentModule Tools::redirectLink($url); else { - global $smarty; include(dirname(__FILE__).'/../../header.php'); - $smarty->assign('errors', array('[Hipay] '.strval($err_msg).' ('.$output.')')); + $this->context->smarty->assign('errors', array('[Hipay] '.strval($err_msg).' ('.$output.')')); $_SERVER['HTTP_REFERER'] = self::getHttpHost(true, true).'index.php?controller=order&step=3'; - $smarty->display(_PS_THEME_DIR_.'errors.tpl'); + $this->context->smarty->display(_PS_THEME_DIR_.'errors.tpl'); include(dirname(__FILE__).'/../../footer.php'); } @@ -320,8 +315,6 @@ class Hipay extends PaymentModule public function getContent() { - global $cookie; - $currencies = DB::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS('SELECT c.iso_code, c.name, c.sign FROM '._DB_PREFIX_.'currency c'); if (Tools::isSubmit('submitHipayAZ')) diff --git a/modules/iadvize/iadvize.php b/modules/iadvize/iadvize.php index 123efd47d..ef8fc5bae 100755 --- a/modules/iadvize/iadvize.php +++ b/modules/iadvize/iadvize.php @@ -58,9 +58,7 @@ class iAdvize extends Module public function getContent() { - global $cookie; - - $lang = new Language((int)($cookie->id_lang)); + $lang = $this->context->language; if (!in_array($lang->iso_code, array('fr', 'en', 'es'))) $lang->iso_code = 'en'; diff --git a/modules/importerosc/importerosc.php b/modules/importerosc/importerosc.php index c2eece072..a25b417db 100644 --- a/modules/importerosc/importerosc.php +++ b/modules/importerosc/importerosc.php @@ -6,8 +6,6 @@ class importerosc extends ImportModule { public function __construct() { - global $cookie; - $this->name = 'importerosc'; $this->tab = 'migration_tools'; $this->version = '1.0'; diff --git a/modules/livezilla/livezilla.php b/modules/livezilla/livezilla.php index eb20658ba..f4a69c8ee 100644 --- a/modules/livezilla/livezilla.php +++ b/modules/livezilla/livezilla.php @@ -100,15 +100,12 @@ class LiveZilla extends Module private function displayBlock() { - global $smarty; - - if ($livezilla_script = Configuration::get('LIVEZILLA_SCRIPT')) - $smarty->assign('LIVEZILLA_SCRIPT', $livezilla_script); + $this->context->smarty->assign('LIVEZILLA_SCRIPT', $livezilla_script); elseif ($livezilla_url = Configuration::get('LIVEZILLA_URL')) - $smarty->assign('LIVEZILLA_URL', $livezilla_url); + $this->context->smarty->assign('LIVEZILLA_URL', $livezilla_url); else - $smarty->assign('LIVEZILLA_UNDEFINED', 1); + $this->context->smarty->assign('LIVEZILLA_UNDEFINED', 1); return $this->display(__FILE__, 'livezilla.tpl'); } diff --git a/modules/loyalty/LoyaltyModule.php b/modules/loyalty/LoyaltyModule.php index 16296a337..364618768 100644 --- a/modules/loyalty/LoyaltyModule.php +++ b/modules/loyalty/LoyaltyModule.php @@ -104,9 +104,8 @@ class LoyaltyModule extends ObjectModel { if (!(int)(Configuration::get('PS_LOYALTY_NONE_AWARD')) AND Product::isDiscounted((int)$product['id_product'])) { - global $smarty; - if (isset($smarty) AND is_object($newProduct) AND $product['id_product'] == $newProduct->id) - $smarty->assign('no_pts_discounted', 1); + if (isset($this->context->smarty) AND is_object($newProduct) AND $product['id_product'] == $newProduct->id) + $this->context->smarty->assign('no_pts_discounted', 1); continue; } $total += ($taxesEnabled == PS_TAX_EXC ? $product['price'] : $product['price_wt'])* (int)($product['cart_quantity']); @@ -120,23 +119,17 @@ class LoyaltyModule extends ObjectModel public static function getVoucherValue($nbPoints, $id_currency = NULL) { - global $cookie; - - if (empty($id_currency)) - $id_currency = (int)$cookie->id_currency; - - return (int)$nbPoints * (float)Tools::convertPrice(Configuration::get('PS_LOYALTY_POINT_VALUE'), new Currency((int)$id_currency)); + $currency = $id_currency ? new Currency($id_currency) : $this->context->currency->id; + + return (int)$nbPoints * (float)Tools::convertPrice(Configuration::get('PS_LOYALTY_POINT_VALUE'), $currency); } public static function getNbPointsByPrice($price) { - global $cookie; - - if (Configuration::get('PS_CURRENCY_DEFAULT') != $cookie->id_currency) + if (Configuration::get('PS_CURRENCY_DEFAULT') != $this->context->currency->id) { - $currency = new Currency((int)($cookie->id_currency)); - if ($currency->conversion_rate) - $price = $price / $currency->conversion_rate; + if ($this->context->currency->conversion_rate) + $price = $price / $this->context->currency->conversion_rate; } /* Prevent division by zero */ diff --git a/modules/loyalty/loyalty.php b/modules/loyalty/loyalty.php index d60746590..e79f619ee 100644 --- a/modules/loyalty/loyalty.php +++ b/modules/loyalty/loyalty.php @@ -243,13 +243,11 @@ class Loyalty extends Module public function getContent() { - global $cookie; - $this->instanceDefaultStates(); $this->_postProcess(); - $categories = Category::getCategories((int)($cookie->id_lang)); - $order_states = OrderState::getOrderStates((int)$cookie->id_lang); + $categories = Category::getCategories($this->context->language->id); + $order_states = OrderState::getOrderStates($this->context->language->id); $currency = new Currency((int)(Configuration::get('PS_CURRENCY_DEFAULT'))); $defaultLanguage = (int)(Configuration::get('PS_LANG_DEFAULT')); $languages = Language::getLanguages(false); @@ -442,8 +440,6 @@ class Loyalty extends Module { include_once(dirname(__FILE__).'/LoyaltyModule.php'); - global $smarty; - $product = new Product((int)Tools::getValue('id_product')); if (Validate::isLoadedObject($product)) { @@ -458,14 +454,14 @@ class Loyalty extends Module if (!(int)(Configuration::get('PS_LOYALTY_NONE_AWARD')) AND Product::isDiscounted((int)$product->id)) { $points = 0; - $smarty->assign('no_pts_discounted', 1); + $this->context->smarty->assign('no_pts_discounted', 1); } else $points = (int)(LoyaltyModule::getNbPointsByPrice($product->getPrice(Product::getTaxCalculationMethod() == PS_TAX_EXC ? false : true, (int)($product->getIdProductAttributeMostExpensive())))); $pointsAfter = $points; $pointsBefore = 0; } - $smarty->assign(array( + $this->context->smarty->assign(array( 'points' => (int)($points), 'total_points' => (int)($pointsAfter), 'point_rate' => Configuration::get('PS_LOYALTY_POINT_RATE'), @@ -521,12 +517,10 @@ class Loyalty extends Module { include_once(dirname(__FILE__).'/LoyaltyModule.php'); - global $smarty; - if (Validate::isLoadedObject($params['cart'])) { $points = LoyaltyModule::getCartNbPoints($params['cart']); - $smarty->assign(array( + $this->context->smarty->assign(array( 'points' => (int)$points, 'voucher' => LoyaltyModule::getVoucherValue((int)$points), 'guest_checkout' => (int)Configuration::get('PS_GUEST_CHECKOUT_ENABLED') diff --git a/modules/mailalerts/mailalerts.php b/modules/mailalerts/mailalerts.php index f5fd59932..ccad650d8 100644 --- a/modules/mailalerts/mailalerts.php +++ b/modules/mailalerts/mailalerts.php @@ -252,16 +252,14 @@ class MailAlerts extends Module public function hookProductOutOfStock($params) { - global $smarty, $cookie; - if (!$this->_customer_qty) return ; $id_product = (int)($params['product']->id); $id_product_attribute = 0; - if (!$cookie->isLogged()) - $smarty->assign('email', 1); + if (!$this->context->cookie->isLogged()) + $this->context->smarty->assign('email', 1); else { $id_customer = (int)($params['cookie']->id_customer); @@ -269,7 +267,7 @@ class MailAlerts extends Module return ; } - $smarty->assign(array( + $this->context->smarty->assign(array( 'id_product' => $id_product, 'id_product_attribute' => $id_product_attribute)); @@ -289,8 +287,6 @@ class MailAlerts extends Module public function hookUpdateQuantity($params) { - global $cookie; - if (is_object($params['product'])) $params['product'] = get_object_vars($params['product']); @@ -309,9 +305,8 @@ class MailAlerts extends Module '{qty}' => $qty, '{last_qty}' => (int)(Configuration::get('MA_LAST_QTIES')), '{product}' => strval($params['product']['name']).(isset($params['product']['attributes_small']) ? ' '.$params['product']['attributes_small'] : '')); - $id_lang = (is_object($cookie) AND isset($cookie->id_lang)) ? (int)$cookie->id_lang : (int)Configuration::get('PS_LANG_DEFAULT'); - $iso = Language::getIsoById((int)$id_lang); - + + $iso = $this->context->language->iso_code; if ($params['product']['active'] == 1) { if (file_exists(dirname(__FILE__).'/mails/'.$iso.'/productoutofstock.txt') AND file_exists(dirname(__FILE__).'/mails/'.$iso.'/productoutofstock.html')) diff --git a/modules/mondialrelay/AdminMondialRelay.php b/modules/mondialrelay/AdminMondialRelay.php index 2951c91f0..81b0a78b0 100755 --- a/modules/mondialrelay/AdminMondialRelay.php +++ b/modules/mondialrelay/AdminMondialRelay.php @@ -44,22 +44,20 @@ class AdminMondialRelay extends AdminTab private function displayOrdersTable() { - global $cookie; - $mondialrelay = new MondialRelay(); - $order_state = new OrderState((int)(Configuration::get('MONDIAL_RELAY_ORDER_STATE')), $cookie->id_lang); + $order_state = new OrderState((int)(Configuration::get('MONDIAL_RELAY_ORDER_STATE')), $this->context->language->id); $mr_weight_coef = (int)(Configuration::get('MR_WEIGHT_COEF')); $html = ''; $html .= $this->l('To generate labels, you must register a correct address for your store on'). ' '. + (int)(Tab::getIdFromClassName('AdminContact')).(int)$this->context->employee->id).'" class="green">'. $this->l('The contact page').''; $html .= '

'.$this->l('All orders which have the state').' "'.$order_state->name.'"'; $html .= '. ' . $this->l('Change configuration') . '

+ (int)$this->context->employee->id).'" class="green">' . $this->l('Change configuration') . '

@@ -110,7 +108,7 @@ class AdminMondialRelay extends AdminTab $html .= '
'; $html .= ' diff --git a/modules/mondialrelay/mondialrelay.php b/modules/mondialrelay/mondialrelay.php index e07bf257d..aa9745189 100755 --- a/modules/mondialrelay/mondialrelay.php +++ b/modules/mondialrelay/mondialrelay.php @@ -67,8 +67,6 @@ class MondialRelay extends Module public function install() { - global $cookie; - $name = "shipping"; $title = "Mondial Relay API"; @@ -404,8 +402,6 @@ class MondialRelay extends Module public function hookOrderDetail($params) { - global $smarty; - $carrier = $params['carrier']; $order = $params['order']; @@ -414,23 +410,21 @@ class MondialRelay extends Module $module = $carrier->external_module_name; include_once(_PS_MODULE_DIR_.$module.'/'.$module.'.php'); $module_carrier = new $module(); - $smarty->assign('followup', $module_carrier->get_followup($order->shipping_number)); + $this->context->smarty->assign('followup', $module_carrier->get_followup($order->shipping_number)); } else if ($carrier->url AND $order->shipping_number) - $smarty->assign('followup', str_replace('@', $order->shipping_number, $carrier->url)); + $this->context->smarty->assign('followup', str_replace('@', $order->shipping_number, $carrier->url)); } public function hookOrderDetailDisplayed($params) { - global $smarty; - $res = Db::getInstance()->getRow(' SELECT s.`MR_Selected_LgAdr1`, s.`MR_Selected_LgAdr2`, s.`MR_Selected_LgAdr3`, s.`MR_Selected_LgAdr4`, s.`MR_Selected_CP`, s.`MR_Selected_Ville`, s.`MR_Selected_Pays`, s.`MR_Selected_Num` FROM `'._DB_PREFIX_.'mr_selected` s WHERE s.`id_cart` = '.$params['order']->id_cart); if ((!$res) OR ($res['MR_Selected_Num'] == 'LD1') OR ($res['MR_Selected_Num'] == 'LDS')) return ''; - $smarty->assign('mr_addr', $res['MR_Selected_LgAdr1'].($res['MR_Selected_LgAdr1'] ? ' - ' : '').$res['MR_Selected_LgAdr2'].($res['MR_Selected_LgAdr2'] ? ' - ' : '').$res['MR_Selected_LgAdr3'].($res['MR_Selected_LgAdr3'] ? ' - ' : '').$res['MR_Selected_LgAdr4'].($res['MR_Selected_LgAdr4'] ? ' - ' : '').$res['MR_Selected_CP'].' '.$res['MR_Selected_Ville'].' - '.$res['MR_Selected_Pays']); + $this->context->smarty->assign('mr_addr', $res['MR_Selected_LgAdr1'].($res['MR_Selected_LgAdr1'] ? ' - ' : '').$res['MR_Selected_LgAdr2'].($res['MR_Selected_LgAdr2'] ? ' - ' : '').$res['MR_Selected_LgAdr3'].($res['MR_Selected_LgAdr3'] ? ' - ' : '').$res['MR_Selected_LgAdr4'].($res['MR_Selected_LgAdr4'] ? ' - ' : '').$res['MR_Selected_CP'].' '.$res['MR_Selected_Ville'].' - '.$res['MR_Selected_Pays']); return $this->display(__FILE__, 'orderDetail.tpl'); } @@ -509,7 +503,7 @@ class MondialRelay extends Module public function hookextraCarrier($params) { - global $smarty, $cart, $cookie, $defaultCountry, $nbcarriers; + global $nbcarriers; if (Configuration::get('MR_ENSEIGNE_WEBSERVICE') == '' OR Configuration::get('MR_CODE_MARQUE') == '' OR @@ -517,22 +511,22 @@ class MondialRelay extends Module Configuration::get('MR_LANGUAGE') == '') return ''; - $totalweight = Configuration::get('MR_WEIGHT_COEF') * $cart->getTotalWeight(); + $totalweight = Configuration::get('MR_WEIGHT_COEF') * $this->context->cart->getTotalWeight(); - if (Validate::isUnsignedInt($cart->id_carrier)) + if (Validate::isUnsignedInt($this->context->cart->id_carrier)) { - $carrier = new Carrier((int)($cart->id_carrier)); + $carrier = new Carrier((int)($this->context->cart->id_carrier)); if ($carrier->active AND !$carrier->deleted) - $checked = (int)($cart->id_carrier); + $checked = (int)($this->context->cart->id_carrier); } if (!isset($checked) OR $checked == 0) $checked = (int)(Configuration::get('PS_CARRIER_DEFAULT')); - $address = new Address((int)($cart->id_address_delivery)); + $address = new Address((int)($this->context->cart->id_address_delivery)); $id_zone = Address::getZoneById((int)($address->id)); $country = new Country((int)($address->id_country)); - $query = self::getmrth((int)($cookie->id_lang), true, (int)($country->id_zone), $country->iso_code); + $query = self::getmrth($this->context->language->id, true, (int)($country->id_zone), $country->iso_code); $resultsArray = array(); $i = 0; @@ -549,12 +543,12 @@ class MondialRelay extends Module if ($row['range_behavior']) { // Get id zone - if (isset($cart->id_address_delivery) AND $cart->id_address_delivery) - $id_zone = Address::getZoneById((int)($cart->id_address_delivery)); + if (isset($this->context->cart->id_address_delivery) AND $this->context->cart->id_address_delivery) + $id_zone = Address::getZoneById((int)($this->context->cart->id_address_delivery)); else - $id_zone = (int)$defaultCountry->id_zone; - if ((Configuration::get('PS_SHIPPING_METHOD') AND (!Carrier::checkDeliveryPriceByWeight($row['id_carrier'], $cart->getTotalWeight(), $id_zone))) OR - (!Configuration::get('PS_SHIPPING_METHOD') AND (!Carrier::checkDeliveryPriceByPrice($row['id_carrier'], $cart->getOrderTotal(true, self::BOTH_WITHOUT_SHIPPING), $id_zone, $cart->id_currency)))) + $id_zone = (int)$this->context->country->id_zone; + if ((Configuration::get('PS_SHIPPING_METHOD') AND (!Carrier::checkDeliveryPriceByWeight($row['id_carrier'], $this->context->cart->getTotalWeight(), $id_zone))) OR + (!Configuration::get('PS_SHIPPING_METHOD') AND (!Carrier::checkDeliveryPriceByPrice($row['id_carrier'], $this->context->cart->getOrderTotal(true, self::BOTH_WITHOUT_SHIPPING), $id_zone, $this->context->cart->id_currency)))) { unset($result[$k]); continue ; @@ -566,7 +560,7 @@ class MondialRelay extends Module $row['col'] = $settings[0]['mr_ModeCol']; $row['liv'] = $settings[0]['mr_ModeLiv']; $row['ass'] = $settings[0]['mr_ModeAss']; - $row['price'] = $cart->getOrderShippingCost((int)($row['id_carrier'])); + $row['price'] = $this->context->cart->getOrderShippingCost((int)($row['id_carrier'])); $row['img'] = file_exists(_PS_SHIP_IMG_DIR_.(int)($row['id_carrier']).'.jpg') ? _THEME_SHIP_DIR_.(int)($row['id_carrier']).'.jpg' : ''; $resultsArray[] = $row; @@ -577,12 +571,12 @@ class MondialRelay extends Module { include_once(_PS_MODULE_DIR_.'mondialrelay/page_iso.php'); - $smarty->assign( array( + $this->context->smarty->assign( array( 'address_map' => $address->address1.', '.$address->postcode.', '.ote_accent($address->city).', '.$country->iso_code, 'input_cp' => $address->postcode, 'input_ville' => ote_accent($address->city), 'input_pays' => $country->iso_code, - 'input_poids' => Configuration::get('MR_WEIGHT_COEF') * $cart->getTotalWeight(), + 'input_poids' => Configuration::get('MR_WEIGHT_COEF') * $this->context->cart->getTotalWeight(), 'nbcarriers' => $nbcarriers, 'checked' => (int)($checked), 'google_api_key' => Configuration::get('MR_GOOGLE_MAP'), @@ -628,10 +622,10 @@ class MondialRelay extends Module - '.$this->l('Create a Carrier').'
- '.$this->l('Define a price for your carrier on').' '.$this->l('The Carrier page').'
+ (int)$this->context->employee->id).'" class="green">'.$this->l('The Carrier page').'
- '.$this->l('To generate labels, you must have a valid and registered address of your store on your'). ' '.$this->l('contact page').'
+ (int)$this->context->employee->id).'" class="green">'.$this->l('contact page').'

'.$this->l('URL Cron Task:').' '.Tools::getHttpHost(true, true)._MODULE_DIR_.$this->name.'/cron.php?secure_key='.Configuration::get('MONDIAL_RELAY_SECURE_KEY'). '

@@ -673,8 +667,6 @@ class MondialRelay extends Module public function mrUpdate($type, $array, $keyArray) { - global $cookie; - if ($type == 'settings') { Configuration::updateValue('MR_ENSEIGNE_WEBSERVICE', $array[0]); @@ -841,8 +833,6 @@ class MondialRelay extends Module public function shippingForm() { - global $cookie; - $query = Db::getInstance()->ExecuteS(' SELECT m.* FROM `'._DB_PREFIX_.'mr_method` m @@ -861,8 +851,8 @@ class MondialRelay extends Module { $output .= '
  • - Delete' . str_replace('_', ' ', $Options['mr_Name']) . ' (' . $Options['mr_ModeCol'] . '-' . $Options['mr_ModeLiv'] . ' - ' . $Options['mr_ModeAss'] . ' : '.$Options['mr_Pays_list'].') - '.$this->l('Config Shipping.').' + Delete' . str_replace('_', ' ', $Options['mr_Name']) . ' (' . $Options['mr_ModeCol'] . '-' . $Options['mr_ModeLiv'] . ' - ' . $Options['mr_ModeAss'] . ' : '.$Options['mr_Pays_list'].') + '.$this->l('Config Shipping.').'
  • '; } $output .= ' @@ -923,8 +913,6 @@ class MondialRelay extends Module public function settingsstateorderForm() { - global $cookie; - $this->orderState = Configuration::get('MONDIAL_RELAY_ORDER_STATE'); $output = ''; $output .= ''; @@ -933,7 +921,7 @@ class MondialRelay extends Module $output .= '
    '; $output .= '
    '.$order['exp_number'].' - + '.$this->l('View').'