othreed Posted December 23, 2015 Share Posted December 23, 2015 Hi, I am new to prestashop and do not know which file to edit to include products on the 404 error page. Can someone please post some instructions on where to edit which file? I am using 1.6.1.3 Prestashop I read this article https://www.prestashop.com/forums/topic/341923-solved-how-to-display-products-on-404-page/?do=findComment&comment=1724971but it does not contain any instruction. thanks for any help Link to comment Share on other sites More sharing options...
Daresh Posted December 23, 2015 Share Posted December 23, 2015 It does contain instructions to add {hook::exec('displayHomeTabContent')} Link to comment Share on other sites More sharing options...
othreed Posted December 23, 2015 Author Share Posted December 23, 2015 yes it contains some lines of code... but where does it need to be placed? and which file should. e edited? thanks for any help Link to comment Share on other sites More sharing options...
Daresh Posted December 24, 2015 Share Posted December 24, 2015 I would try the 404.tpl in your theme's folder. Link to comment Share on other sites More sharing options...
othreed Posted December 24, 2015 Author Share Posted December 24, 2015 (edited) This is the content of 404.tpl {* * 2007-2015 PrestaShop * * NOTICE OF LICENSE * * This source file is subject to the Academic Free License (AFL 3.0) * that is bundled with this package in the file LICENSE.txt. * It is also available through the world-wide-web at this URL: * http://opensource.org/licenses/afl-3.0.php * If you did not receive a copy of the license and are unable to * obtain it through the world-wide-web, please send an email * to [email protected] so we can send you a copy immediately. * * DISCLAIMER * * Do not edit or add to this file if you wish to upgrade PrestaShop to newer * versions in the future. If you wish to customize PrestaShop for your * needs please refer to http://www.prestashop.com for more information. * * @author PrestaShop SA <[email protected]> * @copyright 2007-2015 PrestaShop SA * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA *} <div class="pagenotfound"> <h1>{l s='This page is not available'}</h1> <p> {l s='We\'re sorry, but the Web address you\'ve entered is no longer available.'} </p> <h3>{l s='To find a product, please type its name in the field below.'}</h3> <form action="{$link->getPageLink('search')|escape:'html':'UTF-8'}" method="post" class="std"> <fieldset> <div> <label for="search_query">{l s='Search our product catalog:'}</label> <input id="search_query" name="search_query" type="text" class="form-control grey" /> <button type="submit" name="Submit" value="OK" class="btn btn-default button button-small"><span>{l s='Ok'}</span></button> </div> </fieldset> </form> <div class="buttons"><a class="btn btn-default button button-medium" href="{if isset($force_ssl) && $force_ssl}{$base_dir_ssl}{else}{$base_dir}{/if}" title="{l s='Home'}"><span><i class="icon-chevron-left left"></i>{l s='Home page'}</span></a></div> </div> I want to display the products on this pagenotfound how and where should this code be placed?{hook::exec('displayHomeTabContent')} Edited December 24, 2015 by othreed (see edit history) Link to comment Share on other sites More sharing options...
Daresh Posted December 24, 2015 Share Posted December 24, 2015 Try to paste it at the end, you will also need to modify the homefeatured.php module: public function hookHeader($params) { if (isset($this->context->controller->php_self) && ($this->context->controller->php_self == 'index') || ($this->context->controller->php_self == 'pagenotfound')) $this->context->controller->addCSS(_THEME_CSS_DIR_.'product_list.css'); $this->context->controller->addCSS(($this->_path).'css/homefeatured.css', 'all'); } Link to comment Share on other sites More sharing options...
othreed Posted December 24, 2015 Author Share Posted December 24, 2015 thank you for your kind helpI added the following code to file:modules/homefeatured/homefeatured.php public function hookHeader($params) { if ((isset($this->context->controller->php_self) && ($this->context->controller->php_self == 'index') || ($this->context->controller->php_self == 'pagenotfound')) $this->context->controller->addCSS(_THEME_CSS_DIR_.'product_list.css'); $this->context->controller->addCSS(($this->_path).'css/homefeatured.css', 'all'); } but the products are not displayed...any suggestions? Link to comment Share on other sites More sharing options...
Daresh Posted December 24, 2015 Share Posted December 24, 2015 You should not add this code, but use it to modify your hookHeader function. And you should paste the {hook::exec('displayHomeTabContent')} at the end of the 404.tpl. Link to comment Share on other sites More sharing options...
othreed Posted December 24, 2015 Author Share Posted December 24, 2015 (edited) thank you very much for the help & sorry for the misunderstanding After disabling cache it worked I modified the hookHeader function accordingly by adding the code || ($this->context->controller->php_self == 'pagenotfound')) at line 117 and also added the {hook::exec('displayHomeTabContent')} to the end of 404.tpl. now all products which have the category "home" checked are displayed .. Also there are two blue banners with text:1.there are no new products. 2. there are no Discount products now I will try to figure out why it displays thouse banners... Edited December 24, 2015 by othreed (see edit history) Link to comment Share on other sites More sharing options...
Daresh Posted December 24, 2015 Share Posted December 24, 2015 Those banners are displayed because it replicates the tabs behavior from the homepage. And there you have tabs with new, featured and discount products. So it also appears here. I tried to turn it by setting exceptions but it didn't work. But you can hide them with css rules: Try adding this to your global.css: #pagenotfound #blocknewproducts, #pagenotfound #blockbestsellers, #pagenotfound #blockspecials { display: none; } Link to comment Share on other sites More sharing options...
othreed Posted December 24, 2015 Author Share Posted December 24, 2015 perfect thank you soo much happy holidays Link to comment Share on other sites More sharing options...
Daresh Posted December 24, 2015 Share Posted December 24, 2015 Thanks, same to you and many sales in 2016 :-) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now