[+] MO: Add Module->smartyAssign method, in order to assign variables with module name as prefix in module's templates

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@8718 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
rMalie
2011-09-22 12:05:49 +00:00
parent b24d2fa274
commit 2dbea99b61
19 changed files with 174 additions and 155 deletions
+9 -7
View File
@@ -1,6 +1,6 @@
<?php
/*
* 2007-2011 PrestaShop
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
@@ -42,7 +42,7 @@ class HomeFeatured extends Module
$this->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
<div class="margin-form">
<input type="text" size="5" name="nbr" value="'.Tools::getValue('nbr', (int)(Configuration::get('HOME_FEATURED_NBR'))).'" />
<p class="clear">'.$this->l('The number of products displayed on homepage (default: 10).').'</p>
</div>
<center><input type="submit" name="submitHomeFeatured" value="'.$this->l('Save').'" class="button" /></center>
</fieldset>
@@ -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');
}