alfredopacino Posted March 26, 2014 Share Posted March 26, 2014 as in title, how can i add the featured products block in 404 page? Link to comment Share on other sites More sharing options...
vekia Posted March 27, 2014 Share Posted March 27, 2014 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'))); 1 Link to comment Share on other sites More sharing options...
alfredopacino Posted March 27, 2014 Author Share Posted March 27, 2014 so the code in 404.tpl should be this? {include file="./product-list.tpl" products=$bestsales} Link to comment Share on other sites More sharing options...
Krystian Podemski Posted March 27, 2014 Share Posted March 27, 2014 Yes, of course if your products are already assigned to $bestsales variable. Link to comment Share on other sites More sharing options...
vekia Posted March 27, 2014 Share Posted March 27, 2014 so the code in 404.tpl should be this? {include file="./product-list.tpl" products=$bestsales} so, what's going on in this case? does it work as you expected? Link to comment Share on other sites More sharing options...
alfredopacino Posted March 27, 2014 Author Share Posted March 27, 2014 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 More sharing options...
vekia Posted March 27, 2014 Share Posted March 27, 2014 it will work in ps 1.6 very well :-) tested it a second ago 1 Link to comment Share on other sites More sharing options...
alfredopacino Posted July 16, 2014 Author Share Posted July 16, 2014 (edited) 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 July 16, 2014 by alfredopacino (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts