Jump to content

HELP!!! Prestashop 1.6 Home featured Paginatinon


ifecastro

Recommended Posts

Hello guys!

I've been trying to add pagination to help navigate through my products as I have lots of products to display.

I saw a post where a codes where dropped but I don't know how to implement it, cause whenever I try, the home page goes blank.

Please come to my aid.

Below is the code, how do I implement it.

 

ROOT / themes / YOUR_THEME / modules / homefeatured / homefeatured.tp

{if isset($products) && $products}
	{include file="$tpl_dir./product-list.tpl" class='homefeatured tab-pane' id='homefeatured'}	
	{include file="$tpl_dir./pagination.tpl"} 
{else}
	<ul id="homefeatured" class="homefeatured tab-pane">
		<li class="alert alert-info">{l s='No featured products at this time.' mod='homefeatured'}</li>
	</ul>
{/if}

 

ROOT / modules / homefeatured / homefeatured.php

public function hookDisplayHome($params)
{
	$controller = new FrontController();
	$controller->productSort();			
	$category = new Category(Context::getContext()->shop->getCategory(), (int)Context::getContext()->language->id);
	$nbProducts = $category->getProducts((int)Context::getContext()->language->id, NULL, NULL, 'position', NULL, true);
	$controller->pagination($nbProducts);
	$products = $category->getProducts((int)Context::getContext()->language->id, intval($controller->p), intval($controller->n), $controller->orderBy, $controller->orderWay);
		
	$this->smarty->assign(
		array(
			'products' => $products,
			'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'),
			'homeSize' => Image::getSize(ImageType::getFormatedName('home')),
			'nb_products' => $nbProducts,
			'id_category' => (int)$category->id,
			'id_category_parent' => (int)$category->id_parent,
			'g_teste' => $_REQUEST,				
		)
	);
		
	return $this->display(__FILE__, 'homefeatured.tpl' ); 
}

 

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...