From 58433f18811041b4c28db2829ebb7196ef5e79ef Mon Sep 17 00:00:00 2001 From: rMalie Date: Fri, 30 Dec 2011 14:59:57 +0000 Subject: [PATCH] // Normalize + use $this->smarty instead of $this->context->smarty in modules git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@11944 b9a71923-0436-4b27-9f14-aed3839534dd --- modules/bankwire/bankwire.php | 8 ++--- modules/blockadvertising/blockadvertising.php | 8 +++-- modules/blockbestsellers/blockbestsellers.php | 12 +++---- modules/blockcategories/blockcategories.php | 32 +++++++++---------- modules/blockcurrencies/blockcurrencies.php | 3 +- .../blockcustomerprivacy.php | 2 +- modules/blocklink/blocklink.php | 2 +- modules/blockpaymentlogo/blockpaymentlogo.php | 2 +- modules/blockrss/blockrss.php | 2 +- modules/blocksearch/blocksearch.php | 10 +++--- modules/blockstore/blockstore.php | 6 ++-- modules/blocksupplier/blocksupplier.php | 2 +- modules/blocktags/blocktags.php | 2 +- modules/blockwishlist/blockwishlist.php | 6 ++-- modules/cheque/cheque.php | 8 ++--- modules/crossselling/crossselling.php | 4 +-- modules/dateofdelivery/dateofdelivery.php | 4 +-- modules/editorial/editorial.php | 2 +- modules/favoriteproducts/favoriteproducts.php | 4 +-- modules/feeder/feeder.php | 14 ++++---- modules/homeslider/homeslider.php | 4 +-- modules/loyalty/loyalty.php | 10 +++--- modules/mailalerts/mailalerts.php | 4 +-- modules/productscategory/productscategory.php | 2 +- modules/producttooltip/producttooltip.php | 6 ++-- modules/referralprogram/referralprogram.php | 4 +-- modules/trackingfront/trackingfront.php | 10 +++--- 27 files changed, 87 insertions(+), 86 deletions(-) diff --git a/modules/bankwire/bankwire.php b/modules/bankwire/bankwire.php index dc661dead..6ec4606b1 100644 --- a/modules/bankwire/bankwire.php +++ b/modules/bankwire/bankwire.php @@ -170,7 +170,7 @@ class BankWire extends PaymentModule return ; - $this->context->smarty->assign(array( + $this->smarty->assign(array( 'this_path' => $this->_path, 'this_path_ssl' => Tools::getShopDomainSsl(true, true).__PS_BASE_URI__.'modules/'.$this->name.'/' )); @@ -185,7 +185,7 @@ class BankWire extends PaymentModule $state = $params['objOrder']->getCurrentState(); if ($state == Configuration::get('PS_OS_BANKWIRE') OR $state == Configuration::get('PS_OS_OUTOFSTOCK')) { - $this->context->smarty->assign(array( + $this->smarty->assign(array( 'total_to_pay' => Tools::displayPrice($params['total_to_pay'], $params['currencyObj'], false), 'bankwireDetails' => Tools::nl2br($this->details), 'bankwireAddress' => Tools::nl2br($this->address), @@ -194,10 +194,10 @@ class BankWire extends PaymentModule 'id_order' => $params['objOrder']->id )); if (isset($params['objOrder']->reference) && !empty($params['objOrder']->reference)) - $this->context->smarty->assign('reference', $params['objOrder']->reference); + $this->smarty->assign('reference', $params['objOrder']->reference); } else - $this->context->smarty->assign('status', 'failed'); + $this->smarty->assign('status', 'failed'); return $this->display(__FILE__, 'payment_return.tpl'); } diff --git a/modules/blockadvertising/blockadvertising.php b/modules/blockadvertising/blockadvertising.php index 125c06e9e..536a6de61 100644 --- a/modules/blockadvertising/blockadvertising.php +++ b/modules/blockadvertising/blockadvertising.php @@ -226,9 +226,11 @@ class BlockAdvertising extends Module */ public function hookRightColumn($params) { - $this->context->smarty->assign('image', $this->context->link->protocol_content.$this->adv_img); - $this->context->smarty->assign('adv_link', $this->adv_link); - $this->context->smarty->assign('adv_title', $this->adv_title); + $this->smarty->assign(array( + 'image' => $this->context->link->protocol_content.$this->adv_img, + 'adv_link' => $this->adv_link, + 'adv_title' => $this->adv_title, + )); return $this->display(__FILE__, 'blockadvertising.tpl'); } diff --git a/modules/blockbestsellers/blockbestsellers.php b/modules/blockbestsellers/blockbestsellers.php index e204bf5d2..f97b68772 100644 --- a/modules/blockbestsellers/blockbestsellers.php +++ b/modules/blockbestsellers/blockbestsellers.php @@ -113,7 +113,7 @@ class BlockBestSellers extends Module $best_sellers[] = $bestseller; } - $this->context->smarty->assign(array( + $this->smarty->assign(array( 'best_sellers' => $best_sellers, 'mediumSize' => Image::getSize('medium'), 'smallSize' => Image::getSize('small') @@ -138,20 +138,20 @@ class BlockBestSellers extends Module if (Configuration::get('PS_CATALOG_MODE')) return ; - $currency = new Currency((int)($params['cookie']->id_currency)); - $bestsellers = ProductSale::getBestSalesLight((int)($params['cookie']->id_lang), 0, 4); - if (!$bestsellers AND !Configuration::get('PS_BLOCK_BESTSELLERS_DISPLAY')) + $currency = new Currency($params['cookie']->id_currency); + $bestsellers = ProductSale::getBestSalesLight((int)$params['cookie']->id_lang, 0, 4); + if (!$bestsellers && !Configuration::get('PS_BLOCK_BESTSELLERS_DISPLAY')) return; $best_sellers = array(); - if($bestsellers) + if ($bestsellers) foreach ($bestsellers AS $bestseller) { $bestseller['price'] = Tools::displayPrice(Product::getPriceStatic((int)($bestseller['id_product'])), $currency); $best_sellers[] = $bestseller; } - $this->context->smarty->assign(array( + $this->smarty->assign(array( 'best_sellers' => $best_sellers, 'homeSize' => Image::getSize('home'))); return $this->display(__FILE__, 'blockbestsellers-home.tpl'); diff --git a/modules/blockcategories/blockcategories.php b/modules/blockcategories/blockcategories.php index 7b7a57488..1190402ae 100644 --- a/modules/blockcategories/blockcategories.php +++ b/modules/blockcategories/blockcategories.php @@ -203,15 +203,15 @@ class BlockCategories extends Module $resultParents[$row['id_parent']][] = &$row; $resultIds[$row['id_category']] = &$row; } -//p($resultParents); + $blockCategTree = $this->getTree($resultParents, $resultIds, Configuration::get('BLOCK_CATEG_MAX_DEPTH')); unset($resultParents, $resultIds); -//d($blockCategTree); + $isDhtml = (Configuration::get('BLOCK_CATEG_DHTML') == 1 ? true : false); if (Tools::isSubmit('id_category')) { $this->context->cookie->last_visited_category = $id_category; - $this->context->smarty->assign('currentCategoryId', $this->context->cookie->last_visited_category); + $this->smarty->assign('currentCategoryId', $this->context->cookie->last_visited_category); } if (Tools::isSubmit('id_product')) { @@ -221,15 +221,15 @@ class BlockCategories extends Module if (isset($product) AND Validate::isLoadedObject($product)) $this->context->cookie->last_visited_category = (int)($product->id_category_default); } - $this->context->smarty->assign('currentCategoryId', (int)($this->context->cookie->last_visited_category)); + $this->smarty->assign('currentCategoryId', (int)($this->context->cookie->last_visited_category)); } - $this->context->smarty->assign('blockCategTree', $blockCategTree); + $this->smarty->assign('blockCategTree', $blockCategTree); if (file_exists(_PS_THEME_DIR_.'modules/blockcategories/blockcategories.tpl')) - $this->context->smarty->assign('branche_tpl_path', _PS_THEME_DIR_.'modules/blockcategories/category-tree-branch.tpl'); + $this->smarty->assign('branche_tpl_path', _PS_THEME_DIR_.'modules/blockcategories/category-tree-branch.tpl'); else - $this->context->smarty->assign('branche_tpl_path', _PS_MODULE_DIR_.'blockcategories/category-tree-branch.tpl'); - $this->context->smarty->assign('isDhtml', $isDhtml); + $this->smarty->assign('branche_tpl_path', _PS_MODULE_DIR_.'blockcategories/category-tree-branch.tpl'); + $this->smarty->assign('isDhtml', $isDhtml); //} $this->context->smarty->cache_lifetime = 31536000; // 1 Year $display = $this->display(__FILE__, 'blockcategories.tpl', $smartyCacheId); @@ -279,8 +279,8 @@ class BlockCategories extends Module $nbrColumns=3; $numberColumn = abs(sizeof($result)/$nbrColumns); $widthColumn= floor(100/$nbrColumns); - $this->context->smarty->assign('numberColumn', $numberColumn); - $this->context->smarty->assign('widthColumn', $widthColumn); + $this->smarty->assign('numberColumn', $numberColumn); + $this->smarty->assign('widthColumn', $widthColumn); $blockCategTree = $this->getTree($resultParents, $resultIds, Configuration::get('BLOCK_CATEG_MAX_DEPTH')); unset($resultParents, $resultIds); @@ -290,7 +290,7 @@ class BlockCategories extends Module if (Tools::isSubmit('id_category')) { $this->context->cookie->last_visited_category = $id_category; - $this->context->smarty->assign('currentCategoryId', $this->context->cookie->last_visited_category); + $this->smarty->assign('currentCategoryId', $this->context->cookie->last_visited_category); } if (Tools::isSubmit('id_product')) { @@ -300,15 +300,15 @@ class BlockCategories extends Module if (isset($product) AND Validate::isLoadedObject($product)) $this->context->cookie->last_visited_category = (int)($product->id_category_default); } - $this->context->smarty->assign('currentCategoryId', (int)($this->context->cookie->last_visited_category)); + $this->smarty->assign('currentCategoryId', (int)($this->context->cookie->last_visited_category)); } - $this->context->smarty->assign('blockCategTree', $blockCategTree); + $this->smarty->assign('blockCategTree', $blockCategTree); if (file_exists(_PS_THEME_DIR_.'modules/blockcategories/blockcategories_footer.tpl')) - $this->context->smarty->assign('branche_tpl_path', _PS_THEME_DIR_.'modules/blockcategories/category-tree-branch.tpl'); + $this->smarty->assign('branche_tpl_path', _PS_THEME_DIR_.'modules/blockcategories/category-tree-branch.tpl'); else - $this->context->smarty->assign('branche_tpl_path', _PS_MODULE_DIR_.'blockcategories/category-tree-branch.tpl'); - $this->context->smarty->assign('isDhtml', $isDhtml); + $this->smarty->assign('branche_tpl_path', _PS_MODULE_DIR_.'blockcategories/category-tree-branch.tpl'); + $this->smarty->assign('isDhtml', $isDhtml); } $this->context->smarty->cache_lifetime = 31536000; // 1 Year $display = $this->display(__FILE__, 'blockcategories_footer.tpl', $smartyCacheId); diff --git a/modules/blockcurrencies/blockcurrencies.php b/modules/blockcurrencies/blockcurrencies.php index 1b8de8868..59b99e27e 100644 --- a/modules/blockcurrencies/blockcurrencies.php +++ b/modules/blockcurrencies/blockcurrencies.php @@ -62,8 +62,7 @@ class BlockCurrencies extends Module if (!count(Currency::getCurrencies())) return ''; - // @todo remove this and use smartyTemplate - $this->context->smarty->assign('blockcurrencies_sign', $this->context->currency->sign); + $this->smarty->assign('blockcurrencies_sign', $this->context->currency->sign); return $this->display(__FILE__, 'blockcurrencies.tpl'); } diff --git a/modules/blockcustomerprivacy/blockcustomerprivacy.php b/modules/blockcustomerprivacy/blockcustomerprivacy.php index 321ebeaf3..0a69b09cb 100644 --- a/modules/blockcustomerprivacy/blockcustomerprivacy.php +++ b/modules/blockcustomerprivacy/blockcustomerprivacy.php @@ -151,7 +151,7 @@ class blockcustomerprivacy extends Module if (!$this->active) return ; - $this->context->smarty->assign(array( + $this->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.') )); diff --git a/modules/blocklink/blocklink.php b/modules/blocklink/blocklink.php index 547e9f352..ba90b2116 100644 --- a/modules/blocklink/blocklink.php +++ b/modules/blocklink/blocklink.php @@ -93,7 +93,7 @@ class BlockLink extends Module { $links = $this->getLinks(); - $this->context->smarty->assign(array( + $this->smarty->assign(array( 'blocklink_links' => $links, 'title' => Configuration::get('PS_BLOCKLINK_TITLE', $this->context->language->id), 'url' => Configuration::get('PS_BLOCKLINK_URL'), diff --git a/modules/blockpaymentlogo/blockpaymentlogo.php b/modules/blockpaymentlogo/blockpaymentlogo.php index 21c411849..42b856fcb 100644 --- a/modules/blockpaymentlogo/blockpaymentlogo.php +++ b/modules/blockpaymentlogo/blockpaymentlogo.php @@ -117,7 +117,7 @@ class BlockPaymentLogo extends Module $cms = new CMS(Configuration::get('PS_PAYMENT_LOGO_CMS_ID'), $this->context->language->id); if (!Validate::isLoadedObject($cms)) return; - $this->context->smarty->assign('cms_payement_logo', $cms); + $this->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 cb6107882..bbadf635b 100644 --- a/modules/blockrss/blockrss.php +++ b/modules/blockrss/blockrss.php @@ -171,7 +171,7 @@ class Blockrss extends Module } // Display smarty - $this->context->smarty->assign(array('title' => ($title ? $title : $this->l('RSS feed')), 'rss_links' => $rss_links)); + $this->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 60c9f6939..e47c48bdc 100644 --- a/modules/blocksearch/blocksearch.php +++ b/modules/blocksearch/blocksearch.php @@ -84,10 +84,12 @@ class BlockSearch extends Module */ private function calculHookCommon($params) { - $this->context->smarty->assign('ENT_QUOTES', ENT_QUOTES); - $this->context->smarty->assign('search_ssl', Tools::usingSecureMode()); - $this->context->smarty->assign('ajaxsearch', Configuration::get('PS_SEARCH_AJAX')); - $this->context->smarty->assign('instantsearch', Configuration::get('PS_INSTANT_SEARCH')); + $this->smarty->assign(array( + 'ENT_QUOTES' => ENT_QUOTES, + 'search_ssl' => Tools::usingSecureMode(), + 'ajaxsearch' => Configuration::get('PS_SEARCH_AJAX'), + 'instantsearch' => Configuration::get('PS_INSTANT_SEARCH'), + )); return true; } diff --git a/modules/blockstore/blockstore.php b/modules/blockstore/blockstore.php index 8ecbcf92d..c8096495e 100644 --- a/modules/blockstore/blockstore.php +++ b/modules/blockstore/blockstore.php @@ -63,9 +63,7 @@ class BlockStore extends Module function hookRightColumn($params) { - - - $this->context->smarty->assign('store_img', Configuration::get('BLOCKSTORE_IMG')); + $this->smarty->assign('store_img', Configuration::get('BLOCKSTORE_IMG')); return $this->display(__FILE__, 'blockstore.tpl'); } @@ -78,7 +76,7 @@ class BlockStore extends Module { if (Tools::isSubmit('submitStoreConf')) { - if (isset($_FILES['store_img']) AND isset($_FILES['store_img']['tmp_name']) AND !empty($_FILES['store_img']['tmp_name'])) + if (isset($_FILES['store_img']) && isset($_FILES['store_img']['tmp_name']) && !empty($_FILES['store_img']['tmp_name'])) { if ($error = checkImage($_FILES['store_img'], 4000000)) return $this->displayError($this->l('invalid image')); diff --git a/modules/blocksupplier/blocksupplier.php b/modules/blocksupplier/blocksupplier.php index ccc3bfa30..4bbe2b900 100644 --- a/modules/blocksupplier/blocksupplier.php +++ b/modules/blocksupplier/blocksupplier.php @@ -60,7 +60,7 @@ class BlockSupplier extends Module function hookDisplayLeftColumn($params) { - $this->context->smarty->assign(array( + $this->smarty->assign(array( 'suppliers' => Supplier::getSuppliers(false), 'link' => $this->context->link, 'text_list' => Configuration::get('SUPPLIER_DISPLAY_TEXT'), diff --git a/modules/blocktags/blocktags.php b/modules/blocktags/blocktags.php index 8eab3b959..0756dd055 100644 --- a/modules/blocktags/blocktags.php +++ b/modules/blocktags/blocktags.php @@ -106,7 +106,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']); - $this->context->smarty->assign('tags', $tags); + $this->smarty->assign('tags', $tags); return $this->display(__FILE__, 'blocktags.tpl'); } diff --git a/modules/blockwishlist/blockwishlist.php b/modules/blockwishlist/blockwishlist.php index 05d39fe3a..11dc9749d 100644 --- a/modules/blockwishlist/blockwishlist.php +++ b/modules/blockwishlist/blockwishlist.php @@ -194,7 +194,7 @@ class BlockWishList extends Module } else $id_wishlist = $this->context->cookie->id_wishlist; - $this->context->smarty->assign(array( + $this->smarty->assign(array( 'id_wishlist' => $id_wishlist, 'isLogged' => true, 'wishlist_products' => ($id_wishlist == false ? false : WishList::getProductByIdCustomer($id_wishlist, $this->context->customer->id, $this->context->language->id, null, true)), @@ -202,7 +202,7 @@ class BlockWishList extends Module 'ptoken' => Tools::getToken(false))); } else - $this->context->smarty->assign(array('wishlist_products' => false, 'wishlists' => false)); + $this->smarty->assign(array('wishlist_products' => false, 'wishlists' => false)); return ($this->display(__FILE__, 'blockwishlist.tpl')); } @@ -213,7 +213,7 @@ class BlockWishList extends Module public function hookProductActions($params) { - $this->context->smarty->assign('id_product', (int)(Tools::getValue('id_product'))); + $this->smarty->assign('id_product', (int)(Tools::getValue('id_product'))); return ($this->display(__FILE__, 'blockwishlist-extra.tpl')); } diff --git a/modules/cheque/cheque.php b/modules/cheque/cheque.php index 4455a6684..01f90c1ab 100644 --- a/modules/cheque/cheque.php +++ b/modules/cheque/cheque.php @@ -154,7 +154,7 @@ class Cheque extends PaymentModule if (!$this->checkCurrency($params['cart'])) return ; - $this->context->smarty->assign(array( + $this->smarty->assign(array( 'this_path' => $this->_path, 'this_path_ssl' => Tools::getShopDomainSsl(true, true).__PS_BASE_URI__.'modules/'.$this->name.'/' )); @@ -169,7 +169,7 @@ class Cheque extends PaymentModule $state = $params['objOrder']->getCurrentState(); if ($state == Configuration::get('PS_OS_CHEQUE') OR $state == Configuration::get('PS_OS_OUTOFSTOCK')) { - $this->context->smarty->assign(array( + $this->smarty->assign(array( 'total_to_pay' => Tools::displayPrice($params['total_to_pay'], $params['currencyObj'], false), 'chequeName' => $this->chequeName, 'chequeAddress' => Tools::nl2br($this->address), @@ -177,10 +177,10 @@ class Cheque extends PaymentModule 'id_order' => $params['objOrder']->id )); if (isset($params['objOrder']->reference) && !empty($params['objOrder']->reference)) - $this->context->smarty->assign('reference', $params['objOrder']->reference); + $this->smarty->assign('reference', $params['objOrder']->reference); } else - $this->context->smarty->assign('status', 'failed'); + $this->smarty->assign('status', 'failed'); return $this->display(__FILE__, 'payment_return.tpl'); } diff --git a/modules/crossselling/crossselling.php b/modules/crossselling/crossselling.php index 234dae534..4f3c945ad 100755 --- a/modules/crossselling/crossselling.php +++ b/modules/crossselling/crossselling.php @@ -161,7 +161,7 @@ class CrossSelling extends Module $orderProduct['displayed_price'] = Product::getPriceStatic((int)$orderProduct['product_id'], false, NULL); } - $this->context->smarty->assign(array('order' => (count($pIds) > 1 ? true : false), 'orderProducts' => $orderProducts, 'middlePosition_crossselling' => round(sizeof($orderProducts) / 2, 0), + $this->smarty->assign(array('order' => (count($pIds) > 1 ? true : false), 'orderProducts' => $orderProducts, 'middlePosition_crossselling' => round(sizeof($orderProducts) / 2, 0), 'crossDisplayPrice' => Configuration::get('CROSSSELLING_DISPLAY_PRICE'))); } return $this->display(__FILE__, 'crossselling.tpl'); @@ -209,7 +209,7 @@ class CrossSelling extends Module $orderProduct['displayed_price'] = Product::getPriceStatic((int)$orderProduct['product_id'], false, NULL); } - $this->context->smarty->assign(array('order' => false, 'orderProducts' => $orderProducts, 'middlePosition_crossselling' => round(sizeof($orderProducts) / 2, 0), + $this->smarty->assign(array('order' => false, '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 170f1baa9..248dc0c96 100644 --- a/modules/dateofdelivery/dateofdelivery.php +++ b/modules/dateofdelivery/dateofdelivery.php @@ -114,7 +114,7 @@ class DateOfDelivery extends Module foreach ($params['carriers'] as $carrier) $datesDelivery[(int)($carrier['id_carrier'])] = $this->_getDatesOfDelivery((int)($carrier['id_carrier']), $oos); - $this->context->smarty->assign(array( + $this->smarty->assign(array( 'datesDelivery' => $datesDelivery, 'id_carrier' => ($params['cart']->id_carrier ? (int)($params['cart']->id_carrier) : (int)(Configuration::get('PS_CARRIER_DEFAULT'))) )); @@ -136,7 +136,7 @@ class DateOfDelivery extends Module if (!is_array($datesDelivery) OR !sizeof($datesDelivery)) return ; - $this->context->smarty->assign('datesDelivery', $datesDelivery); + $this->smarty->assign('datesDelivery', $datesDelivery); return $this->display(__FILE__, 'orderDetail.tpl'); } diff --git a/modules/editorial/editorial.php b/modules/editorial/editorial.php index 249542c77..e28276cf7 100644 --- a/modules/editorial/editorial.php +++ b/modules/editorial/editorial.php @@ -300,7 +300,7 @@ class Editorial extends Module { $editorial = new EditorialClass(1, $this->context->language->id); - $this->context->smarty->assign(array( + $this->smarty->assign(array( 'editorial' => $editorial, 'default_lang' => (int)$this->context->language->id, 'image_width' => Configuration::get('EDITORIAL_IMAGE_WIDTH'), diff --git a/modules/favoriteproducts/favoriteproducts.php b/modules/favoriteproducts/favoriteproducts.php index 76c6a69bd..c5773e67e 100644 --- a/modules/favoriteproducts/favoriteproducts.php +++ b/modules/favoriteproducts/favoriteproducts.php @@ -81,7 +81,7 @@ class FavoriteProducts extends Module $favoriteProducts = FavoriteProduct::getFavoriteProducts($this->context->customer->id, $this->context->language->id); - $this->context->smarty->assign(array('favorite_products' => $favoriteProducts)); + $this->smarty->assign(array('favorite_products' => $favoriteProducts)); return $this->display(__FILE__, 'my-account.tpl'); } @@ -95,7 +95,7 @@ class FavoriteProducts extends Module { include_once(dirname(__FILE__).'/FavoriteProduct.php'); - $this->context->smarty->assign(array( + $this->smarty->assign(array( 'isCustomerFavoriteProduct' => (FavoriteProduct::isCustomerFavoriteProduct($this->context->customer->id, Tools::getValue('id_product')) ? 1 : 0), 'isLogged' => (int)$this->context->customer->logged)); return $this->display(__FILE__, 'favoriteproducts-extra.tpl'); diff --git a/modules/feeder/feeder.php b/modules/feeder/feeder.php index 1cf0b68a4..a9fccf1f1 100644 --- a/modules/feeder/feeder.php +++ b/modules/feeder/feeder.php @@ -61,23 +61,23 @@ class Feeder extends Module $id_category = (int)(Tools::getValue('id_category')); if (!$id_category) { - if (isset($_SERVER['HTTP_REFERER']) AND preg_match('!^(.*)\/([0-9]+)\-(.*[^\.])|(.*)id_category=([0-9]+)(.*)$!', $_SERVER['HTTP_REFERER'], $regs) AND !strstr($_SERVER['HTTP_REFERER'], '.html')) + if (isset($_SERVER['HTTP_REFERER']) && preg_match('!^(.*)\/([0-9]+)\-(.*[^\.])|(.*)id_category=([0-9]+)(.*)$!', $_SERVER['HTTP_REFERER'], $regs) && !strstr($_SERVER['HTTP_REFERER'], '.html')) { - if (isset($regs[2]) AND is_numeric($regs[2])) + if (isset($regs[2]) && is_numeric($regs[2])) $id_category = (int)($regs[2]); - elseif (isset($regs[5]) AND is_numeric($regs[5])) - $id_category = (int)($regs[5]); + elseif (isset($regs[5]) && is_numeric($regs[5])) + $id_category = (int)$regs[5]; } - elseif ($id_product = (int)(Tools::getValue('id_product'))) + elseif ($id_product = (int)Tools::getValue('id_product')) { $product = new Product($id_product); $id_category = $product->id_category_default; } } - $category = new Category($id_category); + $orderBy = Tools::getProductsOrder('by', Tools::getValue('orderby')); $orderWay = Tools::getProductsOrder('way', Tools::getValue('orderway')); - $this->context->smarty->assign(array( + $this->smarty->assign(array( 'feedUrl' => Tools::getShopDomain(true, true).__PS_BASE_URI__.'modules/'.$this->name.'/rss.php?id_category='.$id_category.'&orderby='.$orderBy.'&orderway='.$orderWay, )); return $this->display(__FILE__, 'feederHeader.tpl'); diff --git a/modules/homeslider/homeslider.php b/modules/homeslider/homeslider.php index dff029885..42634fe40 100644 --- a/modules/homeslider/homeslider.php +++ b/modules/homeslider/homeslider.php @@ -616,8 +616,8 @@ class HomeSlider extends Module if (!$slides) return; - $this->context->smarty->assign('homeslider_slides', $slides); - $this->context->smarty->assign('homeslider', $slider); + $this->smarty->assign('homeslider_slides', $slides); + $this->smarty->assign('homeslider', $slider); return $this->display(__FILE__, 'homeslider.tpl'); } diff --git a/modules/loyalty/loyalty.php b/modules/loyalty/loyalty.php index 5004198c9..a5de837bd 100644 --- a/modules/loyalty/loyalty.php +++ b/modules/loyalty/loyalty.php @@ -454,14 +454,14 @@ class Loyalty extends Module if (!(int)(Configuration::get('PS_LOYALTY_NONE_AWARD')) AND Product::isDiscounted((int)$product->id)) { $points = 0; - $this->context->smarty->assign('no_pts_discounted', 1); + $this->smarty->assign('no_pts_discounted', 1); } else $points = (int)(LoyaltyModule::getNbPointsByPrice($product->getPrice(Product::getTaxCalculationMethod() == PS_TAX_EXC ? false : true, (int)($product->getIdProductAttributeMostExpensive())))); $pointsAfter = $points; $pointsBefore = 0; } - $this->context->smarty->assign(array( + $this->smarty->assign(array( 'points' => (int)($points), 'total_points' => (int)($pointsAfter), 'point_rate' => Configuration::get('PS_LOYALTY_POINT_RATE'), @@ -520,14 +520,14 @@ class Loyalty extends Module if (Validate::isLoadedObject($params['cart'])) { $points = LoyaltyModule::getCartNbPoints($params['cart']); - $this->context->smarty->assign(array( + $this->smarty->assign(array( 'points' => (int)$points, 'voucher' => LoyaltyModule::getVoucherValue((int)$points), 'guest_checkout' => (int)Configuration::get('PS_GUEST_CHECKOUT_ENABLED') )); - } else { - $smarty->assign(array('points' => 0)); } + else + $this->smarty->assign(array('points' => 0)); return $this->display(__FILE__, 'shopping-cart.tpl'); } diff --git a/modules/mailalerts/mailalerts.php b/modules/mailalerts/mailalerts.php index 7aa4b5857..037326d4e 100644 --- a/modules/mailalerts/mailalerts.php +++ b/modules/mailalerts/mailalerts.php @@ -259,7 +259,7 @@ class MailAlerts extends Module $id_product_attribute = 0; if (!$this->context->customer->isLogged()) - $this->context->smarty->assign('email', 1); + $this->smarty->assign('email', 1); else { $id_customer = (int)($params['cookie']->id_customer); @@ -267,7 +267,7 @@ class MailAlerts extends Module return ; } - $this->context->smarty->assign(array( + $this->smarty->assign(array( 'id_product' => $id_product, 'id_product_attribute' => $id_product_attribute)); diff --git a/modules/productscategory/productscategory.php b/modules/productscategory/productscategory.php index 86a839057..c64e0a6dd 100644 --- a/modules/productscategory/productscategory.php +++ b/modules/productscategory/productscategory.php @@ -164,7 +164,7 @@ class productsCategory extends Module } // Display tpl - $this->context->smarty->assign(array( + $this->smarty->assign(array( 'categoryProducts' => $categoryProducts, 'middlePosition' => (int)$middlePosition, 'ProdDisplayPrice' => Configuration::get('PRODUCTSCATEGORY_DISPLAY_PRICE'))); diff --git a/modules/producttooltip/producttooltip.php b/modules/producttooltip/producttooltip.php index 2d72e13b8..d0f4e186f 100644 --- a/modules/producttooltip/producttooltip.php +++ b/modules/producttooltip/producttooltip.php @@ -153,7 +153,7 @@ class ProductToolTip extends Module WHERE p.id_page_type = 1 AND p.id_object = '.(int)($id_product).' AND cp.time_start > \''.pSQL($date).'\''); if (isset($nbPeople['nb']) AND $nbPeople['nb'] > 0) - $this->context->smarty->assign('nb_people', (int)($nbPeople['nb'])); + $this->smarty->assign('nb_people', (int)($nbPeople['nb'])); } /* Then, we try to display last sale */ @@ -170,7 +170,7 @@ class ProductToolTip extends Module ORDER BY o.date_add DESC'); if (isset($order['date_add']) && Validate::isDateFormat($order['date_add']) && $order['date_add'] != '0000-00-00 00:00:00') - $this->context->smarty->assign('date_last_order', $order['date_add']); + $this->smarty->assign('date_last_order', $order['date_add']); else { /* No sale? display last cart add instead */ @@ -182,7 +182,7 @@ class ProductToolTip extends Module WHERE cp.id_product = '.(int)($id_product)); if (isset($cart['date_add']) && Validate::isDateFormat($cart['date_add']) && $cart['date_add'] != '0000-00-00 00:00:00') - $this->context->smarty->assign('date_last_cart', $cart['date_add']); + $this->smarty->assign('date_last_cart', $cart['date_add']); } } } diff --git a/modules/referralprogram/referralprogram.php b/modules/referralprogram/referralprogram.php index bf1cdfdc5..36c1a127d 100644 --- a/modules/referralprogram/referralprogram.php +++ b/modules/referralprogram/referralprogram.php @@ -372,7 +372,7 @@ class ReferralProgram extends Module if ($cartRule->checkValidity($this->context) === false) { - $this->context->smarty->assign(array('discount_display' => ReferralProgram::displayDiscount($cartRule->reduction_percent ? $cartRule->reduction_percent : $cartRule->reduction_amount, $cartRule->reduction_percent ? 1 : 2, new Currency($params['cookie']->id_currency)), 'discount' => $cartRule)); + $this->smarty->assign(array('discount_display' => ReferralProgram::displayDiscount($cartRule->reduction_percent ? $cartRule->reduction_percent : $cartRule->reduction_amount, $cartRule->reduction_percent ? 1 : 2, new Currency($params['cookie']->id_currency)), 'discount' => $cartRule)); return $this->display(__FILE__, 'shopping-cart.tpl'); } return false; @@ -580,7 +580,7 @@ class ReferralProgram extends Module $cartRule = new CartRule((int)$referralprogram->id_cart_rule_sponsor); if (!Validate::isLoadedObject($cartRule)) return false; - $this->context->smarty->assign(array('discount' => ReferralProgram::displayDiscount($cartRule->reduction_percent ? $cartRule->reduction_percent : $cartRule->reduction_amount, $cartRule->reduction_percent ? 1 : 2, new Currency((int)$params['objOrder']->id_currency)), 'sponsor_firstname' => $sponsor->firstname, 'sponsor_lastname' => $sponsor->lastname)); + $this->smarty->assign(array('discount' => ReferralProgram::displayDiscount($cartRule->reduction_percent ? $cartRule->reduction_percent : $cartRule->reduction_amount, $cartRule->reduction_percent ? 1 : 2, new Currency((int)$params['objOrder']->id_currency)), 'sponsor_firstname' => $sponsor->firstname, 'sponsor_lastname' => $sponsor->lastname)); return $this->display(__FILE__, 'order-confirmation.tpl'); } return false; diff --git a/modules/trackingfront/trackingfront.php b/modules/trackingfront/trackingfront.php index ce18c718b..712907bb9 100644 --- a/modules/trackingfront/trackingfront.php +++ b/modules/trackingfront/trackingfront.php @@ -93,7 +93,7 @@ class TrackingFront extends Module Tools::redirect('modules/trackingfront/stats.php'); } } - $this->context->smarty->assign('errors', $errors); + $this->smarty->assign('errors', $errors); } if (Tools::isSubmit('submitDatePicker')) @@ -164,9 +164,9 @@ class TrackingFront extends Module Referrer::refreshCache(array(array('id_referrer' => (int)($this->context->cookie->tracking_id))), $fakeEmployee); $referrer = new Referrer((int)($this->context->cookie->tracking_id)); - $this->context->smarty->assign('referrer', $referrer); - $this->context->smarty->assign('datepickerFrom', $fakeEmployee->stats_date_from); - $this->context->smarty->assign('datepickerTo', $fakeEmployee->stats_date_to); + $this->smarty->assign('referrer', $referrer); + $this->smarty->assign('datepickerFrom', $fakeEmployee->stats_date_from); + $this->smarty->assign('datepickerTo', $fakeEmployee->stats_date_to); $displayTab = array( 'uniqs' => $this->l('Unique visitors'), @@ -182,7 +182,7 @@ class TrackingFront extends Module 'cart' => $this->l('Average cart'), 'reg_rate' => $this->l('Registration rate'), 'order_rate' => $this->l('Order rate')); - $this->context->smarty->assign('displayTab', $displayTab); + $this->smarty->assign('displayTab', $displayTab); $products = Product::getSimpleProducts($this->context->language->id); $productsArray = array();