NemoPS Posted August 20, 2014 Share Posted August 20, 2014 Hey everyone! Following up a post in the forums I just wrote a short article on how to add hooks to cms pages, and target specific ones too, here it is!http://nemops.com/how-to-hooks-prestashop-cms/#.U_RXL_na6r0 Cheers! 1 Link to comment Share on other sites More sharing options...
Paulito Posted August 20, 2014 Share Posted August 20, 2014 Hello Nemo Thank you for another great tutorial. It would be a nice idea if tutorials like these could be pinned somewhere on the forum to help members who may miss this post Paul 1 Link to comment Share on other sites More sharing options...
NemoPS Posted August 20, 2014 Author Share Posted August 20, 2014 Hm well yeah, if Benjamin Utterback reads your post Thanks! Link to comment Share on other sites More sharing options...
kdmonk1 Posted November 15, 2014 Share Posted November 15, 2014 Hm well yeah, if Benjamin Utterback reads your post Thanks! Hey everyone! Following up a post in the forums I just wrote a short article on how to add hooks to cms pages, and target specific ones too, here it is! http://nemops.com/how-to-hooks-prestashop-cms/#.U_RXL_na6r0 Cheers! Hi Nemo1, This a great tutorial by the way! I would like to take this approach further by adding the newsletter block into my cms page. Right now I have a Pop Up that I bought from Vekia, which works great but in this pop up I would like to add the newsletter block so customers could sign up for deals and so forth. I would assume the files that need to be touched are /modules/blocknewsletter/newsletter.php At the moment I am totally lost on where to place the file that you gave in the example: I tried placing it here but my site produces a blank page. (/newsletter.php) public function install() { if (!parent::install() || !$this->registerHook(array('header', 'footer', 'actionCustomerAccountAdd'))) return false; || !$this->registerHook('customCMS') I am currently using the default template for Prestashop 1.6.0.9 and my goal is to get the newsletter hook (Enter your e-mail) into a pop up. (http://mypresta.eu/modules/front-office-features/prestashop-popup-pro.html) Any thoughts how I can make this work? Link to comment Share on other sites More sharing options...
vekia Posted November 15, 2014 Share Posted November 15, 2014 I am currently using the default template for Prestashop 1.6.0.9 and my goal is to get the newsletter hook (Enter your e-mail) into a pop up. (http://mypresta.eu/modules/front-office-features/prestashop-popup-pro.html) Any thoughts how I can make this work? module allows to use custom code, you don't need hook to place custom code inside module. it means that you can create signup form without core / theme modifications. just paste code with form to popup. Link to comment Share on other sites More sharing options...
kdmonk1 Posted November 15, 2014 Share Posted November 15, 2014 module allows to use custom code, you don't need hook to place custom code inside module. it means that you can create signup form without core / theme modifications. just paste code with form to popup. Hi Vekia, I have the custom code ready to go: <form id="form1" name="form1" method="post" action=""> <label for="email">email</label> <input type="text" name="email" id="email" /> </form> When a customer comes to my site, the pop up shows and inside the pop up is the email form. How would I make the connection to the database when the customer clicks the submit button? I have searched for examples but none come close to what I am trying to achieve. If I can get this working, then this would be a great advantage to your pop up module. Link to comment Share on other sites More sharing options...
kdmonk1 Posted November 20, 2014 Share Posted November 20, 2014 Any feedback on this? Link to comment Share on other sites More sharing options...
vekia Posted November 21, 2014 Share Posted November 21, 2014 Hi Vekia, I have the custom code ready to go: <form id="form1" name="form1" method="post" action=""> <label for="email">email</label> <input type="text" name="email" id="email" /> </form> When a customer comes to my site, the pop up shows and inside the pop up is the email form. How would I make the connection to the database when the customer clicks the submit button? I have searched for examples but none come close to what I am trying to achieve. If I can get this working, then this would be a great advantage to your pop up module. if you will use newsletter module (installed and enabled), use the same <form> id and name, the same with <input> fields after submit, module will insert these datas into database if you want to use own <input> totally not related to newsletter module you have to create php script to handle form datas Link to comment Share on other sites More sharing options...
TDarko Posted December 20, 2014 Share Posted December 20, 2014 Hi Vekia and Nemo, how would you transplant modules to custom hooks with the newest version of prestashop? As the module files are no longer .php extensions but tpl and the advice given above seems to not be working anymore? If you could just help me out with this, it would be greatly appreciated. thank you. Link to comment Share on other sites More sharing options...
NemoPS Posted December 20, 2014 Author Share Posted December 20, 2014 ?Modules are still php, I don't understand what you mean really You just have to add hookHOOKNAME($params) as method Link to comment Share on other sites More sharing options...
IngeOmar Posted May 14, 2015 Share Posted May 14, 2015 Hi excuse me, i´ll been trying to hook the 'content box' into a specific cms page, i followed your tutorial, but the content shows up in every cms page and also in the footer : / can you help me? Link to comment Share on other sites More sharing options...
NemoPS Posted May 15, 2015 Author Share Posted May 15, 2015 Vekia's module?In any case, you need to make sure you target the proper ID Link to comment Share on other sites More sharing options...
IngeOmar Posted May 15, 2015 Share Posted May 15, 2015 Vekia's module? In any case, you need to make sure you target the proper ID No, emotionloop´s module 'contentbox' the <if> restriction it´s the same for prestashop 1.6.0.13 ? also it´s in the php module file or it´s in the tpl CMS file? : ( Link to comment Share on other sites More sharing options...
NemoPS Posted May 16, 2015 Author Share Posted May 16, 2015 Yes, it's the same. You can do it from the php side, or smarty's, but I'd suggest using php and return false in case the id doesn't matchif(Tools::getValue('id_cms') != 2) return false;Unless you are using some id-removal module that doesn't reassign the id_cms value Link to comment Share on other sites More sharing options...
Do You Speak Graphic Posted May 22, 2015 Share Posted May 22, 2015 Hello evrybody... Hope somebody can help. I'm using Prestashop (version 1.6.0.14) along with Warehouse theme (http://warehouse.iqit-commerce.com/selector/index1.html) which comes with Revolution Slider (http://revolution.themepunch.com/prestashop/)... Revoltion Slider lets me choose in which hook to appear but its limited to home page. The idea is to create a custom hook for CMS pages and insert the Revolution Slider in there. I've tried to follow the tutorial to create a custom hook, without success... Can anybody explain in dummy words how to achieve this purpose? Thanks in advance... Link to comment Share on other sites More sharing options...
NemoPS Posted May 23, 2015 Author Share Posted May 23, 2015 Where are you having trouble, exactly? Link to comment Share on other sites More sharing options...
Sylv1c Posted November 17, 2015 Share Posted November 17, 2015 Vekia's module? In any case, you need to make sure you target the proper ID Hi Nemo1, I'm experiencing a problem trying to display html page with content box with your tutorial, I changed the cms.tp like this : <!-- hook module --> {if !$content_only} {hook h='customCMS'} {/if} <!-- hook module --> <div class="rte{if $content_only} content_only{/if}"> {$cms->content} </div> I changed the contentbox.php like this : public function install() { if (Shop::isFeatureActive()) Shop::setContext(Shop::CONTEXT_ALL); if (!parent::install() || !$this->registerHook('header') || !$this->registerHook('footer') || !$this->registerHook('customCMS') || !CONTENTBOXModel::createTables()) return false; Configuration::updateValue($this->monolanguage_content, 0); Configuration::updateValue($this->text_editor_content, 1); Configuration::updateValue($this->content_wrapper, 0); Configuration::updateValue($this->content_wrapper_class, ''); Configuration::updateValue($this->content_wrapper_id, ''); $this->_clearCache('template.tpl'); return true; } And added theses code at the end of the contentbox.php : public function hookcustomCMS($params) { return $this->hookDisplayHome($params); } } Thank you by advance for your help, here is the page i tried to modify : http://pariscave.com/content/7-accueil Link to comment Share on other sites More sharing options...
NemoPS Posted November 18, 2015 Author Share Posted November 18, 2015 Did you reset the module afterwards? Link to comment Share on other sites More sharing options...
Sylv1c Posted November 18, 2015 Share Posted November 18, 2015 Did you reset the module afterwards? Hi, what do you mean? how to reset it? Link to comment Share on other sites More sharing options...
NemoPS Posted November 18, 2015 Author Share Posted November 18, 2015 In the modules list, hit reset on it, it might erase all saved data you have there Link to comment Share on other sites More sharing options...
Sylv1c Posted November 18, 2015 Share Posted November 18, 2015 In the modules list, hit reset on it, it might erase all saved data you have there ok,, done, is now showing my code but seems the js is not working... have any idea on how to charge it? Link to comment Share on other sites More sharing options...
NemoPS Posted November 18, 2015 Author Share Posted November 18, 2015 No idea, it might just be the module being broken Link to comment Share on other sites More sharing options...
prestamax Posted July 22, 2016 Share Posted July 22, 2016 Hey everyone! Following up a post in the forums I just wrote a short article on how to add hooks to cms pages, and target specific ones too, here it is! http://nemops.com/how-to-hooks-prestashop-cms/#.U_RXL_na6r0 Cheers! Thanks for this really helpful tutorial! There is a small typo though which might confuse those who are not so familiar with themes. There is a line that reads "Locate your cms.tpl inside the module’s folder" which should actually be "Locate your cms.tpl inside the theme’s folder" This tutorial was exactly what I was looking for. Thanks so much! It works like a charm. Link to comment Share on other sites More sharing options...
NemoPS Posted July 26, 2016 Author Share Posted July 26, 2016 Hey, thanks for spotting, correcting it Link to comment Share on other sites More sharing options...
Remis C Posted September 9, 2016 Share Posted September 9, 2016 Hey guys, Were there any changes in contentbox that broke the hooking method explained in tutorial? I cannot seem to get it working.. I'd like content box to appear in one cms page, yet still getting it on all of them.. PS 1.6.0.11 contentbox v1.1.1 Link to comment Share on other sites More sharing options...
NemoPS Posted September 10, 2016 Author Share Posted September 10, 2016 No idea about that module, you should ask the developer 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