Jump to content

featured products in 404 page


Recommended Posts

check this:

http://www.prestashop.com/forums/topic/282804-solved-can-i-add-best-sales-block-to-404-error-page/

 

very similar, you can just change

$this->context->smarty->assign(array(
  'bestsales' => ProductSale::getBestSales($this->context->language->id,0,10)
));

to 

$category = new Category(Context::getContext()->shop->getCategory(), (int)Context::getContext()->language->id);
$nb = (int)Configuration::get('HOME_FEATURED_NBR');
$this->context->smarty->assign(array( 'bestsales' => $category->getProducts((int)Context::getContext()->language->id, 1, ($nb ? $nb : 8), 'position')));

 

  • Like 1
Link to comment
Share on other sites

so, what's going on in this case? :) does it work as you expected?

 

totally works.

if i want to show the best seller instead, the code is this or in PS16 has changed?

$this->context->smarty->assign(array(  'bestsales' => ProductSale::getBestSales($this->context->language->id,0,10)
));
Link to comment
Share on other sites

  • 3 months later...

this code doesnt work anymore..any help?

i get the notice:

Notice: Undefined index: bestsales in [...]/public_html/cache/smarty/compile/42/01/80/42018083f6a2647621344aad5074c3fa15de4b91.file.404.tpl.php on line 62

my 404.tpl has just this line

{include file="./product-list.tpl" products=$bestsales}

Edited by alfredopacino (see edit history)
Link to comment
Share on other sites

×
×
  • Create New...