Jump to content

Display newsletter block in a CMS page


swiftlemur

Recommended Posts

Hi,

 

Does anyone know how to include the blocknewsletter into a CMS page. I can get it to display including the .tpl file. However, it doesn't display like it does in the footer and the smarty variables do not appear to be available to it. It therefore doesn't show the success and error messages when you submit.

 

It does however allow you to submit/subscribe an email address. It shows the error in the footer if the block is enabled there. Thanks in advance for any help on this.

 

Thanks

 

VInce

Link to comment
Share on other sites

  • 2 weeks later...

No, the newsletter block can't be placed in the footer by default. You will need to edit modules/blocknewsletter/blocknewsletter.php and add the following before the last }

 

function hookFooter($params)
{
return $this->hookLeftColumn($params);
}

 

Now, when you transplant the newsletter block into the footer, it should display the same way as it does in the left column. You will need to edit themes/<your_theme>/css/modules/blocknewsletter/blocknewsletter.css to change the appearance of the newsletter block. If you need to change the HTML, you will need to copy modules/blocknewsletter/blocknewsletter.tpl to themes/<your_theme>/modules/blocknewsletter/blocknewsletter.tpl.

Link to comment
Share on other sites

Answer to my own question, yes it is.

 

1) create a new hook in the table ps_hook f.e. 'Newsletter'

2) add the newletter block to the new hook

3) edit classes/FrontController.php:



self::$smarty->assign(array(
'HOOK_HEADER' => Module::hookExec('header'),
'HOOK_TOP' => Module::hookExec('top'),
'HOOK_LEFT_COLUMN' => Module::hookExec('leftColumn'),
'HOOK_NEWSLETTER' => Module::hookExec('Newsletter')

 

4) edit themes/[your-theme]/cms.tpl



{if $cms->id == 8}
{$HOOK_NEWSLETTER}
{/if}

 

 

That works for me! :)

  • Like 1
Link to comment
Share on other sites

  • 1 month later...

Answer to my own question, yes it is.

 

1) create a new hook in the table ps_hook f.e. 'Newsletter'

2) add the newletter block to the new hook

3) edit classes/FrontController.php:



self::$smarty->assign(array(
'HOOK_HEADER' => Module::hookExec('header'),
'HOOK_TOP' => Module::hookExec('top'),
'HOOK_LEFT_COLUMN' => Module::hookExec('leftColumn'),
'HOOK_NEWSLETTER' => Module::hookExec('Newsletter')

 

4) edit themes/[your-theme]/cms.tpl



{if $cms->id == 8}
{$HOOK_NEWSLETTER}
{/if}

 

 

That works for me! :)

 

At whate line do i need to edit the front controller ?

Link to comment
Share on other sites

If i put this in the frontcontroller.php

Then i get a error code , and my shop is nog working.

 

self::$smarty->assign(array(

'HOOK_HEADER' => Module::hookExec('header'),

'HOOK_TOP' => Module::hookExec('top'),

'HOOK_LEFT_COLUMN' => Module::hookExec('leftColumn'),

'HOOK_NEWSLETTER' => Module::hookExec('Newsletter')

Link to comment
Share on other sites

If i put this in the frontcontroller.php

Then i get a error code , and my shop is nog working.

 

self::$smarty->assign(array(

'HOOK_HEADER' => Module::hookExec('header'),

'HOOK_TOP' => Module::hookExec('top'),

'HOOK_LEFT_COLUMN' => Module::hookExec('leftColumn'),

'HOOK_NEWSLETTER' => Module::hookExec('Newsletter')

 

Anyone ?

Link to comment
Share on other sites

  • 1 year later...

hi all, I made this change for prestashop 1.5.4 ... with some modification works but there is a problem :

 

if I try to insert in new block newsletter in cms page an email, redirects me in home page..this due to the file blocknewsletter.tpl ?

 

is probably the cause this code ?

 

<form class="navbar-form pull-left" action="{$link->getPageLink('index')}" method="post">

 

please help me!

Link to comment
Share on other sites

  • 4 months later...
  • 5 months later...

is it possible to do {if $cms->id = 3} in another module, say, the Minic Slider?...

 

I have several CMS pages, and im trying to prevent the Minic Slider to be shown on certain CMS pages like the terms and conditions page. I heard the best way to solve this is by adding a condition. but im stuck!...

 

{$cms->id} returns nothing for me in the front.tpl of minic slider.

 

if there's another way to solve this as well, please inform me :)

 

thanks in advance

 

 

UPDATE:  This helped a lot, should help those in the same situation: http://www.prestashop.com/forums/topic/266802-adding-cms-page-ids-to-class-selector-in-body-tag/?p=1332304

Edited by amjo (see edit history)
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...