diff --git a/admin-dev/init.php b/admin-dev/init.php index 1fe76574e..796c76f95 100644 --- a/admin-dev/init.php +++ b/admin-dev/init.php @@ -95,5 +95,4 @@ $context->link = $link; $context->language = $language; $context->currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT')); $context->country = $defaultCountry; -$context->smarty = $smarty; $context->shop = new Shop(Shop::getContextID()); \ No newline at end of file diff --git a/admin-dev/tabs/AdminCustomerThreads.php b/admin-dev/tabs/AdminCustomerThreads.php index 2ea435c76..14f7bc6c4 100644 --- a/admin-dev/tabs/AdminCustomerThreads.php +++ b/admin-dev/tabs/AdminCustomerThreads.php @@ -550,7 +550,7 @@ class AdminCustomerThreads extends AdminTab '; echo ' -

'.$this->l('Validated Orders:').' '.$countOK.' '.$this->l('for').' '.Tools::displayPrice($totalOK, new Currency(Configuration::get('PS_CURRENCY_DEFAULT'))).'

+

'.$this->l('Validated Orders:').' '.$countOK.' '.$this->l('for').' '.Tools::displayPrice($totalOK, $context->currency).'

'; } } diff --git a/admin-dev/tabs/AdminOrders.php b/admin-dev/tabs/AdminOrders.php index d054197a2..bbe6b24b2 100644 --- a/admin-dev/tabs/AdminOrders.php +++ b/admin-dev/tabs/AdminOrders.php @@ -330,7 +330,7 @@ class AdminOrders extends AdminTab $this->_errors[] = Tools::displayError('Cannot generate voucher'); else { - $currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT')); + $currency = $context->currency; $params['{voucher_amount}'] = Tools::displayPrice($voucher->value, $currency, false); $params['{voucher_num}'] = $voucher->name; @Mail::Send((int)($order->id_lang), 'voucher', Mail::l('New voucher regarding your order'), $params, $customer->email, $customer->firstname.' '.$customer->lastname); @@ -472,7 +472,7 @@ class AdminOrders extends AdminTab $messages = Message::getMessagesByOrderId($order->id, true); $states = OrderState::getOrderStates($context->language->id); $currency = new Currency($order->id_currency); - $currentLanguage = new Language($context->language->id); + $currentLanguage = $context->language; $currentState = OrderHistory::getLastOrderState($order->id); $sources = ConnectionsSource::getOrderSources($order->id); $cart = Cart::getCartByOrderId($order->id); diff --git a/admin-dev/tabs/AdminPreferences.php b/admin-dev/tabs/AdminPreferences.php index ef8625960..cd4031f9f 100644 --- a/admin-dev/tabs/AdminPreferences.php +++ b/admin-dev/tabs/AdminPreferences.php @@ -451,8 +451,7 @@ class AdminPreferences extends AdminTab break; case 'price': - $default_currency = new Currency((int)(Configuration::get("PS_CURRENCY_DEFAULT"))); - echo $default_currency->getSign('left').''.$default_currency->getSign('right').' '.$this->l('(tax excl.)'); + echo $context->currency->getSign('left').''.$context->currency->getSign('right').' '.$this->l('(tax excl.)'); break; case 'textLang': diff --git a/admin-dev/tabs/AdminProducts.php b/admin-dev/tabs/AdminProducts.php index 234ae0a17..6f555238f 100644 --- a/admin-dev/tabs/AdminProducts.php +++ b/admin-dev/tabs/AdminProducts.php @@ -1522,7 +1522,7 @@ class AdminProducts extends AdminTab if (!($obj = $this->loadObject(true))) return; - $currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT')); + $currency = $context->currency; if ($obj->id) self::$currentIndex .= '&id_product='.$obj->id; @@ -3126,7 +3126,7 @@ class AdminProducts extends AdminTab $attributes = Attribute::getAttributes($context->language->id, true); foreach ($attributes AS $k => $attribute) $attributeJs[$attribute['id_attribute_group']][$attribute['id_attribute']] = $attribute['name']; - $currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT')); + $currency = $context->currency; $attributes_groups = AttributeGroup::getAttributesGroups($context->language->id); diff --git a/admin-dev/tabs/AdminReferrers.php b/admin-dev/tabs/AdminReferrers.php index 06172057b..00f222d01 100644 --- a/admin-dev/tabs/AdminReferrers.php +++ b/admin-dev/tabs/AdminReferrers.php @@ -440,8 +440,8 @@ class AdminReferrers extends AdminTab public function displayListContent($token = NULL) { + $context = Context::getContext(); $irow = 0; - $currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT')); if ($this->_list) foreach ($this->_list AS $tr) { @@ -452,7 +452,7 @@ class AdminReferrers extends AdminTab { echo ''.(isset($params['prefix']) ? $params['prefix'] : ''); if (isset($tr[$key]) AND isset($params['price'])) - echo Tools::displayPrice($tr[$key], $currency); + echo Tools::displayPrice($tr[$key], $context->currency); elseif (isset($tr[$key])) echo $tr[$key]; else diff --git a/admin-dev/tabs/AdminSearch.php b/admin-dev/tabs/AdminSearch.php index 7964b2358..7a8a9b828 100644 --- a/admin-dev/tabs/AdminSearch.php +++ b/admin-dev/tabs/AdminSearch.php @@ -190,7 +190,6 @@ class AdminSearch extends AdminTab { $context = Context::getContext(); self::$currentIndex = 'index.php'; - $currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT')); $query = trim(Tools::getValue('bo_query')); $nbCategories = $nbProducts = $nbCustomers = 0; @@ -223,7 +222,7 @@ class AdminSearch extends AdminTab '.($product['manufacturer_name'] != NULL ? stripslashes($product['manufacturer_name']) : '--').' '.$product['reference'].' '.stripslashes($product['nameh']).' - '.Tools::displayPrice($product['price'], $currency).' + '.Tools::displayPrice($product['price'], $context->currency).' '.stripslashes($product['tax_name']).' '.$product['quantity'].' '.$product['weight'].' '.Configuration::get('PS_WEIGHT_UNIT').' diff --git a/admin-dev/tabs/AdminShipping.php b/admin-dev/tabs/AdminShipping.php index 85452f514..d6aa54931 100644 --- a/admin-dev/tabs/AdminShipping.php +++ b/admin-dev/tabs/AdminShipping.php @@ -33,11 +33,9 @@ class AdminShipping extends AdminTab public function __construct() { $this->table = 'delivery'; - $currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT')); - $this->_fieldsHandling = array( - 'PS_SHIPPING_HANDLING' => array('title' => $this->l('Handling charges'), 'suffix' => $currency, 'validation' => 'isPrice', 'cast' => 'floatval'), - 'PS_SHIPPING_FREE_PRICE' => array('title' => $this->l('Free shipping starts at'), 'suffix' => $currency, 'validation' => 'isPrice', 'cast' => 'floatval'), + 'PS_SHIPPING_HANDLING' => array('title' => $this->l('Handling charges'), 'suffix' => $context->currency, 'validation' => 'isPrice', 'cast' => 'floatval'), + 'PS_SHIPPING_FREE_PRICE' => array('title' => $this->l('Free shipping starts at'), 'suffix' => $context->currency, 'validation' => 'isPrice', 'cast' => 'floatval'), 'PS_SHIPPING_FREE_WEIGHT' => array('title' => $this->l('Free shipping starts at'), 'suffix' => Configuration::get('PS_WEIGHT_UNIT'), 'validation' => 'isUnsignedFloat', 'cast' => 'floatval'), 'PS_SHIPPING_METHOD' => array('title' => $this->l('Billing'), 'validation' => 'isBool', 'cast' => 'intval')); @@ -193,7 +191,7 @@ class AdminShipping extends AdminTab { $carrierArray = array(); $id_carrier = Tools::getValue('id_carrier'); - $carriers = Carrier::getCarriers((int)(Configuration::get('PS_LANG_DEFAULT')), true , false,false, NULL, PS_CARRIERS_AND_CARRIER_MODULES_NEED_RANGE); + $carriers = Carrier::getCarriers(Configuration::get('PS_LANG_DEFAULT'), true , false,false, NULL, PS_CARRIERS_AND_CARRIER_MODULES_NEED_RANGE); foreach ($carriers AS $carrier) if (!$carrier['is_free']) $carrierArray[] = array( @@ -227,8 +225,7 @@ class AdminShipping extends AdminTab '.$this->l('Zone / Range').''; - $currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT')); - + $currency = $context->currency; $rangeObj = $carrierSelected->getRangeObject(); $rangeTable = $carrierSelected->getRangeTable(); $suffix = $carrierSelected->getRangeSuffix(); diff --git a/admin-dev/tabs/AdminTracking.php b/admin-dev/tabs/AdminTracking.php index b72234c3d..532d101b6 100644 --- a/admin-dev/tabs/AdminTracking.php +++ b/admin-dev/tabs/AdminTracking.php @@ -149,7 +149,6 @@ class AdminTracking extends AdminTab 'status' => array('title' => $this->l('Status')), 'action' => array('title' => $this->l('Actions')) )); - $currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT')); echo ' '; @@ -169,7 +168,7 @@ class AdminTracking extends AdminTab - + @@ -209,7 +208,6 @@ class AdminTracking extends AdminTab 'action' => array('title' => $this->l('Actions')) )); - $currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT')); echo '
'.($product->manufacturer_name != NULL ? stripslashes($product->manufacturer_name) : '--').' '.$product->reference.' '.stripslashes($product->name).''.Tools::displayPrice($product->getPrice(), $currency).''.Tools::displayPrice($product->getPrice(), $context->currency).' '.(float)$taxrate.'% '.$product->quantity.' '.$product->weight.' '.Configuration::get('PS_WEIGHT_UNIT').'
'; @@ -241,7 +239,7 @@ class AdminTracking extends AdminTab - + diff --git a/classes/AdminTab.php b/classes/AdminTab.php index 4de023c31..0a7877cc0 100644 --- a/classes/AdminTab.php +++ b/classes/AdminTab.php @@ -1469,8 +1469,6 @@ abstract class AdminTabCore * active : allow to toggle status */ $context = Context::getContext(); - $currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT')); - $id_category = 1; // default categ $irow = 0; @@ -1543,7 +1541,7 @@ abstract class AdminTabCore elseif (isset($params['icon']) AND (isset($params['icon'][$tr[$key]]) OR isset($params['icon']['default']))) echo ''.$tr[$key]).''; elseif (isset($params['price'])) - echo Tools::displayPrice($tr[$key], (isset($params['currency']) ? Currency::getCurrencyInstance((int)($tr['id_currency'])) : $currency), false); + echo Tools::displayPrice($tr[$key], (isset($params['currency']) ? Currency::getCurrencyInstance($tr['id_currency']) : $context->currency), false); elseif (isset($params['float'])) echo rtrim(rtrim($tr[$key], '0'), '.'); elseif (isset($params['type']) AND $params['type'] == 'date') diff --git a/classes/Carrier.php b/classes/Carrier.php index 27cfe1bad..240888516 100644 --- a/classes/Carrier.php +++ b/classes/Carrier.php @@ -684,14 +684,13 @@ class CarrierCore extends ObjectModel return false; } - public function getRangeSuffix() + public function getRangeSuffix($context = null) { + if (!$context) + $context = Context::getContext(); $suffix = Configuration::get('PS_WEIGHT_UNIT'); if ($this->getShippingMethod() == Carrier::SHIPPING_METHOD_PRICE) - { - $currency = new Currency(Configuration::get('PS_CURRENCY_DEFAULT')); - $suffix = $currency->sign; - } + $suffix = $context->currency->sign; return $suffix; } diff --git a/classes/Context.php b/classes/Context.php index 3273d67b3..5b8d8ea0b 100644 --- a/classes/Context.php +++ b/classes/Context.php @@ -65,6 +65,9 @@ class ContextCore /** @var Shop */ public $shop; + + /** @var Smarty */ + public $smarty; /** * Get a singleton context diff --git a/classes/Currency.php b/classes/Currency.php index 915454802..3028acd20 100644 --- a/classes/Currency.php +++ b/classes/Currency.php @@ -366,7 +366,7 @@ class CurrencyCore extends ObjectModel static public function getCurrencyInstance($id) { if (!array_key_exists($id, self::$currencies)) - self::$currencies[(int)($id)] = new Currency((int)($id)); + self::$currencies[(int)($id)] = new Currency($id); return self::$currencies[(int)($id)]; } } diff --git a/classes/FrontController.php b/classes/FrontController.php index 46e9afbb7..e902e4ba4 100755 --- a/classes/FrontController.php +++ b/classes/FrontController.php @@ -138,7 +138,7 @@ class FrontControllerCore /* Cart already exists */ if ((int)$cookie->id_cart) { - $cart = new Cart((int)$cookie->id_cart); + $cart = new Cart($cookie->id_cart); if ($cart->OrderExists()) unset($cookie->id_cart, $cart, $cookie->checkedTOS); /* Delete product of cart, if user can't make an order from his country */ diff --git a/classes/Module.php b/classes/Module.php index 6e9718902..9c684c671 100644 --- a/classes/Module.php +++ b/classes/Module.php @@ -1084,16 +1084,16 @@ abstract class ModuleCore $previousTemplate = $context->smarty->currentTemplate; $context->smarty->currentTemplate = substr(basename($template), 0, -4); } - $context->controller->smarty->assign('module_dir', __PS_BASE_URI__.'modules/'.basename($file, '.php').'/'); + $context->smarty->assign('module_dir', __PS_BASE_URI__.'modules/'.basename($file, '.php').'/'); if (($overloaded = self::_isTemplateOverloadedStatic(basename($file, '.php'), $template)) === NULL) $result = Tools::displayError('No template found for module').' '.basename($file,'.php'); else { - $context->controller->smarty->assign('module_template_dir', ($overloaded ? _THEME_DIR_ : __PS_BASE_URI__).'modules/'.basename($file, '.php').'/'); - $result = $context->controller->smarty->fetch(($overloaded ? _PS_THEME_DIR_.'modules/'.basename($file, '.php') : _PS_MODULE_DIR_.basename($file, '.php')).'/'.$template, $cacheId, $compileId); + $context->smarty->assign('module_template_dir', ($overloaded ? _THEME_DIR_ : __PS_BASE_URI__).'modules/'.basename($file, '.php').'/'); + $result = $context->smarty->fetch(($overloaded ? _PS_THEME_DIR_.'modules/'.basename($file, '.php') : _PS_MODULE_DIR_.basename($file, '.php')).'/'.$template, $cacheId, $compileId); } if (Configuration::get('PS_FORCE_SMARTY_2')) /* Keep a backward compatibility for Smarty v2 */ - $context->controller->smarty->currentTemplate = $previousTemplate; + $context->smarty->currentTemplate = $previousTemplate; return $result; } @@ -1108,10 +1108,10 @@ abstract class ModuleCore /* Use Smarty 3 API calls */ if (!Configuration::get('PS_FORCE_SMARTY_2')) /* PHP version > 5.1.2 */ - return $context->controller->smarty->isCached($this->_getApplicableTemplateDir($template).$template, $cacheId, $compileId); + return $context->smarty->isCached($this->_getApplicableTemplateDir($template).$template, $cacheId, $compileId); /* or keep a backward compatibility if PHP version < 5.1.2 */ else - return $context->controller->smarty->is_cached($this->_getApplicableTemplateDir($template).$template, $cacheId, $compileId); + return $context->smarty->is_cached($this->_getApplicableTemplateDir($template).$template, $cacheId, $compileId); } protected function _clearCache($template, $cacheId = NULL, $compileId = NULL) diff --git a/config/config.inc.php b/config/config.inc.php index 97e7272a9..9c8a437b8 100644 --- a/config/config.inc.php +++ b/config/config.inc.php @@ -122,6 +122,7 @@ if (function_exists('date_default_timezone_set')) /* Smarty */ require_once(dirname(__FILE__).'/smarty.config.inc.php'); +Context::getContext()->smarty = $smarty; /* Possible value are true, false, 'URL' (for 'URL' append SMARTY_DEBUG as a parameter to the url) default is false for production environment */ diff --git a/controllers/AddressController.php b/controllers/AddressController.php index 765d117a6..5c32cf0ce 100644 --- a/controllers/AddressController.php +++ b/controllers/AddressController.php @@ -45,7 +45,7 @@ class AddressControllerCore extends FrontController public function preProcess() { parent::preProcess(); - + $context = Context::getContext(); if ($back = Tools::getValue('back')) $this->smarty->assign('back', Tools::safeOutput($back)); if ($mod = Tools::getValue('mod')) @@ -202,11 +202,10 @@ class AddressControllerCore extends FrontController } elseif (!$id_address) { - $customer = new Customer((int)(self::$cookie->id_customer)); - if (Validate::isLoadedObject($customer)) + if (Validate::isLoadedObject($context->customer)) { - $_POST['firstname'] = $customer->firstname; - $_POST['lastname'] = $customer->lastname; + $_POST['firstname'] = $context->customer->firstname; + $_POST['lastname'] = $context->customer->lastname; } } if (Tools::isSubmit('ajax') AND sizeof($this->errors)) diff --git a/controllers/AddressesController.php b/controllers/AddressesController.php index 25e71e894..cc30e2893 100644 --- a/controllers/AddressesController.php +++ b/controllers/AddressesController.php @@ -50,15 +50,15 @@ class AddressesControllerCore extends FrontController $multipleAddressesFormated = array(); $ordered_fields = array(); - $customer = new Customer((int)(self::$cookie->id_customer)); - + $customer = $context->customer; + if (!Validate::isLoadedObject($customer)) die(Tools::displayError('Customer not found')); // Retro Compatibility Theme < 1.4.1 - $this->smarty->assign('addresses', $customer->getAddresses((int)(self::$cookie->id_lang))); + $this->smarty->assign('addresses', $customer->getAddresses($context->language->id)); - $customerAddressesDetailed = $customer->getAddresses((int)(self::$cookie->id_lang)); + $customerAddressesDetailed = $customer->getAddresses($context->language->id); $total = 0; foreach($customerAddressesDetailed as $addressDetailed) @@ -74,12 +74,12 @@ class AddressesControllerCore extends FrontController ++$total; // Retro theme < 1.4.2 - $ordered_fields = AddressFormat::getOrderedAddressFields($addressDetailed['id_country']); + $ordered_fields = AddressFormat::getOrderedAddressFields($addressDetailed['id_country']); } // Retro theme 1.4.2 - if (($key = array_search('Country:name', $ordered_fields))) - $ordered_fields[$key] = 'country'; + if (($key = array_search('Country:name', $ordered_fields))) + $ordered_fields[$key] = 'country'; $this->smarty->assign('addresses_style', array( 'company' => 'address_company' @@ -98,7 +98,6 @@ class AddressesControllerCore extends FrontController $this->smarty->assign(array( 'multipleAddresses' => $multipleAddressesFormated, 'ordered_fields' => $ordered_fields)); - unset($customer); } public function displayContent() diff --git a/controllers/CartController.php b/controllers/CartController.php index 9da4bdf29..3d0c22863 100644 --- a/controllers/CartController.php +++ b/controllers/CartController.php @@ -31,6 +31,7 @@ class CartControllerCore extends FrontController { $this->init(); $this->preProcess(); + $context = Context::getContext(); if (Tools::getValue('ajax') == 'true') { @@ -38,15 +39,12 @@ class CartControllerCore extends FrontController { if (Configuration::get('PS_ORDER_PROCESS_TYPE') == 1) { - if (self::$cookie->id_customer) - { - $customer = new Customer((int)(self::$cookie->id_customer)); - $groups = $customer->getGroups(); - } + if (Validate::isLoadedObject($context->customer)) + $groups = $context->customer->getGroups(); else $groups = array(1); if ((int)self::$cart->id_address_delivery) - $deliveryAddress = new Address((int)self::$cart->id_address_delivery); + $deliveryAddress = new Address(self::$cart->id_address_delivery); $result = array('carriers' => Carrier::getCarriersForOrder((int)Country::getIdZone((isset($deliveryAddress) AND (int)$deliveryAddress->id) ? (int)$deliveryAddress->id_country : (int)Configuration::get('PS_COUNTRY_DEFAULT')), $groups)); } $result['summary'] = self::$cart->getSummaryDetails(); diff --git a/modules/authorizeaim/authorizeaim.php b/modules/authorizeaim/authorizeaim.php index b05b95bf9..b45cdd7e1 100755 --- a/modules/authorizeaim/authorizeaim.php +++ b/modules/authorizeaim/authorizeaim.php @@ -71,9 +71,9 @@ class authorizeAIM extends PaymentModule return; if ($params['objOrder']->getCurrentState() != _PS_OS_ERROR_) - $context->controller->smarty->assign(array('status' => 'ok', 'id_order' => intval($params['objOrder']->id))); + $context->smarty->assign(array('status' => 'ok', 'id_order' => intval($params['objOrder']->id))); else - $context->controller->smarty->assign('status', 'failed'); + $context->smarty->assign('status', 'failed'); return $this->display(__FILE__, 'hookorderconfirmation.tpl'); } @@ -167,9 +167,9 @@ class authorizeAIM extends PaymentModule $cards['discover'] = Configuration::get('AUTHORIZE_AIM_CARD_DISCOVER') == 'on' ? 1 : 0; $cards['ax'] = Configuration::get('AUTHORIZE_AIM_CARD_AX') == 'on' ? 1 : 0; - $context->controller->smarty->assign('p', $authorizeAIMParams); - $context->controller->smarty->assign('cards', $cards); - $context->controller->smarty->assign('isFailed', $isFailed); + $context->smarty->assign('p', $authorizeAIMParams); + $context->smarty->assign('cards', $cards); + $context->smarty->assign('isFailed', $isFailed); return $this->display(__FILE__, 'authorizeaim.tpl'); } diff --git a/modules/bankwire/bankwire.php b/modules/bankwire/bankwire.php index 6f2aa4b5b..0374a8919 100644 --- a/modules/bankwire/bankwire.php +++ b/modules/bankwire/bankwire.php @@ -171,7 +171,7 @@ class BankWire extends PaymentModule $context = Context::getContext(); - $context->controller->smarty->assign(array( + $context->smarty->assign(array( 'nbProducts' => $cart->nbProducts(), 'cust_currency' => $cart->id_currency, 'currencies' => $this->getCurrency((int)$cart->id_currency), @@ -192,7 +192,7 @@ class BankWire extends PaymentModule $context = Context::getContext(); - $context->controller->smarty->assign(array( + $context->smarty->assign(array( 'this_path' => $this->_path, 'this_path_ssl' => Tools::getShopDomainSsl(true, true).__PS_BASE_URI__.'modules/'.$this->name.'/' )); @@ -207,7 +207,7 @@ class BankWire extends PaymentModule $context = Context::getContext(); $state = $params['objOrder']->getCurrentState(); if ($state == _PS_OS_BANKWIRE_ OR $state == _PS_OS_OUTOFSTOCK_) - $context->controller->smarty->assign(array( + $context->smarty->assign(array( 'total_to_pay' => Tools::displayPrice($params['total_to_pay'], $params['currencyObj'], false), 'bankwireDetails' => nl2br2($this->details), 'bankwireAddress' => nl2br2($this->address), @@ -216,7 +216,7 @@ class BankWire extends PaymentModule 'id_order' => $params['objOrder']->id )); else - $context->controller->smarty->assign('status', 'failed'); + $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 6096f09ab..57ab447c3 100644 --- a/modules/blockadvertising/blockadvertising.php +++ b/modules/blockadvertising/blockadvertising.php @@ -210,9 +210,9 @@ class BlockAdvertising extends Module { $context = Context::getContext(); $context->controller->addCSS($this->_path.'blockadvertising.css', 'all'); - $context->controller->smarty->assign('image', $context->link->protocol_content.$this->adv_img); - $context->controller->smarty->assign('adv_link', $this->adv_link); - $context->controller->smarty->assign('adv_title', $this->adv_title); + $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); return $this->display(__FILE__, 'blockadvertising.tpl'); } diff --git a/modules/blockbestsellers/blockbestsellers.php b/modules/blockbestsellers/blockbestsellers.php index 7c3c72b70..602bac997 100644 --- a/modules/blockbestsellers/blockbestsellers.php +++ b/modules/blockbestsellers/blockbestsellers.php @@ -110,7 +110,7 @@ class BlockBestSellers extends Module $bestseller['price'] = Tools::displayPrice(Product::getPriceStatic((int)($bestseller['id_product'])), $currency); $best_sellers[] = $bestseller; } - $context->controller->smarty->assign(array( + $context->smarty->assign(array( 'best_sellers' => $best_sellers, 'mediumSize' => Image::getSize('medium'))); return $this->display(__FILE__, 'blockbestsellers.tpl'); diff --git a/modules/blockcart/blockcart.php b/modules/blockcart/blockcart.php index a544aa6ee..5f68f7872 100644 --- a/modules/blockcart/blockcart.php +++ b/modules/blockcart/blockcart.php @@ -161,8 +161,8 @@ class BlockCart extends Module return; $context = Context::getContext(); - $context->controller->smarty->assign('order_page', strpos($_SERVER['PHP_SELF'], 'order') !== false); - $this->smartyAssigns($context->controller->smarty, $params); + $context->smarty->assign('order_page', strpos($_SERVER['PHP_SELF'], 'order') !== false); + $this->smartyAssigns($context->smarty, $params); return $this->display(__FILE__, 'blockcart.tpl'); } @@ -177,7 +177,7 @@ class BlockCart extends Module return; $context = Context::getContext(); - $this->smartyAssigns($context->controller->smarty, $params); + $this->smartyAssigns($context->smarty, $params); $res = $this->display(__FILE__, 'blockcart-json.tpl'); return $res; } diff --git a/modules/blockcategories/blockcategories.php b/modules/blockcategories/blockcategories.php index e3b2e3011..0a63f4ebc 100644 --- a/modules/blockcategories/blockcategories.php +++ b/modules/blockcategories/blockcategories.php @@ -186,11 +186,10 @@ class BlockCategories extends Module 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->controller->smarty->assign('currentCategoryId', $context->cookie->last_visited_category); + $context->smarty->assign('currentCategoryId', $context->cookie->last_visited_category); } if (Tools::isSubmit('id_product')) { @@ -200,17 +199,17 @@ class BlockCategories extends Module if (isset($product) AND Validate::isLoadedObject($product)) $context->cookie->last_visited_category = (int)($product->id_category_default); } - $context->controller->smarty->assign('currentCategoryId', (int)($context->cookie->last_visited_category)); + $context->smarty->assign('currentCategoryId', (int)($context->cookie->last_visited_category)); } - $context->controller->smarty->assign('blockCategTree', $blockCategTree); + $context->smarty->assign('blockCategTree', $blockCategTree); if (file_exists(_PS_THEME_DIR_.'modules/blockcategories/blockcategories.tpl')) - $context->controller->smarty->assign('branche_tpl_path', _PS_THEME_DIR_.'modules/blockcategories/category-tree-branch.tpl'); + $context->smarty->assign('branche_tpl_path', _PS_THEME_DIR_.'modules/blockcategories/category-tree-branch.tpl'); else - $context->controller->smarty->assign('branche_tpl_path', _PS_MODULE_DIR_.'blockcategories/category-tree-branch.tpl'); - $context->controller->smarty->assign('isDhtml', $isDhtml); + $context->smarty->assign('branche_tpl_path', _PS_MODULE_DIR_.'blockcategories/category-tree-branch.tpl'); + $context->smarty->assign('isDhtml', $isDhtml); } - $context->controller->smarty->cache_lifetime = 31536000; // 1 Year + $context->smarty->cache_lifetime = 31536000; // 1 Year $display = $this->display(__FILE__, 'blockcategories.tpl', $smartyCacheId); Tools::restoreCacheSettings(); return $display; @@ -258,8 +257,8 @@ class BlockCategories extends Module $nbrColumns=3; $numberColumn = abs(sizeof($result)/$nbrColumns); $widthColumn= floor(100/$nbrColumns); - $context->controller->smarty->assign('numberColumn', $numberColumn); - $context->controller->smarty->assign('widthColumn', $widthColumn); + $context->smarty->assign('numberColumn', $numberColumn); + $context->smarty->assign('widthColumn', $widthColumn); $blockCategTree = $this->getTree($resultParents, $resultIds, Configuration::get('BLOCK_CATEG_MAX_DEPTH')); unset($resultParents); @@ -274,7 +273,7 @@ class BlockCategories extends Module if (Tools::isSubmit('id_category')) { $context->cookie->last_visited_category = $id_category; - $context->controller->smarty->assign('currentCategoryId', $context->cookie->last_visited_category); + $context->smarty->assign('currentCategoryId', $context->cookie->last_visited_category); } if (Tools::isSubmit('id_product')) { @@ -284,17 +283,17 @@ class BlockCategories extends Module if (isset($product) AND Validate::isLoadedObject($product)) $context->cookie->last_visited_category = (int)($product->id_category_default); } - $context->controller->smarty->assign('currentCategoryId', (int)($context->cookie->last_visited_category)); + $context->smarty->assign('currentCategoryId', (int)($context->cookie->last_visited_category)); } - $context->controller->smarty->assign('blockCategTree', $blockCategTree); + $context->smarty->assign('blockCategTree', $blockCategTree); if (file_exists(_PS_THEME_DIR_.'modules/blockcategories/blockcategories_footer.tpl')) - $context->controller->smarty->assign('branche_tpl_path', _PS_THEME_DIR_.'modules/blockcategories/category-tree-branch.tpl'); + $context->smarty->assign('branche_tpl_path', _PS_THEME_DIR_.'modules/blockcategories/category-tree-branch.tpl'); else - $context->controller->smarty->assign('branche_tpl_path', _PS_MODULE_DIR_.'blockcategories/category-tree-branch.tpl'); - $context->controller->smarty->assign('isDhtml', $isDhtml); + $context->smarty->assign('branche_tpl_path', _PS_MODULE_DIR_.'blockcategories/category-tree-branch.tpl'); + $context->smarty->assign('isDhtml', $isDhtml); } - $context->controller->smarty->cache_lifetime = 31536000; // 1 Year + $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 93f1f26cb..7f02a8cb0 100755 --- a/modules/blockcms/blockcms.php +++ b/modules/blockcms/blockcms.php @@ -703,7 +703,7 @@ class BlockCms extends Module { $context = Context::getContext(); $cms_titles = self::getCMStitles(self::LEFT_COLUMN); - $context->controller->smarty->assign(array( + $context->smarty->assign(array( 'block' => 1, 'cms_titles' => $cms_titles, 'theme_dir' => _PS_THEME_DIR_ @@ -716,7 +716,7 @@ class BlockCms extends Module $context = Context::getContext(); $cms_titles = self::getCMStitles(self::RIGHT_COLUMN); - $context->controller->smarty->assign(array( + $context->smarty->assign(array( 'block' => 1, 'cms_titles' => $cms_titles, 'theme_dir' => _PS_THEME_DIR_ @@ -731,7 +731,7 @@ class BlockCms extends Module if (Configuration::get('FOOTER_BLOCK_ACTIVATION')) { $cms_titles = self::getCMStitlesFooter(); - $context->controller->smarty->assign(array( + $context->smarty->assign(array( 'block' => 0, 'cmslinks' => $cms_titles, 'theme_dir' => _PS_THEME_DIR_, diff --git a/modules/blockcurrencies/blockcurrencies.php b/modules/blockcurrencies/blockcurrencies.php index 0983b1e18..c177e68e8 100644 --- a/modules/blockcurrencies/blockcurrencies.php +++ b/modules/blockcurrencies/blockcurrencies.php @@ -63,7 +63,7 @@ class BlockCurrencies extends Module $currencies = Currency::getCurrencies(false, 1, $this->context->shop->getID()); if (!sizeof($currencies)) return ''; - $this->context->controller->smarty->assign('currencies', $currencies); + $this->context->smarty->assign('currencies', $currencies); return $this->display(__FILE__, 'blockcurrencies.tpl'); } diff --git a/modules/blocklanguages/blocklanguages.php b/modules/blocklanguages/blocklanguages.php index 3821d75fd..41bf11c76 100644 --- a/modules/blocklanguages/blocklanguages.php +++ b/modules/blocklanguages/blocklanguages.php @@ -60,7 +60,7 @@ class BlockLanguages extends Module $languages = Language::getLanguages(true, $this->context->shop->getID()); if (!sizeof($languages)) return ''; - $this->context->controller->smarty->assign('languages', $languages); + $this->context->smarty->assign('languages', $languages); return $this->display(__FILE__, 'blocklanguages.tpl'); } diff --git a/modules/blocklayered/blocklayered.php b/modules/blocklayered/blocklayered.php index ff26abdf4..68b5b94c1 100644 --- a/modules/blocklayered/blocklayered.php +++ b/modules/blocklayered/blocklayered.php @@ -715,7 +715,7 @@ class BlockLayered extends Module $share_url = $context->link->getCategoryLink((int)$category->id, $category->link_rewrite[(int)$context->language->id], $context->language->id).rtrim($params, '&'); - $context->controller->smarty->assign(array( + $context->smarty->assign(array( 'display_share' => (int)Configuration::get('PS_LAYERED_SHARE'), 'share_url' => $this->getShortLink($share_url), 'layered_use_checkboxes' => (int)Configuration::get('PS_LAYERED_NAVIGATION_CHECKBOXES'), @@ -756,7 +756,7 @@ class BlockLayered extends Module if ($stop > $pages_nb) $stop = (int)($pages_nb); - $context->controller->smarty->assign('nb_products', $nbProducts); + $context->smarty->assign('nb_products', $nbProducts); $pagination_infos = array( 'pages_nb' => (int)($pages_nb), 'p' => (int)($p), @@ -766,15 +766,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->controller->smarty->assign($pagination_infos); + $context->smarty->assign($pagination_infos); - $context->controller->smarty->assign('products', $products); + $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->controller->smarty->fetch(_PS_THEME_DIR_.'product-list.tpl'), - 'pagination' => $context->controller->smarty->fetch(_PS_THEME_DIR_.'pagination.tpl') + 'productList' => $context->smarty->fetch(_PS_THEME_DIR_.'product-list.tpl'), + 'pagination' => $context->smarty->fetch(_PS_THEME_DIR_.'pagination.tpl') )); // return '
'.$this->generateFiltersBlock($selectedFilters).'
'.$smarty->fetch(_PS_THEME_DIR_.'product-list.tpl').'
'; } diff --git a/modules/blocklink/blocklink.php b/modules/blocklink/blocklink.php index a1bd03db3..cb121a08d 100644 --- a/modules/blocklink/blocklink.php +++ b/modules/blocklink/blocklink.php @@ -86,7 +86,7 @@ class BlockLink extends Module $context = Context::getContext(); $links = $this->getLinks(); - $context->controller->smarty->assign(array( + $context->smarty->assign(array( 'blocklink_links' => $links, 'title' => Configuration::get('PS_BLOCKLINK_TITLE', $context->language->id), 'url' => Configuration::get('PS_BLOCKLINK_URL'), diff --git a/modules/blockmanufacturer/blockmanufacturer.php b/modules/blockmanufacturer/blockmanufacturer.php index 0d1d4399f..22d44fc25 100644 --- a/modules/blockmanufacturer/blockmanufacturer.php +++ b/modules/blockmanufacturer/blockmanufacturer.php @@ -56,7 +56,7 @@ class BlockManufacturer extends Module { $context = Context::getContext(); //$getNbProducts = false, $id_lang = 0, $active = true, $p = false, $n = false, $all_group = false, $id_shop = false - $context->controller->smarty->assign(array( + $context->smarty->assign(array( 'manufacturers' => Manufacturer::getManufacturers(false, 0, true, false, false, false, $this->context->shop->getGroupID()), 'link' => $context->link, 'text_list' => Configuration::get('MANUFACTURER_DISPLAY_TEXT'), diff --git a/modules/blockmyaccount/blockmyaccount.php b/modules/blockmyaccount/blockmyaccount.php index 39d2b7933..15214fa6b 100644 --- a/modules/blockmyaccount/blockmyaccount.php +++ b/modules/blockmyaccount/blockmyaccount.php @@ -61,7 +61,7 @@ class BlockMyAccount extends Module $context = Context::getContext(); if (!$params['cookie']->isLogged()) return false; - $context->controller->smarty->assign(array( + $context->smarty->assign(array( 'voucherAllowed' => (int)(Configuration::get('PS_VOUCHERS')), 'returnAllowed' => (int)(Configuration::get('PS_ORDER_RETURN')), 'HOOK_BLOCK_MY_ACCOUNT' => Module::hookExec('myAccountBlock') diff --git a/modules/blocknewproducts/blocknewproducts.php b/modules/blocknewproducts/blocknewproducts.php index 40a3d8624..dd55118f7 100644 --- a/modules/blocknewproducts/blocknewproducts.php +++ b/modules/blocknewproducts/blocknewproducts.php @@ -100,7 +100,7 @@ class BlockNewProducts extends Module $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->controller->smarty->assign(array('new_products' => $newProducts, 'mediumSize' => Image::getSize('medium'))); + $context->smarty->assign(array('new_products' => $newProducts, 'mediumSize' => Image::getSize('medium'))); return $this->display(__FILE__, 'blocknewproducts.tpl'); } diff --git a/modules/blocknewsletter/blocknewsletter.php b/modules/blocknewsletter/blocknewsletter.php index 9909d5847..268324f01 100644 --- a/modules/blocknewsletter/blocknewsletter.php +++ b/modules/blocknewsletter/blocknewsletter.php @@ -242,7 +242,7 @@ class Blocknewsletter extends Module $this->newsletterRegistration(); if ($this->error) { - $context->controller->smarty->assign(array('color' => 'red', + $context->smarty->assign(array('color' => 'red', 'msg' => $this->error, 'nw_value' => isset($_POST['email']) ? pSQL($_POST['email']) : false, 'nw_error' => true, @@ -252,12 +252,12 @@ 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->controller->smarty->assign(array('color' => 'green', + $context->smarty->assign(array('color' => 'green', 'msg' => $this->valid, 'nw_error' => false)); } } - $context->controller->smarty->assign('this_path', $this->_path); + $context->smarty->assign('this_path', $this->_path); return $this->display(__FILE__, 'blocknewsletter.tpl'); } diff --git a/modules/blockpaymentlogo/blockpaymentlogo.php b/modules/blockpaymentlogo/blockpaymentlogo.php index d91966fa1..22d66f3ef 100644 --- a/modules/blockpaymentlogo/blockpaymentlogo.php +++ b/modules/blockpaymentlogo/blockpaymentlogo.php @@ -119,7 +119,7 @@ class BlockPaymentLogo extends Module $cms = new CMS(Configuration::get('PS_PAYMENT_LOGO_CMS_ID'), $context->language->id); if (!Validate::isLoadedObject($cms)) return; - $context->controller->smarty->assign('cms_payement_logo', $cms); + $context->smarty->assign('cms_payement_logo', $cms); return $this->display(__FILE__, 'blockpaymentlogo.tpl'); } diff --git a/modules/blockrss/blockrss.php b/modules/blockrss/blockrss.php index f3630150f..f5f8d14a7 100644 --- a/modules/blockrss/blockrss.php +++ b/modules/blockrss/blockrss.php @@ -148,7 +148,7 @@ class Blockrss extends Module $rss_links[] = array('title' => $item->title, 'url' => $item->link); // Display smarty - $context->controller->smarty->assign(array('title' => ($title ? $title : $this->l('RSS feed')), 'rss_links' => $rss_links)); + $context->smarty->assign(array('title' => ($title ? $title : $this->l('RSS feed')), 'rss_links' => $rss_links)); return $this->display(__FILE__, 'blockrss.tpl'); } diff --git a/modules/blocksearch/blocksearch.php b/modules/blocksearch/blocksearch.php index c3d95121a..4a33fc872 100644 --- a/modules/blocksearch/blocksearch.php +++ b/modules/blocksearch/blocksearch.php @@ -82,14 +82,14 @@ class BlockSearch extends Module { $context = Context::getContext(); - $context->controller->smarty->assign('ENT_QUOTES', ENT_QUOTES); - $context->controller->smarty->assign('search_ssl', (int)(!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off')); + $context->smarty->assign('ENT_QUOTES', ENT_QUOTES); + $context->smarty->assign('search_ssl', (int)(!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off')); $ajaxSearch=(int)(Configuration::get('PS_SEARCH_AJAX')); - $context->controller->smarty->assign('ajaxsearch', $ajaxSearch); + $context->smarty->assign('ajaxsearch', $ajaxSearch); $instantSearch = (int)(Configuration::get('PS_INSTANT_SEARCH')); - $context->controller->smarty->assign('instantsearch', $instantSearch); + $context->smarty->assign('instantsearch', $instantSearch); if ($ajaxSearch) { $context->controller->addCSS(_PS_CSS_DIR_.'jquery.autocomplete.css'); diff --git a/modules/blockspecials/blockspecials.php b/modules/blockspecials/blockspecials.php index 9ffa4ad5f..953618b10 100644 --- a/modules/blockspecials/blockspecials.php +++ b/modules/blockspecials/blockspecials.php @@ -88,7 +88,7 @@ class BlockSpecials extends Module if (!$special = Product::getRandomSpecial((int)($params['cookie']->id_lang), false, false, $this->context->shop->getID()) AND !Configuration::get('PS_BLOCK_SPECIALS_DISPLAY')) return; - $this->context->controller->smarty->assign(array( + $this->context->smarty->assign(array( 'special' => $special, 'priceWithoutReduction_tax_excl' => Tools::ps_round($special['price_without_reduction'], 2), 'mediumSize' => Image::getSize('medium') diff --git a/modules/blockstore/blockstore.php b/modules/blockstore/blockstore.php index aa740f5c1..3d52714dd 100644 --- a/modules/blockstore/blockstore.php +++ b/modules/blockstore/blockstore.php @@ -66,7 +66,7 @@ class BlockStore extends Module $context = Context::getContext(); - $context->controller->smarty->assign('store_img', Configuration::get('BLOCKSTORE_IMG')); + $context->smarty->assign('store_img', Configuration::get('BLOCKSTORE_IMG')); return $this->display(__FILE__, 'blockstore.tpl'); } diff --git a/modules/blocksupplier/blocksupplier.php b/modules/blocksupplier/blocksupplier.php index 89e4588e4..6de10179e 100644 --- a/modules/blocksupplier/blocksupplier.php +++ b/modules/blocksupplier/blocksupplier.php @@ -61,7 +61,7 @@ class BlockSupplier extends Module function hookLeftColumn($params) { $context = Context::getContext(); - $context->controller->smarty->assign(array( + $context->smarty->assign(array( 'suppliers' => Supplier::getSuppliers(false), 'link' => $context->link, 'text_list' => Configuration::get('SUPPLIER_DISPLAY_TEXT'), diff --git a/modules/blocktags/blocktags.php b/modules/blocktags/blocktags.php index e2842e3ab..ac10734e0 100644 --- a/modules/blocktags/blocktags.php +++ b/modules/blocktags/blocktags.php @@ -107,7 +107,7 @@ class BlockTags extends Module return false; foreach ($tags AS &$tag) $tag['class'] = 'tag_level'.($tag['times'] > BLOCKTAGS_MAX_LEVEL ? BLOCKTAGS_MAX_LEVEL : $tag['times']); - $context->controller->smarty->assign('tags', $tags); + $context->smarty->assign('tags', $tags); return $this->display(__FILE__, 'blocktags.tpl'); } diff --git a/modules/blockuserinfo/blockuserinfo.php b/modules/blockuserinfo/blockuserinfo.php index 9e8d2ccc3..222bef0fe 100644 --- a/modules/blockuserinfo/blockuserinfo.php +++ b/modules/blockuserinfo/blockuserinfo.php @@ -60,7 +60,7 @@ class BlockUserInfo extends Module if (!$this->active) return; $context = Context::getContext(); - $context->controller->smarty->assign(array( + $context->smarty->assign(array( 'cart' => $context->cart, 'cart_qties' => $context->cart->nbProducts(), 'logged' => $context->cookie->isLogged(), diff --git a/modules/blockviewed/blockviewed.php b/modules/blockviewed/blockviewed.php index 51c4c4281..b217b060f 100644 --- a/modules/blockviewed/blockviewed.php +++ b/modules/blockviewed/blockviewed.php @@ -167,7 +167,7 @@ class BlockViewed extends Module if (!sizeof($productsViewedObj)) return ; - $context->controller->smarty->assign(array( + $context->smarty->assign(array( 'productsViewedObj' => $productsViewedObj, 'mediumSize' => Image::getSize('medium'))); diff --git a/modules/blockwishlist/blockwishlist.php b/modules/blockwishlist/blockwishlist.php index 00aadde8a..4f4cb793a 100644 --- a/modules/blockwishlist/blockwishlist.php +++ b/modules/blockwishlist/blockwishlist.php @@ -196,7 +196,7 @@ class BlockWishList extends Module } else $id_wishlist = $params['cookie']->id_wishlist; - $context->controller->smarty->assign(array( + $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 +204,7 @@ class BlockWishList extends Module 'ptoken' => Tools::getToken(false))); } else - $context->controller->smarty->assign(array('wishlist_products' => false, 'wishlists' => false)); + $context->smarty->assign(array('wishlist_products' => false, 'wishlists' => false)); return ($this->display(__FILE__, 'blockwishlist.tpl')); } @@ -216,7 +216,7 @@ class BlockWishList extends Module public function hookProductActions($params) { $context = Context::getContext(); - $context->controller->smarty->assign('id_product', (int)(Tools::getValue('id_product'))); + $context->smarty->assign('id_product', (int)(Tools::getValue('id_product'))); return ($this->display(__FILE__, 'blockwishlist-extra.tpl')); } diff --git a/modules/carriercompare/carriercompare.php b/modules/carriercompare/carriercompare.php index d0185086e..9689f4080 100755 --- a/modules/carriercompare/carriercompare.php +++ b/modules/carriercompare/carriercompare.php @@ -70,7 +70,7 @@ class CarrierCompare extends Module if ($context->customer->id) return; - $context->controller->smarty->assign(array( + $context->smarty->assign(array( 'countries' => Country::getCountries($context->language->id), 'id_carrier' => ($params['cart']->id_carrier ? $params['cart']->id_carrier : Configuration::get('PS_CARRIER_DEFAULT')), 'id_country' => (isset($context->customer->geoloc_id_country) ? $context->customer->geoloc_id_country : Configuration::get('PS_COUNTRY_DEFAULT')), diff --git a/modules/cashondelivery/cashondelivery.php b/modules/cashondelivery/cashondelivery.php index b51175ea1..d1fb00b46 100644 --- a/modules/cashondelivery/cashondelivery.php +++ b/modules/cashondelivery/cashondelivery.php @@ -67,7 +67,7 @@ class CashOnDelivery extends PaymentModule return false; } - $context->controller->smarty->assign(array( + $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 eb632bda7..a6b93f5e0 100644 --- a/modules/cashticket/PrepaidServices.php +++ b/modules/cashticket/PrepaidServices.php @@ -555,7 +555,7 @@ abstract class PrepaidServices extends PaymentModule if ($amount > $this->max_amount) return false; - $context->controller->smarty->assign(array('pic_url' => _MODULE_DIR_.'/'.$this->name.'/img/payment-logo.png', + $context->smarty->assign(array('pic_url' => _MODULE_DIR_.'/'.$this->name.'/img/payment-logo.png', 'payment_name' => $this->displayName, 'module_name' => $this->name)); @@ -570,7 +570,7 @@ abstract class PrepaidServices extends PaymentModule if ($params['objOrder']->module != $this->name) return; - $context->controller->smarty->assign('payment_name', $this->displayName); + $context->smarty->assign('payment_name', $this->displayName); return $this->display(__FILE__, $this->name.'-confirmation.tpl'); } @@ -598,7 +598,7 @@ abstract class PrepaidServices extends PaymentModule // if the disposition is not "active" if ($res[5] != PrepaidServicesAPI::DISPOSITION_DISPOSED && $res[5] != PrepaidServicesAPI::DISPOSITION_DEBITED) { - $context->controller->smarty->assign(array('disposition_state' => $res[5], 'payment_name' => $order->payment)); + $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 +629,7 @@ abstract class PrepaidServices extends PaymentModule if (Tools::getIsset('pp_error')) $error_msg = $this->_getErrorMsgFromErrorCode(Tools::getValue('pp_error')); - $context->controller->smarty->assign(array('action' => Tools::safeOutput($_SERVER['PHP_SELF']).'?'.$_SERVER['QUERY_STRING'], + $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 08f03e098..9e15387af 100644 --- a/modules/cheque/cheque.php +++ b/modules/cheque/cheque.php @@ -157,7 +157,7 @@ class Cheque extends PaymentModule $context = Context::getContext(); - $context->controller->smarty->assign(array( + $context->smarty->assign(array( 'nbProducts' => $cart->nbProducts(), 'cust_currency' => $cart->id_currency, 'currencies' => $this->getCurrency((int)$cart->id_currency), @@ -180,7 +180,7 @@ class Cheque extends PaymentModule return ; $context = Context::getContext(); - $context->controller->smarty->assign(array( + $context->smarty->assign(array( 'this_path' => $this->_path, 'this_path_ssl' => Tools::getShopDomainSsl(true, true).__PS_BASE_URI__.'modules/'.$this->name.'/' )); @@ -195,7 +195,7 @@ class Cheque extends PaymentModule $context = Context::getContext(); $state = $params['objOrder']->getCurrentState(); if ($state == _PS_OS_CHEQUE_ OR $state == _PS_OS_OUTOFSTOCK_) - $context->controller->smarty->assign(array( + $context->smarty->assign(array( 'total_to_pay' => Tools::displayPrice($params['total_to_pay'], $params['currencyObj'], false), 'chequeName' => $this->chequeName, 'chequeAddress' => nl2br2($this->address), @@ -203,7 +203,7 @@ class Cheque extends PaymentModule 'id_order' => $params['objOrder']->id )); else - $context->controller->smarty->assign('status', 'failed'); + $context->smarty->assign('status', 'failed'); return $this->display(__FILE__, 'payment_return.tpl'); } diff --git a/modules/crossselling/crossselling.php b/modules/crossselling/crossselling.php index f58414637..58f0daaa4 100755 --- a/modules/crossselling/crossselling.php +++ b/modules/crossselling/crossselling.php @@ -143,7 +143,7 @@ class CrossSelling extends Module $orderProduct['displayed_price'] = Product::getPriceStatic((int)$orderProduct['product_id'], false, NULL); } - $context->controller->smarty->assign(array('orderProducts' => $orderProducts, 'middlePosition_crossselling' => round(sizeof($orderProducts) / 2, 0), + $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 45a7fd587..2cbf030ca 100644 --- a/modules/dateofdelivery/dateofdelivery.php +++ b/modules/dateofdelivery/dateofdelivery.php @@ -111,7 +111,7 @@ class DateOfDelivery extends Module foreach ($params['carriers'] as $carrier) $datesDelivery[(int)($carrier['id_carrier'])] = $this->_getDatesOfDelivery((int)($carrier['id_carrier']), $oos); - $context->controller->smarty->assign(array( + $context->smarty->assign(array( 'datesDelivery' => $datesDelivery, 'id_carrier' => ($params['cart']->id_carrier ? (int)($params['cart']->id_carrier) : (int)(Configuration::get('PS_CARRIER_DEFAULT'))) )); @@ -134,7 +134,7 @@ class DateOfDelivery extends Module if (!is_array($datesDelivery) OR !sizeof($datesDelivery)) return ; - $context->controller->smarty->assign('datesDelivery', $datesDelivery); + $context->smarty->assign('datesDelivery', $datesDelivery); return $this->display(__FILE__, 'orderDetail.tpl'); } diff --git a/modules/dejala/dejala.php b/modules/dejala/dejala.php index 1658bae34..f5c61a814 100644 --- a/modules/dejala/dejala.php +++ b/modules/dejala/dejala.php @@ -394,7 +394,7 @@ class Dejala extends CarrierModule { $context = Context::getContext(); - //$context->controller->smarty->assign('country', $this->dejalaConfig->country); + //$context->smarty->assign('country', $this->dejalaConfig->country); $output = $this->display(__FILE__, 'dejala_header.tpl'); if (!empty($_POST)) { @@ -424,14 +424,14 @@ class Dejala extends CarrierModule $errors = array(); $outputMain = ''; - $context->controller->smarty->assign("djl_mode", $this->dejalaConfig->mode); - $context->controller->smarty->assign("disabled", ''); + $context->smarty->assign("djl_mode", $this->dejalaConfig->mode); + $context->smarty->assign("disabled", ''); if ($this->dejalaConfig->mode == 'PROD') - $context->controller->smarty->assign("disabled", 'disabled="disabled"'); + $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->controller->smarty->assign("disabled", 'disabled="disabled"'); + $context->smarty->assign("disabled", 'disabled="disabled"'); } $registered = TRUE; @@ -453,7 +453,7 @@ class Dejala extends CarrierModule } } - $context->controller->smarty->assign("registered", $registered?"1":"0"); + $context->smarty->assign("registered", $registered?"1":"0"); if (!isset($_GET['cat']) || ($_GET['cat']==='home') || ($_GET['cat']==='')) @@ -461,19 +461,19 @@ class Dejala extends CarrierModule else $currentTab=$_GET['cat']; - $context->controller->smarty->assign("currentTab", $currentTab); - $context->controller->smarty->assign("moduleConfigURL", 'index.php?tab=AdminModules&configure=dejala&token='.$_GET['token']); - $context->controller->smarty->assign("formAction", $_SERVER['REQUEST_URI']); + $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']); $outputMenu = $this->display(__FILE__, 'dejala_menu.tpl'); if ($currentTab==='home') { - $context->controller->smarty->assign("login", html_entity_decode(Configuration::get('PS_SHOP_EMAIL'), ENT_COMPAT, 'UTF-8')); + $context->smarty->assign("login", html_entity_decode(Configuration::get('PS_SHOP_EMAIL'), ENT_COMPAT, 'UTF-8')); if ($registered) { - $context->controller->smarty->assign("visibility_status", $this->dejalaConfig->visibility_status); - $context->controller->smarty->assign("visible_users_list", $this->dejalaConfig->visible_users_list); - $context->controller->smarty->assign("store_login", html_entity_decode($this->dejalaConfig->login, ENT_COMPAT, 'UTF-8')); + $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')); $smartifyErrors = $this->smartyfyStoreAttributes(); if (isset($smartifyErrors) && count($smartifyErrors)) $errors = $smartifyErrors; @@ -483,7 +483,7 @@ class Dejala extends CarrierModule $shopName = Configuration::get('PS_SHOP_NAME'); if (strlen($shopName) >= 15) $shopName = substr($shopName, 0, 15); - $context->controller->smarty->assign("store_name", html_entity_decode($shopName, ENT_COMPAT, 'UTF-8')); + $context->smarty->assign("store_name", html_entity_decode($shopName, ENT_COMPAT, 'UTF-8')); } $outputMain = $this->display(__FILE__, 'dejala_home.tpl'); } @@ -496,7 +496,7 @@ class Dejala extends CarrierModule { foreach ($contacts as $contactName=>$contactData) { foreach ($contactData as $key=>$value) { - $context->controller->smarty->assign($contactName.'_'.$key, $value); + $context->smarty->assign($contactName.'_'.$key, $value); } } } @@ -510,7 +510,7 @@ class Dejala extends CarrierModule if ('200' == $responseArray['status']) { foreach ($location as $key=>$value) - $context->controller->smarty->assign($key, $value); + $context->smarty->assign($key, $value); $outputMain = $this->display(__FILE__, 'dejala_location.tpl'); } @@ -523,7 +523,7 @@ class Dejala extends CarrierModule if ('200' == $responseArray['status']) { foreach ($processes as $key=>$value) - $context->controller->smarty->assign($key, $value); + $context->smarty->assign($key, $value); $outputMain = $this->display(__FILE__, 'dejala_processes.tpl'); } @@ -544,7 +544,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->controller->smarty->assign('products', $products); + $context->smarty->assign('products', $products); $outputMain = $this->display(__FILE__, 'dejala_products.tpl'); } } @@ -582,10 +582,10 @@ class Dejala extends CarrierModule $delivery['delivery_time'] = date('H\hi', $delivery['delivery_utc']); } } - $context->controller->smarty->assign('formAction', __PS_BASE_URI__ . 'modules/' . $this->name . '/deliveries_csv.php'); - $context->controller->smarty->assign('defaultDateFrom', date('01/m/Y')); - $context->controller->smarty->assign('defaultDateTo', date('d/m/Y')); - $context->controller->smarty->assign('deliveries', $deliveries); + $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); $outputMain = $this->display(__FILE__, 'dejala_deliveries.tpl'); } } @@ -608,9 +608,9 @@ class Dejala extends CarrierModule $m_status['checked'] = '0'; $orderStatuses[] = $m_status; } - $context->controller->smarty->assign('statuses', $orderStatuses); + $context->smarty->assign('statuses', $orderStatuses); - $context->controller->smarty->assign('trigerringStatuses', $this->dejalaConfig->trigerringStatuses); + $context->smarty->assign('trigerringStatuses', $this->dejalaConfig->trigerringStatuses); $outputMain = $this->display(__FILE__, 'dejala_technical_options.tpl'); } @@ -639,20 +639,20 @@ class Dejala extends CarrierModule $errors[] = $this->l('An error occurred while getting store, please try again later or contact Dejala.com'); else { - $context->controller->smarty->assign("account_balance", $storeAttrs['account_balance']); - $context->controller->smarty->assign("store_name", $storeAttrs['name']); + $context->smarty->assign("account_balance", $storeAttrs['account_balance']); + $context->smarty->assign("store_name", $storeAttrs['name']); // Check if account exists in production $responsePing = $djlUtil->ping($this->dejalaConfig, 'PROD'); if ('200' == $responsePing['status']) - $context->controller->smarty->assign('isLiveReady', '1'); + $context->smarty->assign('isLiveReady', '1'); else { - $context->controller->smarty->assign('isLiveReady', '0'); + $context->smarty->assign('isLiveReady', '0'); if (isset($storeAttrs['attributes']) && isset($storeAttrs['attributes']['request_live']) && ($storeAttrs['attributes']['request_live']=='true')) - $context->controller->smarty->assign('isLiveRequested', '1'); + $context->smarty->assign('isLiveRequested', '1'); else - $context->controller->smarty->assign('isLiveRequested', '0'); + $context->smarty->assign('isLiveRequested', '0'); } } return ($errors); @@ -682,26 +682,26 @@ class Dejala extends CarrierModule $response = $djlUtil->getStoreAttributes($this->dejalaConfig, $store); if ($response['status'] == 200) { - $context->controller->smarty->assign('nb_days', $store['attributes']['nb_days_displayed']); - $context->controller->smarty->assign('delivery_delay', $store['attributes']['delivery_delay']); + $context->smarty->assign('nb_days', $store['attributes']['nb_days_displayed']); + $context->smarty->assign('delivery_delay', $store['attributes']['delivery_delay']); if (isset($store['attributes']['delivery_partial'])) - $context->controller->smarty->assign('delivery_partial', $store['attributes']['delivery_partial']); + $context->smarty->assign('delivery_partial', $store['attributes']['delivery_partial']); } $wday_selected = array(1, 1, 1, 1, 1, 1, 1); - $context->controller->smarty->assign('timetable_css', _MODULE_DIR_.$this->name.'/timetable.css'); - $context->controller->smarty->assign("timetable_js", _MODULE_DIR_.$this->name.'/timetable.js'); - $context->controller->smarty->assign("weekdayLabels", $this->wday_labels); - $context->controller->smarty->assign("weekdaySelected", $wday_selected); + $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); $calendar = array(); $response = $djlUtil->getStoreCalendar($this->dejalaConfig, $calendar); if ($response['status'] == 200) { - $context->controller->smarty->assign("calendar", $calendar); - $context->controller->smarty->assign("timetableTpl", dirname(__FILE__)."/dejala_picking_timetable.tpl"); + $context->smarty->assign("calendar", $calendar); + $context->smarty->assign("timetableTpl", dirname(__FILE__)."/dejala_picking_timetable.tpl"); } $output = $output . $this->display(__FILE__, 'dejala_delivery_options.tpl'); @@ -871,8 +871,8 @@ class Dejala extends CarrierModule $this->mylog("date$=" . $this->logValue($dates,1)); - $context->controller->smarty->assign('nb_days', $nbDeliveryDates); - $context->controller->smarty->assign('dates', $dates); + $context->smarty->assign('nb_days', $nbDeliveryDates); + $context->smarty->assign('dates', $dates); for ($i=0; $i < 24; $i++) { $endHour = (($i+$electedProduct['timelimit'])%24); @@ -880,10 +880,10 @@ class Dejala extends CarrierModule $endHour = 24; $hourLabels[] = $i . 'h-' . $endHour . 'h'; } - $context->controller->smarty->assign('hourLabels', $hourLabels); + $context->smarty->assign('hourLabels', $hourLabels); - $context->controller->smarty->assign('timetable_css', _MODULE_DIR_.$this->name.'/timetable.css'); - $context->controller->smarty->assign("timetable_js", _MODULE_DIR_.$this->name.'/timetable.js'); + $context->smarty->assign('timetable_css', _MODULE_DIR_.$this->name.'/timetable.css'); + $context->smarty->assign("timetable_js", _MODULE_DIR_.$this->name.'/timetable.js'); $this->mylog("electedCarrier->id=" . $this->logValue($djlCarrier->id)); $mCarrier = $djlCarrier; @@ -896,9 +896,9 @@ class Dejala extends CarrierModule $resultsArray[] = $row; - $context->controller->smarty->assign('carriers', $resultsArray); - $context->controller->smarty->assign('my_carrier_selected', (isset($cart->id_carrier) && $cart->id_carrier == $djlCarrier->id)) ; - $context->controller->smarty->assign('product', $electedProduct); + $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); $djlCart = new DejalaCart($cart->id); @@ -915,21 +915,21 @@ class Dejala extends CarrierModule { if ($l_date['value'] == $deliveryDateSelected) { - $context->controller->smarty->assign("deliveryDateIndexSelected", $l_key); - $context->controller->smarty->assign("deliveryDateSelected", $deliveryDateSelected); - $context->controller->smarty->assign("deliveryHourSelected", $m_hour); + $context->smarty->assign("deliveryDateIndexSelected", $l_key); + $context->smarty->assign("deliveryDateSelected", $deliveryDateSelected); + $context->smarty->assign("deliveryHourSelected", $m_hour); $setDefaultDate = FALSE; } } } if ($setDefaultDate) { - $context->controller->smarty->assign("deliveryDateIndexSelected", 0); - $context->controller->smarty->assign("deliveryDateSelected", date("Y/m/d", $dateUtc)); - $context->controller->smarty->assign("deliveryHourSelected", (int)(date("H", $dateUtc))); + $context->smarty->assign("deliveryDateIndexSelected", 0); + $context->smarty->assign("deliveryDateSelected", date("Y/m/d", $dateUtc)); + $context->smarty->assign("deliveryHourSelected", (int)(date("H", $dateUtc))); } - $context->controller->smarty->assign("isCartOutOfStock", $isCartOutOfStock); + $context->smarty->assign("isCartOutOfStock", $isCartOutOfStock); if (!$isCartOutOfStock) { $buffer = $this->display(__FILE__, 'dejala_carrier.tpl'); @@ -937,7 +937,7 @@ class Dejala extends CarrierModule } else { - $context->controller->smarty->assign('nostock_info', $this->l('I will select my shipping date when my product is available.')); + $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; diff --git a/modules/ogone/ogone.php b/modules/ogone/ogone.php index 6a44403a2..dd491b961 100644 --- a/modules/ogone/ogone.php +++ b/modules/ogone/ogone.php @@ -190,11 +190,11 @@ class Ogone extends PaymentModule return; if ($params['objOrder']->valid) - $context->controller->smarty->assign(array('status' => 'ok', 'id_order' => $params['objOrder']->id)); + $context->smarty->assign(array('status' => 'ok', 'id_order' => $params['objOrder']->id)); else - $context->controller->smarty->assign('status', 'failed'); + $context->smarty->assign('status', 'failed'); - $context->controller->smarty->assign('ogone_link', (method_exists($link, 'getPageLink') ? $context->link->getPageLink('contact', true) : Tools::getHttpHost(true).'contact')); + $context->smarty->assign('ogone_link', (method_exists($link, 'getPageLink') ? $context->link->getPageLink('contact', true) : Tools::getHttpHost(true).'contact')); return $this->display(dirname(__FILE__), 'hookorderconfirmation.tpl'); } diff --git a/modules/paypal/express/submit.php b/modules/paypal/express/submit.php index 38964cbf2..a57ab4d22 100644 --- a/modules/paypal/express/submit.php +++ b/modules/paypal/express/submit.php @@ -184,7 +184,7 @@ function submitAccount() { if (Mail::Send($context->language->id, 'account', Mail::l('Welcome!'), array('{firstname}' => $customer->firstname, '{lastname}' => $customer->lastname, '{email}' => $customer->email, '{passwd}' => Tools::getValue('passwd')), $customer->email, $customer->firstname.' '.$customer->lastname)) - $context->controller->smarty->assign('confirmation', 1); + $context->smarty->assign('confirmation', 1); $context->cookie->id_customer = (int)($customer->id); $context->cookie->customer_lastname = $customer->lastname; $context->cookie->customer_firstname = $customer->firstname;
'.($prod['manufacturer_name'] != NULL ? stripslashes($prod['manufacturer_name']) : '--').' '.$prod['reference'].' '.stripslashes($prod['name']).' ('.$prod['combination_name'].')'.''.Tools::displayPrice(Product::getPriceStatic((int)($prod['id_product']), true, $prod['id_product_attribute']), $currency).''.Tools::displayPrice(Product::getPriceStatic((int)($prod['id_product']), true, $prod['id_product_attribute']), $context->currency).' '.(float)$taxrate.'% '.$prod['quantity'].' '.($prod['weight'] + $prod['product_weight']).' '.Configuration::get('PS_WEIGHT_UNIT').'