Dahl99 Posted March 15, 2014 Share Posted March 15, 2014 (edited) Hi, I'd like to place the Home Text Editor at the top of the page under the menu. I found this thread http://www.prestashop.com/forums/topic/244935-solved-home-text-editor-how-to-display-it-only-on-homepage/?hl=%2Bdisplay+%2Bhome+%2Btext+%2Beditor+%2Btop+%2Bpage&do=findComment&comment=1213609 and in it there are two suggestions. Quote Edit "tpl" of the module and add{if $page_name=='index') code_module {/if} Quote you have to add in module .php file this function: public function hookDisplayTop($params) { if (!$this->isCached('editorial.tpl', $this->getCacheId())) { $id_shop = (int)$this->context->shop->id; $editorial = EditorialClass::getByIdShop($id_shop); if (!$editorial) return; $editorial = new EditorialClass((int)$editorial->id, $this->context->language->id); if (!$editorial) return; $this->smarty->assign(array( 'editorial' => $editorial, 'default_lang' => (int)$this->context->language->id, 'image_width' => Configuration::get('EDITORIAL_IMAGE_WIDTH'), 'image_height' => Configuration::get('EDITORIAL_IMAGE_HEIGHT'), 'id_lang' => $this->context->language->id, 'homepage_logo' => !Configuration::get('EDITORIAL_IMAGE_DISABLE') && file_exists('modules/editorial/homepage_logo_'.(int)$id_shop.'.jpg'), 'image_path' => $this->_path.'homepage_logo_'.(int)$id_shop.'.jpg' )); } return $this->display(__FILE__, 'editorial.tpl', $this->getCacheId()); } Which is the best solution and which file and where in the file do I put the code. Thank you. Edited March 19, 2014 by Dahl99 (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted March 15, 2014 Share Posted March 15, 2014 i suppose that you have to use both of them it's because you have to: modify module php file (long code that you pasted) and then in module tpl file modify the appearance of text only for index page. Link to comment Share on other sites More sharing options...
Dahl99 Posted March 18, 2014 Author Share Posted March 18, 2014 Hi Vekia, is it the editorial.php and editorial.tpl files I need to add this code to? And where in the files? Thank you. Link to comment Share on other sites More sharing options...
vekia Posted March 18, 2014 Share Posted March 18, 2014 Quote public function hookDisplayTop($params) { if (!$this->isCached('editorial.tpl', $this->getCacheId())) { $id_shop = (int)$this->context->shop->id; $editorial = EditorialClass::getByIdShop($id_shop); if (!$editorial) return; $editorial = new EditorialClass((int)$editorial->id, $this->context->language->id); if (!$editorial) return; $this->smarty->assign(array( 'editorial' => $editorial, 'default_lang' => (int)$this->context->language->id, 'image_width' => Configuration::get('EDITORIAL_IMAGE_WIDTH'), 'image_height' => Configuration::get('EDITORIAL_IMAGE_HEIGHT'), 'id_lang' => $this->context->language->id, 'homepage_logo' => !Configuration::get('EDITORIAL_IMAGE_DISABLE') &&file_exists('modules/editorial/homepage_logo_'.(int)$id_shop.'.jpg'), 'image_path' => $this->_path.'homepage_logo_'.(int)$id_shop.'.jpg' )); } return $this->display(__FILE__, 'editorial.tpl', $this->getCacheId()); } add this before last closing bracket in editorial.php file 1 Link to comment Share on other sites More sharing options...
Dahl99 Posted March 18, 2014 Author Share Posted March 18, 2014 (edited) Worked a treat. Edited March 19, 2014 by Dahl99 (see edit history) Link to comment Share on other sites More sharing options...
computer_guy Posted August 6, 2014 Share Posted August 6, 2014 I tried this code on version 1.6 and I got a blank page by live edit. Link to comment Share on other sites More sharing options...
vekia Posted August 6, 2014 Share Posted August 6, 2014 can you show your modified file, please? 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