dude12 Posted August 6, 2015 Share Posted August 6, 2015 Hi guys, I searched around, but couldn't find a decent answer. I prefer the look and contents of my main category page to the homepage. It there a way to set a category as homepage? Link to comment Share on other sites More sharing options...
Paulito Posted August 6, 2015 Share Posted August 6, 2015 Hello See if this Tutorial helps you https://mypresta.eu/en/art/developer/category-page-as-landing-page-of-your-prestashop.html Paul Link to comment Share on other sites More sharing options...
catalin.scaesteanu Posted August 6, 2015 Share Posted August 6, 2015 (edited) Hello See if this Tutorial helps you https://mypresta.eu/en/art/developer/category-page-as-landing-page-of-your-prestashop.html Paul This tutorial should do the job. Also create an override, don't modify the IndexController directly because when you update prestashop this file will be re-written. More information about overrides here: http://doc.prestashop.com/display/PS16/Overriding+default+behaviors Edited August 6, 2015 by Catalin Scaesteanu (see edit history) Link to comment Share on other sites More sharing options...
dude12 Posted August 6, 2015 Author Share Posted August 6, 2015 I pasted the summary code at the bottom of the tutorial and now home page returns 404. Link to comment Share on other sites More sharing options...
catalin.scaesteanu Posted August 6, 2015 Share Posted August 6, 2015 I pasted the summary code at the bottom of the tutorial and now home page returns 404. I just tested it on a fresh install of ps v1.6.1.0 and it's working. You might get 404 error because you set the wrong category id. Make sure this is set correctly $_GET['id_category'] = 3; -> 3 in this case is the id of Women category from default PrestaShop, yours might be something else. Link to comment Share on other sites More sharing options...
dude12 Posted August 6, 2015 Author Share Posted August 6, 2015 Works! Thanks a million. I'll make the override Link to comment Share on other sites More sharing options...
dude12 Posted August 6, 2015 Author Share Posted August 6, 2015 (edited) class IndexController extends IndexControllerCore { class IndexControllerCore extends CategoryController { public $php_self = 'index'; /** * Assign template vars related to page content * @see FrontController::initContent() */ public function init(){ $_GET['id_category']=12; parent::init(); } public function initContent() { parent::initContent(); } } } Sorry to suck so much at coding, but for the override, do I have to place <?php before class IndexController extends IndexControllerCore? It worked when I directly edited IndexController.php, but now that I'm doing it with an override, it doesn't work with or without <?php Edited August 6, 2015 by dude12 (see edit history) Link to comment Share on other sites More sharing options...
catalin.scaesteanu Posted August 6, 2015 Share Posted August 6, 2015 (edited) Yes you need <?php starting tag in every .php file. 1. Create an empty file IndexController.php in /root/override/controllers/front/ 2. Add the following code to the file: <?php class IndexController extends CategoryControllerCore { public $php_self = 'index'; /** * Assign template vars related to page content * @see FrontController::initContent() */ public function init() { $_GET['id_category'] = 12; parent::init(); } public function initContent() { parent::initContent(); } } 3. Delete file: /root/cache/class_index.php 4. Reload homepage Edited August 6, 2015 by Catalin Scaesteanu (see edit history) 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