Jump to content

Show all product in the home page


yazane

Recommended Posts

well, by default it isn't possible, only with modifications and it will not be as easy as it seems. 

you will need to modify module .tpl file and also core (.php file)

 

for example.

$products = $category->getProducts((int)Context::getContext()->language->id, 1, ($nb ? $nb : 8));

this is definition of home cateogry, all products are stored in $products variable. define $products2 variable and $products3 variable with different categories, for example categories with id: 3 and 4

$products2 = $category->getProducts(3, 1, ($nb ? $nb : 8));
$products3 = $category->getProducts(4, 1, ($nb ? $nb : 8));

then attach these variables to smarty array, just modify code to:

$this->smarty->assign(array(
'products' => $products,
'products3' => $products3,
'products4' => $products4,
'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'),
'homeSize' => Image::getSize(ImageType::getFormatedName('home')),
));

now you can modify .tpl file to display these products, just duplicate code and change foreach function item from $products to products3 and then to $products4

  • Like 1
Link to comment
Share on other sites

  • 4 weeks later...

How can I list all the links to products in the home category on the category block, instead of categories.

 

I want to do away with this:

<ul class="tree {if $isDhtml}dhtml{/if}">
		{foreach from=$blockCategTree.children item=child name=blockCategTree}
			{if $smarty.foreach.blockCategTree.last}
				{include file="$branche_tpl_path" node=$child last='true'}
			{else}
				{include file="$branche_tpl_path" node=$child}
			{/if}
		{/foreach}
		</ul>

And just loop through all the products in the home category instead of the categories. Thanks for your help. I am sorry, but I am not very familiar with prestashop file names.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...