diff --git a/classes/Module.php b/classes/Module.php index b5d630f37..ca6b04d63 100644 --- a/classes/Module.php +++ b/classes/Module.php @@ -469,7 +469,7 @@ abstract class ModuleCore $this->unregisterExceptions($hookID, $shopList); $result &= $this->registerExceptions($hookID, $except, $shopList); } - + return $result; } @@ -572,9 +572,9 @@ abstract class ModuleCore $modulesNameToCursor = array(); $errors = array(); $modules_dir = self::getModulesDirOnDisk(); - + $memory_limit = Tools::getMemoryLimit(); - + foreach ($modules_dir AS $module) { // Memory usage checking @@ -589,7 +589,7 @@ abstract class ModuleCore break; } } - + $configFile = _PS_MODULE_DIR_.$module.'/config.xml'; $xml_exist = file_exists($configFile); if ($xml_exist) @@ -1154,6 +1154,24 @@ abstract class ModuleCore return $result; } + /** + * Assign a smarty vars (same syntax as smarty->assign) but prefix all keys with module name + * + * @since 1.5.0 + * @param string $key Variable key (can be an array) + * @param mixed $value Variable value + */ + public function smartyAssign($key, $value = null) + { + if (is_array($key)) + { + foreach ($key as $k => $v) + $this->context->smarty->assign($this->name.'_'.$k, $v); + } + else + $this->context->smarty->assign($this->name.'_'.$key, $value); + } + protected function _getApplicableTemplateDir($template) { return $this->_isTemplateOverloaded($template) ? _PS_THEME_DIR_ : _PS_MODULE_DIR_.$this->name.'/'; diff --git a/modules/blockcart/blockcart-json.tpl b/modules/blockcart/blockcart-json.tpl index 8f08a6f1f..8dcce7536 100644 --- a/modules/blockcart/blockcart-json.tpl +++ b/modules/blockcart/blockcart-json.tpl @@ -1,5 +1,5 @@ {* -* 2007-2011 PrestaShop +* 2007-2011 PrestaShop * * NOTICE OF LICENSE * @@ -26,8 +26,8 @@ {ldelim} "products": [ -{if $products} -{foreach from=$products item=product name='products'} +{if $blockcart_products} +{foreach from=$blockcart_products item=product name='products'} {assign var='productId' value=$product.id_product} {assign var='productAttributeId' value=$product.id_product_attribute} {ldelim} @@ -44,11 +44,11 @@ {else} "hasAttributes": false, {/if} - "hasCustomizedDatas": {if isset($customizedDatas.$productId.$productAttributeId)}true{else}false{/if}, + "hasCustomizedDatas": {if isset($blockcart_customizedDatas.$productId.$productAttributeId)}true{else}false{/if}, "customizedDatas":[ - {if isset($customizedDatas.$productId.$productAttributeId)} - {foreach from=$customizedDatas.$productId.$productAttributeId key='id_customization' item='customization' name='customizedDatas'}{ldelim} + {if isset($blockcart_customizedDatas.$productId.$productAttributeId)} + {foreach from=$blockcart_customizedDatas.$productId.$productAttributeId key='id_customization' item='customization' name='customizedDatas'}{ldelim} {* This empty line was made in purpose (product addition debug), please leave it here *} "customizationId": {$id_customization}, @@ -80,7 +80,7 @@ ], "discounts": [ -{if $discounts}{foreach from=$discounts item=discount name='discounts'} +{if $blockcart_discounts}{foreach from=$blockcart_discounts item=discount name='discounts'} {ldelim} "id": "{$discount.id_discount}", "name": "{$discount.name|cat:' : '|cat:$discount.description|truncate:18:'...'|addslashes|replace:'\\\'':'\''}", @@ -93,19 +93,19 @@ {/foreach}{/if} ], -"shippingCost": "{$shipping_cost|html_entity_decode:2:'UTF-8'}", -{if isset($tax_cost)} -"taxCost": "{$tax_cost|html_entity_decode:2:'UTF-8'}", +"shippingCost": "{$blockcart_shipping_cost|html_entity_decode:2:'UTF-8'}", +{if isset($blockcart_tax_cost)} +"taxCost": "{$blockcart_tax_cost|html_entity_decode:2:'UTF-8'}", {/if} -"wrappingCost": "{$wrapping_cost|html_entity_decode:2:'UTF-8'}", -"nbTotalProducts": "{$nb_total_products}", -"total": "{$total|html_entity_decode:2:'UTF-8'}", -"productTotal": "{$product_total|html_entity_decode:2:'UTF-8'}", +"wrappingCost": "{$blockcart_wrapping_cost|html_entity_decode:2:'UTF-8'}", +"nbTotalProducts": "{$blockcart_nb_total_products}", +"total": "{$blockcart_total|html_entity_decode:2:'UTF-8'}", +"productTotal": "{$blockcart_product_total|html_entity_decode:2:'UTF-8'}", -{if isset($errors) && $errors} +{if isset($blockcart_errors) && $blockcart_errors} "hasError" : true, "errors" : [ -{foreach from=$errors key=k item=error name='errors'} +{foreach from=$blockcart_errors key=k item=error name='errors'} "{$error|addslashes|html_entity_decode:2:'UTF-8'}" {if !$smarty.foreach.errors.last},{/if} {/foreach} diff --git a/modules/blockcart/blockcart.php b/modules/blockcart/blockcart.php index 324bc0658..8a74ba74d 100644 --- a/modules/blockcart/blockcart.php +++ b/modules/blockcart/blockcart.php @@ -44,7 +44,7 @@ class BlockCart extends Module $this->description = $this->l('Adds a block containing the customer\'s shopping cart.'); } - public function smartyAssigns(&$smarty, &$params) + public function assignContentVars(&$params) { global $errors; @@ -77,10 +77,10 @@ class BlockCart extends Module if ($useTax AND Configuration::get('PS_TAX_DISPLAY') == 1) { $totalToPayWithoutTaxes = $params['cart']->getOrderTotal(false); - $smarty->assign('tax_cost', Tools::displayPrice($totalToPay - $totalToPayWithoutTaxes, $currency)); + $this->smartyAssign('tax_cost', Tools::displayPrice($totalToPay - $totalToPayWithoutTaxes, $currency)); } - $smarty->assign(array( + $this->smartyAssign(array( 'products' => $products, 'customizedDatas' => Product::getAllCustomizedDatas((int)($params['cart']->id)), 'CUSTOMIZE_FILE' => _CUSTOMIZE_FILE_, @@ -98,9 +98,9 @@ class BlockCart extends Module 'ajax_allowed' => (int)(Configuration::get('PS_BLOCK_CART_AJAX')) == 1 ? true : false )); if (sizeof($errors)) - $smarty->assign('errors', $errors); + $this->smartyAssign('errors', $errors); if(isset($this->context->cookie->ajax_blockcart_display)) - $smarty->assign('colapseExpandStatus', $this->context->cookie->ajax_blockcart_display); + $this->smartyAssign('colapseExpandStatus', $this->context->cookie->ajax_blockcart_display); } public function getContent() @@ -159,8 +159,9 @@ class BlockCart extends Module if (Configuration::get('PS_CATALOG_MODE')) return; - $this->context->smarty->assign('order_page', strpos($_SERVER['PHP_SELF'], 'order') !== false); - $this->smartyAssigns($this->context->smarty, $params); + // @todo this variable seems not used + $this->smartyAssign('order_page', strpos($_SERVER['PHP_SELF'], 'order') !== false); + $this->assignContentVars($params); return $this->display(__FILE__, 'blockcart.tpl'); } @@ -174,7 +175,7 @@ class BlockCart extends Module if (Configuration::get('PS_CATALOG_MODE')) return; - $this->smartyAssigns($this->context->smarty, $params); + $this->assignContentVars($params); $res = $this->display(__FILE__, 'blockcart-json.tpl'); return $res; } diff --git a/modules/blockcart/blockcart.tpl b/modules/blockcart/blockcart.tpl index cf8fe211c..cde0abeca 100644 --- a/modules/blockcart/blockcart.tpl +++ b/modules/blockcart/blockcart.tpl @@ -27,9 +27,9 @@ {*************************************************************************************************************************************} {* IMPORTANT : If you change some data here, you have to report these changes in the ./blockcart-json.js (to let ajaxCart available) *} {*************************************************************************************************************************************} -{if $ajax_allowed} +{if $blockcart_ajax_allowed} @@ -38,15 +38,15 @@ var removingLinkText = '{l s='remove this product from my cart' mod='blockcart'

- {l s='Cart' mod='blockcart'} - {if $ajax_allowed} -   -   + {l s='Cart' mod='blockcart'} + {if $blockcart_ajax_allowed} +   +   {/if}

-
+
{$cart_qties} {l s='products' mod='blockcart'} 1}style="display:none"{/if}>{l s='product' mod='blockcart'} @@ -54,17 +54,17 @@ var removingLinkText = '{l s='remove this product from my cart' mod='blockcart' {l s='(empty)' mod='blockcart'}
-
- {if $products} +
+ {if $blockcart_products}
- {foreach from=$products item='product' name='myLoop'} + {foreach from=$blockcart_products item='product' name='myLoop'} {assign var='productId' value=$product.id_product} {assign var='productAttributeId' value=$product.id_product_attribute}
{$product.cart_quantity}x {$product.name|truncate:13:'...'|escape:html:'UTF-8'} - {if !isset($customizedDatas.$productId.$productAttributeId)} {/if} + {if !isset($blockcart_customizedDatas.$productId.$productAttributeId)} {/if} {if $priceDisplay == $smarty.const.PS_TAX_EXC}{displayWtPrice p="`$product.total`"}{else}{displayWtPrice p="`$product.total_wt`"}{/if}
{if isset($product.attributes_small)} @@ -73,14 +73,14 @@ var removingLinkText = '{l s='remove this product from my cart' mod='blockcart' {/if} - {if isset($customizedDatas.$productId.$productAttributeId)} + {if isset($blockcart_customizedDatas.$productId.$productAttributeId)} {if !isset($product.attributes_small)}
{/if}
    - {foreach from=$customizedDatas.$productId.$productAttributeId key='id_customization' item='customization' name='customizations'} + {foreach from=$blockcart_customizedDatas.$productId.$productAttributeId key='id_customization' item='customization' name='customizations'}
  • - {$customization.quantity}x{if isset($customization.datas.$CUSTOMIZE_TEXTFIELD.0)} - {$customization.datas.$CUSTOMIZE_TEXTFIELD.0.value|escape:html:'UTF-8'|replace:"
    ":" "|truncate:28} + {$customization.quantity}x{if isset($customization.datas.$blockcart_CUSTOMIZE_TEXTFIELD.0)} + {$customization.datas.$blockcart_CUSTOMIZE_TEXTFIELD.0.value|escape:html:'UTF-8'|replace:"
    ":" "|truncate:28} {else} {l s='Customization #' mod='blockcart'}{$id_customization|intval}{l s=':' mod='blockcart'} {/if} @@ -95,15 +95,15 @@ var removingLinkText = '{l s='remove this product from my cart' mod='blockcart' {/foreach}
{/if} -

{l s='No products' mod='blockcart'}

+

{l s='No products' mod='blockcart'}

- {if $discounts|@count > 0} + {if $blockcart_discounts|@count > 0}
- {foreach from=$discounts item=discount} + {foreach from=$blockcart_discounts item=discount} - + {/foreach} @@ -112,23 +112,23 @@ var removingLinkText = '{l s='remove this product from my cart' mod='blockcart'

{l s='Shipping' mod='blockcart'} - {$shipping_cost} + {$blockcart_shipping_cost}
- {if $show_wrapping} + {if $blockcart_show_wrapping} {assign var='blockcart_cart_flag' value='Cart::ONLY_WRAPPING'|constant} {l s='Wrapping' mod='blockcart'} {if $priceDisplay == 1}{convertPrice price=$cart->getOrderTotal(false, $blockcart_cart_flag)}{else}{convertPrice price=$cart->getOrderTotal(true, $blockcart_cart_flag)}{/if}
{/if} - {if $show_tax && isset($tax_cost)} + {if $blockcart_show_tax && isset($blockcart_tax_cost)} {l s='Tax' mod='blockcart'} - {$tax_cost} + {$blockcart_tax_cost}
{/if} {l s='Total' mod='blockcart'} - {$total} + {$blockcart_total}

- {if $use_taxes && $display_tax_label == 1 && $show_tax} + {if $use_taxes && $display_tax_label == 1 && $blockcart_show_tax} {if $priceDisplay == 0}

{l s='Prices are tax included' mod='blockcart'} @@ -142,10 +142,10 @@ var removingLinkText = '{l s='remove this product from my cart' mod='blockcart' {/if}

{capture name=step_order_process} - {if $order_process == 'order'}step=1{/if} + {if $blockcart_order_process == 'order'}step=1{/if} {/capture} - {if $order_process == 'order'}{l s='Cart' mod='blockcart'}{/if} - {l s='Check out' mod='blockcart'} + {if $blockcart_order_process == 'order'}{l s='Cart' mod='blockcart'}{/if} + {l s='Check out' mod='blockcart'}

diff --git a/modules/blockcms/blockcms.php b/modules/blockcms/blockcms.php index f1808302f..d38253bf0 100755 --- a/modules/blockcms/blockcms.php +++ b/modules/blockcms/blockcms.php @@ -770,28 +770,24 @@ class BlockCms extends Module return $this->_html; } - public function hookLeftColumn() + public function displayBlockCMS($column) { - $this->context = Context::getContext(); - $cms_titles = self::getCMStitles(self::LEFT_COLUMN); - $this->context->smarty->assign(array( + $cms_titles = self::getCMStitles($column); + $this->smartyAssign(array( 'block' => 1, 'cms_titles' => $cms_titles, - 'theme_dir' => _PS_THEME_DIR_ )); return $this->display(__FILE__, 'blockcms.tpl'); } + public function hookLeftColumn() + { + return $this->displayBlockCMS(self::LEFT_COLUMN); + } + public function hookRightColumn() { - - $cms_titles = self::getCMStitles(self::RIGHT_COLUMN); - $this->context->smarty->assign(array( - 'block' => 1, - 'cms_titles' => $cms_titles, - 'theme_dir' => _PS_THEME_DIR_ - )); - return $this->display(__FILE__, 'blockcms.tpl'); + return $this->displayBlockCMS(self::RIGHT_COLUMN); } public function hookFooter() @@ -800,10 +796,9 @@ class BlockCms extends Module if (Configuration::get('FOOTER_BLOCK_ACTIVATION')) { $cms_titles = self::getCMStitlesFooter(); - $this->context->smarty->assign(array( + $this->smartyAssign(array( 'block' => 0, 'cmslinks' => $cms_titles, - 'theme_dir' => _PS_THEME_DIR_, 'display_stores_footer' => Configuration::get('PS_STORES_DISPLAY_FOOTER'), 'display_poweredby' => ((int)Configuration::get('FOOTER_POWEREDBY') === 1 || Configuration::get('FOOTER_POWEREDBY') === false), 'footer_text' => Configuration::get('FOOTER_CMS_TEXT_'.(int)$this->context->language->id) diff --git a/modules/blockcms/blockcms.tpl b/modules/blockcms/blockcms.tpl index c945a0972..d5dd0b475 100755 --- a/modules/blockcms/blockcms.tpl +++ b/modules/blockcms/blockcms.tpl @@ -24,9 +24,9 @@ * International Registered Trademark & Property of PrestaShop SA *} -{if $block == 1} +{if $blockcms_block == 1} - {foreach from=$cms_titles key=cms_key item=cms_title} + {foreach from=$blockcms_cms_titles key=cms_key item=cms_title}

{if !empty($cms_title.name)}{$cms_title.name}{else}{$cms_title.category_name}{/if}

- {$footer_text} + {$blockcms_footer_text} {/if} diff --git a/modules/blockcurrencies/blockcurrencies.php b/modules/blockcurrencies/blockcurrencies.php index 20817b01a..d8fa111fc 100644 --- a/modules/blockcurrencies/blockcurrencies.php +++ b/modules/blockcurrencies/blockcurrencies.php @@ -1,6 +1,6 @@ need_instance = 0; parent::__construct(); - + $this->displayName = $this->l('Currency block'); $this->description = $this->l('Adds a block for selecting a currency.'); } @@ -60,13 +60,12 @@ class BlockCurrencies extends Module if (Configuration::get('PS_CATALOG_MODE')) return ; - $currencies = Currency::getCurrencies(); - if (!sizeof($currencies)) + if (!count(Currency::getCurrencies())) return ''; - $this->context->smarty->assign('currencies', $currencies); + return $this->display(__FILE__, 'blockcurrencies.tpl'); } - + public function hookHeader($params) { if (Configuration::get('PS_CATALOG_MODE')) diff --git a/modules/blockcurrencies/blockcurrencies.tpl b/modules/blockcurrencies/blockcurrencies.tpl index 5e52ee819..b64f93536 100644 --- a/modules/blockcurrencies/blockcurrencies.tpl +++ b/modules/blockcurrencies/blockcurrencies.tpl @@ -1,5 +1,5 @@ {* -* 2007-2011 PrestaShop +* 2007-2011 PrestaShop * * NOTICE OF LICENSE * diff --git a/modules/blocklanguages/blocklanguages.php b/modules/blocklanguages/blocklanguages.php index 91ba7d20b..cf0e3e888 100644 --- a/modules/blocklanguages/blocklanguages.php +++ b/modules/blocklanguages/blocklanguages.php @@ -1,6 +1,6 @@ getProductLink((int)$id_product, $infos['link_rewrite'], $infos['category_rewrite'], $infos['ean13'], (int)$infos['id_lang']); } - + if ($phpSelf == 'category.php' AND $id_category = (int)Tools::getValue('id_category')) { $rewrite_infos = Category::getUrlRewriteInformations((int)$id_category); foreach ($rewrite_infos AS $infos) $default_rewrite[$infos['id_lang']] = $link->getCategoryLink((int)$id_category, $infos['link_rewrite'], $infos['id_lang']); } - + if ($phpSelf == 'cms.php' AND ($id_cms = (int)Tools::getValue('id_cms') OR $id_cms_category = (int)Tools::getValue('id_cms_category'))) { $rewrite_infos = (isset($id_cms) AND !isset($id_cms_category)) ? CMS::getUrlRewriteInformations($id_cms) : CMSCategory::getUrlRewriteInformations($id_cms_category); @@ -92,13 +92,12 @@ class BlockLanguages extends Module } } if (count($default_rewrite)) - $smarty->assign('lang_rewrite_urls', $default_rewrite); + $this->smartyAssign('lang_rewrite_urls', $default_rewrite); } - - $this->context->smarty->assign('languages', $languages); + return $this->display(__FILE__, 'blocklanguages.tpl'); } - + function hookHeader($params) { $this->context->controller->addCSS($this->_path.'blocklanguages.css', 'all'); diff --git a/modules/blocklanguages/blocklanguages.tpl b/modules/blocklanguages/blocklanguages.tpl index 72ce067c4..c551191f6 100644 --- a/modules/blocklanguages/blocklanguages.tpl +++ b/modules/blocklanguages/blocklanguages.tpl @@ -31,8 +31,8 @@
  • {if $language.iso_code != $lang_iso} {assign var=indice_lang value=$language.id_lang} - {if isset($lang_rewrite_urls.$indice_lang)} - + {if isset($blocklanguages_lang_rewrite_urls.$indice_lang)} + {else} {/if} diff --git a/modules/blockmanufacturer/blockmanufacturer.php b/modules/blockmanufacturer/blockmanufacturer.php index 2da14cbc0..691c9fe3d 100644 --- a/modules/blockmanufacturer/blockmanufacturer.php +++ b/modules/blockmanufacturer/blockmanufacturer.php @@ -1,6 +1,6 @@ registerHook('leftColumn') AND $this->registerHook('header')); } - + function hookLeftColumn($params) { $this->context->smarty->assign(array( 'manufacturers' => Manufacturer::getManufacturers(), - 'link' => $this->context->link, 'text_list' => Configuration::get('MANUFACTURER_DISPLAY_TEXT'), 'text_list_nb' => Configuration::get('MANUFACTURER_DISPLAY_TEXT_NB'), 'form_list' => Configuration::get('MANUFACTURER_DISPLAY_FORM'), @@ -65,12 +64,12 @@ class BlockManufacturer extends Module )); return $this->display(__FILE__, 'blockmanufacturer.tpl'); } - + function hookRightColumn($params) { return $this->hookLeftColumn($params); } - + function getContent() { $output = '

    '.$this->displayName.'

    '; @@ -96,7 +95,7 @@ class BlockManufacturer extends Module } return $output.$this->displayForm(); } - + public function displayForm() { $output = ' @@ -124,9 +123,9 @@ class BlockManufacturer extends Module '; return $output; } - + function hookHeader($params) { $this->context->controller->addCSS(($this->_path).'blockmanufacturer.css', 'all'); - } + } } diff --git a/modules/blocknewproducts/blocknewproducts.php b/modules/blocknewproducts/blocknewproducts.php index 7d30f3ba6..740b43fea 100644 --- a/modules/blocknewproducts/blocknewproducts.php +++ b/modules/blocknewproducts/blocknewproducts.php @@ -1,6 +1,6 @@ id_lang), 0, (int)(Configuration::get('NEW_PRODUCTS_NBR'))); if (!$newProducts AND !Configuration::get('PS_BLOCK_NEWPRODUCTS_DISPLAY')) return; - $this->context->smarty->assign(array('new_products' => $newProducts, 'mediumSize' => Image::getSize('medium'))); + + $this->smartyAssign(array( + 'new_products' => $newProducts, + 'mediumSize' => Image::getSize('medium'), + )); return $this->display(__FILE__, 'blocknewproducts.tpl'); } - + public function hookLeftColumn($params) { return $this->hookRightColumn($params); } - + public function hookHeader($params) { $this->context->controller->addCSS(($this->_path).'blocknewproducts.css', 'all'); diff --git a/modules/blocknewproducts/blocknewproducts.tpl b/modules/blocknewproducts/blocknewproducts.tpl index 411fba6a4..5063403c0 100644 --- a/modules/blocknewproducts/blocknewproducts.tpl +++ b/modules/blocknewproducts/blocknewproducts.tpl @@ -1,5 +1,5 @@ {* -* 2007-2011 PrestaShop +* 2007-2011 PrestaShop * * NOTICE OF LICENSE * @@ -28,16 +28,16 @@

    {l s='New products' mod='blocknewproducts'}

    - {if $new_products !== false} + {if $blocknewproducts_new_products !== false}
      - {foreach from=$new_products item='product' name='newProducts'} + {foreach from=$blocknewproducts_new_products item='product' name='newProducts'} {if $smarty.foreach.newProducts.index < 2} - {$product.legend|escape:html:'UTF-8'} + {$product.legend|escape:html:'UTF-8'} {/if} {/foreach}
    - {foreach from=$new_products item=newproduct name=myLoop} + {foreach from=$blocknewproducts_new_products item=newproduct name=myLoop}
    {$newproduct.name|strip_tags|escape:html:'UTF-8'}
    {if $newproduct.description_short}
    {$newproduct.description_short|strip_tags:'UTF-8'|truncate:50:'...'} >>
    {/if} {/foreach} diff --git a/modules/blockspecials/blockspecials.php b/modules/blockspecials/blockspecials.php index 8b2a0ff62..cce97310a 100644 --- a/modules/blockspecials/blockspecials.php +++ b/modules/blockspecials/blockspecials.php @@ -1,6 +1,6 @@ id_lang) AND !Configuration::get('PS_BLOCK_SPECIALS_DISPLAY')) return; - $this->context->smarty->assign(array( + + $this->smartyAssign(array( 'special' => $special, 'priceWithoutReduction_tax_excl' => Tools::ps_round($special['price_without_reduction'], 2), - 'mediumSize' => Image::getSize('medium') + 'mediumSize' => Image::getSize('medium'), )); - + return $this->display(__FILE__, 'blockspecials.tpl'); } - + public function hookLeftColumn($params) { return $this->hookRightColumn($params); } - + public function hookHeader($params) { if (Configuration::get('PS_CATALOG_MODE')) diff --git a/modules/blockspecials/blockspecials.tpl b/modules/blockspecials/blockspecials.tpl index ebf13debe..d0bd12774 100644 --- a/modules/blockspecials/blockspecials.tpl +++ b/modules/blockspecials/blockspecials.tpl @@ -29,22 +29,22 @@

    {l s='Specials' mod='blockspecials'}

    -{if $special} +{if $blockspecials_special}
    • - {$special.legend|escape:html:'UTF-8'} + {$blockspecials_special.legend|escape:html:'UTF-8'}
    • -
      {$special.name|escape:html:'UTF-8'}
      - {if !$priceDisplay}{displayWtPrice p=$special.price_without_reduction}{else}{displayWtPrice p=$priceWithoutReduction_tax_excl}{/if} - {if $special.specific_prices} - {assign var='specific_prices' value=$special.specific_prices} +
      {$blockspecials_special.name|escape:html:'UTF-8'}
      + {if !$priceDisplay}{displayWtPrice p=$blockspecials_special.price_without_reduction}{else}{displayWtPrice p=$blockspecials_priceWithoutReduction_tax_excl}{/if} + {if $blockspecials_special.specific_prices} + {assign var='specific_prices' value=$blockspecials_special.specific_prices} {if $specific_prices.reduction_type == 'percentage' && ($specific_prices.from == $specific_prices.to OR ($smarty.now|date_format:'%Y-%m-%d %H:%M:%S' <= $specific_prices.to && $smarty.now|date_format:'%Y-%m-%d %H:%M:%S' >= $specific_prices.from))} (-{$specific_prices.reduction*100|floatval}%) {/if} {/if} - {if !$priceDisplay}{displayWtPrice p=$special.price}{else}{displayWtPrice p=$special.price_tax_exc}{/if} + {if !$priceDisplay}{displayWtPrice p=$blockspecials_special.price}{else}{displayWtPrice p=$blockspecials_special.price_tax_exc}{/if}

    diff --git a/modules/blockuserinfo/blockuserinfo.php b/modules/blockuserinfo/blockuserinfo.php index 2ffc1952a..d83036b4c 100644 --- a/modules/blockuserinfo/blockuserinfo.php +++ b/modules/blockuserinfo/blockuserinfo.php @@ -1,6 +1,6 @@ need_instance = 0; parent::__construct(); - + $this->displayName = $this->l('User info block'); $this->description = $this->l('Adds a block that displays information about the customer.'); } @@ -59,7 +59,8 @@ class BlockUserInfo extends Module { if (!$this->active) return; - $this->context->smarty->assign(array( + + $this->smartyAssign(array( 'cart' => $this->context->cart, 'cart_qties' => $this->context->cart->nbProducts(), 'logged' => $this->context->customer->isLogged(), @@ -70,7 +71,7 @@ class BlockUserInfo extends Module )); return $this->display(__FILE__, 'blockuserinfo.tpl'); } - + public function hookHeader($params) { $this->context->controller->addCSS(($this->_path).'blockuserinfo.css', 'all'); diff --git a/modules/blockuserinfo/blockuserinfo.tpl b/modules/blockuserinfo/blockuserinfo.tpl index 68109bc80..cbacb5941 100644 --- a/modules/blockuserinfo/blockuserinfo.tpl +++ b/modules/blockuserinfo/blockuserinfo.tpl @@ -1,5 +1,5 @@ {* -* 2007-2011 PrestaShop +* 2007-2011 PrestaShop * * NOTICE OF LICENSE * @@ -28,8 +28,8 @@

    {l s='Welcome' mod='blockuserinfo'}, - {if $logged} - {$firstName} {$lastName} + {if $blockuserinfo_logged} + {$blockuserinfo_firstName} {$blockuserinfo_lastName} ({l s='Log out' mod='blockuserinfo'}) {else} {l s='Log in' mod='blockuserinfo'} @@ -38,22 +38,22 @@

      {if !$PS_CATALOG_MODE}
    • - {l s='Cart:' mod='blockuserinfo'} - {$cart_qties} - {l s='product' mod='blockuserinfo'} - {l s='products' mod='blockuserinfo'} - {if $cart_qties >= 0} - + {l s='Cart:' mod='blockuserinfo'} + {$blockuserinfo_cart_qties} + {l s='product' mod='blockuserinfo'} + {l s='products' mod='blockuserinfo'} + {if $blockuserinfo_cart_qties >= 0} + {if $priceDisplay == 1} {assign var='blockuser_cart_flag' value='Cart::BOTH_WITHOUT_SHIPPING'|constant} - {convertPrice price=$cart->getOrderTotal(false, $blockuser_cart_flag)} + {convertPrice price=$blockuserinfo_cart->getOrderTotal(false, $blockuser_cart_flag)} {else} {assign var='blockuser_cart_flag' value='Cart::BOTH_WITHOUT_SHIPPING'|constant} - {convertPrice price=$cart->getOrderTotal(true, $blockuser_cart_flag)} + {convertPrice price=$blockuserinfo_cart->getOrderTotal(true, $blockuser_cart_flag)} {/if} {/if} - {l s='(empty)' mod='blockuserinfo'} + {l s='(empty)' mod='blockuserinfo'}
    • {/if}
    • {l s='Your Account' mod='blockuserinfo'}
    • diff --git a/modules/homefeatured/homefeatured.php b/modules/homefeatured/homefeatured.php index 0fa27f833..205af1373 100644 --- a/modules/homefeatured/homefeatured.php +++ b/modules/homefeatured/homefeatured.php @@ -1,6 +1,6 @@ need_instance = 0; parent::__construct(); - + $this->displayName = $this->l('Featured Products on the homepage'); $this->description = $this->l('Displays Featured Products in the middle of your homepage.'); } @@ -82,7 +82,7 @@ class HomeFeatured extends Module

      '.$this->l('The number of products displayed on homepage (default: 10).').'

      - +
      @@ -95,10 +95,12 @@ class HomeFeatured extends Module $category = new Category(Context::getContext()->shop->getCategory(), Configuration::get('PS_LANG_DEFAULT')); $nb = (int)(Configuration::get('HOME_FEATURED_NBR')); $products = $category->getProducts($params['cookie']->id_lang, 1, ($nb ? $nb : 10)); - $this->context->smarty->assign(array( - 'products' => $products, - 'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'), - 'homeSize' => Image::getSize('home'))); + + $this->smartyAssign(array( + 'products' => $products, + 'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'), + 'homeSize' => Image::getSize('home'), + )); return $this->display(__FILE__, 'homefeatured.tpl'); } diff --git a/modules/homefeatured/homefeatured.tpl b/modules/homefeatured/homefeatured.tpl index 6a3f000a8..b977fc076 100644 --- a/modules/homefeatured/homefeatured.tpl +++ b/modules/homefeatured/homefeatured.tpl @@ -1,5 +1,5 @@ {* -* 2007-2011 PrestaShop +* 2007-2011 PrestaShop * * NOTICE OF LICENSE * @@ -27,23 +27,23 @@
  • {$discount.name|cat:' : '|cat:$discount.description|truncate:18:'...'|escape:'htmlall':'UTF-8'} -{if $discount.value_real != '!'}{if $priceDisplay == 1}{convertPrice price=$discount.value_tax_exc}{else}{convertPrice price=$discount.value_real}{/if}{/if}{l s='Delete'}{l s='Delete'}