Soulz Posted July 20, 2014 Share Posted July 20, 2014 (edited) Hi, I'm trying to enable newsletter subscription while the site is in maintenance mode. I inserted this line "{include file="$tpl_dir/modules/blocknewsletter/blocknewsletter.tpl"}" in the maintenance .tpl in my theme and the form appears fine but it does not register the adresses into the database like the one in the homepage does. I've searched and I've only found some ancient solutions from 2009 or so. Any ideas for Prestashop 1.6.0.6? Help would be very much appreciated:) Edited July 25, 2014 by Soulz (see edit history) Link to comment Share on other sites More sharing options...
Soulz Posted July 20, 2014 Author Share Posted July 20, 2014 Bump, please help. Link to comment Share on other sites More sharing options...
Paulito Posted July 21, 2014 Share Posted July 21, 2014 Hello Afraid I am not a coder but their is a very nice module here for PS 1.5, I would ask the developers if they will be upgrading this module to PS 1.6 which they are doing to their other modules. I have purchased from them before are they are very helpful http://www.prestacheap.com/items/2/Maintenance-Pro-with-Newsletter-Subscription Paul Link to comment Share on other sites More sharing options...
Soulz Posted July 25, 2014 Author Share Posted July 25, 2014 Bump again. I am looking for a free custom solution without modules. I figured out that putting the site in maintenance mode will block access to the resources the subscription form needs, but I don't know how to give the users access only to the newsletter form without giving them access to the whole site. Link to comment Share on other sites More sharing options...
cedricfontaine Posted July 25, 2014 Share Posted July 25, 2014 Yes, the maintenance mode does affect all the prestashop core. Maybe you can use a temporary solution (like Mailchimp for example) to use an external newsletter subscription box. Link to comment Share on other sites More sharing options...
Soulz Posted July 25, 2014 Author Share Posted July 25, 2014 (edited) That would be the last resort. I was hoping someone knew how to bypass the maintenance mode when the user submits the registration and then return them to the maintenance page. EDIT: SOLVED! For anyone wanting newsletter subscription on your maintenance page without payed modules here's what you do (as of PS 1.6.06): 1) Replace the IP token method with this method (for PS 1.4 and above read Debbie's comment down below) http://alvinjiang.blogspot.ro/2010/10/prestashop-tips-how-to-allow-mutiple.html 2) In your Prestashop back office set your "Maintenance IP" to a word you are going to use with the token above. For example I named it "development" so in order to acces my site you would have to go to http://mysite.com/index.php?MAT=development. This also solves the problem of clients with dynamic IPs trying to access your store while in development. 3) In your theme's maintenance.tpl add these lines wherever you want your newsletter form to appear: {$maintenance_mode = true} {include file="$tpl_dir/modules/blocknewsletter/blocknewsletter.tpl"} 4) In your blocknewsletter.php (located in root/modules/blocknewsletter) search for the function called "private function newsletterRegistration()". At the end of this function, right before its closing } add these lines: if(isset($_GET['MAT']))$_SESSION['MAT'] = $_GET['MAT']; { unset($_SESSION['MAT']); header('Location: index.php'); } 5) In your theme's blocknewsletter.tpl replace the line where the form tag is defined with this: <form action="{if $maintenance_mode == true}{$link->getPageLink('index')|cat:"?MAT=development"|escape:'html':'UTF-8'}{elseif $maintenance_mode == false}{$link->getPageLink('index')|escape:'html':'UTF-8'}{/if}" method="post"> 6) In your theme's header.tpl add this line right after the line "<div id="page">" {$maintenance_mode = false} And you are all done. Tested and working in PS 1.6.06! Edited July 26, 2014 by Soulz (see edit history) Link to comment Share on other sites More sharing options...
Easter21 Posted December 12, 2014 Share Posted December 12, 2014 Bumping because I have a question about the above post. I inserted the newsletter block into my maintenance page and it works great! The thing is, whenever there is an error (like submitting an invalid e-mail address) it returns me to my homepage with an error, not to the maintenance page with an error. This isn't good as I don't want anybody seeing my site yet. Does anybddy have a fix for this? Link to comment Share on other sites More sharing options...
Recommended Posts