@@ -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
'.$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
'.$this->l('Click on the button below').'
- '.$this->l('eBay User ID').'
+ '.$this->l('eBay User ID').'
@@ -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 = '
'.$this->l('Select a country ...').' ';
$idcountries = array();
- foreach (Country::getCountries($cookie->id_lang) as $v)
+ foreach (Country::getCountries($this->context->language->id) as $v)
{
$html .= ''.$v['name'].' ';
$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
'.$this->l('Select a category ...').'
- '.$this->_getChildCategories(Category::getCategories($cookie->id_lang), 0).'
+ '.$this->_getChildCategories(Category::getCategories($this->context->language->id), 0).'
'.$this->l('Pickup Type').' :
@@ -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').' ? )
@@ -110,7 +108,7 @@ class AdminMondialRelay extends AdminTab
$html .= '
'.$order['exp_number'].' ';
$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 .= '
- ' . str_replace('_', ' ', $Options['mr_Name']) . ' (' . $Options['mr_ModeCol'] . '-' . $Options['mr_ModeLiv'] . ' - ' . $Options['mr_ModeAss'] . ' : '.$Options['mr_Pays_list'].')
- '.$this->l('Config Shipping.').'
+ ' . 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 .= '