Jump to content

How to move the newsletter block to the center of the page?


Recommended Posts

I tried to transplant it to the footer, but nothing happen.I can move the newsletter from left to right. But I can not move it to the center or footer. What have I done wrong? I see some sites has the newsletter in the footer and center of the page. Am I missing something?

Link to comment
Share on other sites

You'll need to add a hookFooter function to the modules/blocknewsletter/blocknewsletter.php

See my post here


Thank you Rocky,

I was able to move it to the footer. Thank you. But I am not able to move it to the center of the page. Do you have any ideas which hook I can use to hook it?

Thank you again.
Link to comment
Share on other sites

I don't want it to be on the home page. My boss wants it to be on a single page, and we will put somethings like sign up for newsletter, we will give you 10% off, and then a coupon image. I don't know which hook can set up something in the center column.

Any idea? Thank you a lot for your help.

Link to comment
Share on other sites

In that case, you might need to create your own hook. You could add a hook to the ps_hook database table called "newsletter", then put the newsletter module in the newsletter hook. If you are creating your page as a CMS page, you could add a code block like the following to cms.tpl in your theme directory:

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



where 3 is the id of your cms page. This would display the module only on that CMS page. I haven't tested this, since I don't have time at the moment, but I think it should work.

Link to comment
Share on other sites

Rocky, Thank you for your kind help. I am losing my head.

I create my own hook called newsletter and I put the blocknewsltter under newsletter hook. And then I went to cms.tpl, and I put the code

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

in. But when I typed www.mydomain.com/cms.php?id_cms=6, it said page not found. What have I done wrong? This is my fifth day at my new job, and my boss asks me to do this job since the first day. I keep asking me about this, and I really don't know what I should do.

How does Prstashop set up a hook to be in a certain section of the site? How does Prstashop knows CMS page is going to the center of the page? And the footer hook is going to the bottom? How can I tell the Prstashop that the newsletter hook should go to the center of the page? Nobody know this answer?

Link to comment
Share on other sites

  • 1 month later...
  • 1 year later...

Hi Rocky,

I can't seem to get this to work, can you have a look over what I've done?

http://i38.tinypic.com/2le5dt4.png

It doesn't seem to do anything (no error, but no newsletter either, just the CMS page unchanged).

I double checked the CMS ID too.

Also as you can see in the screenshot, I've just inserted a new row, incrementing the ID (#56). Is this safe to do? Is it possible another script or automatic process might come by and try to increment the last one and then cause an error? Should I make it like ID #999 to be safe?

Cheers

Link to comment
Share on other sites

Why not just created a new page link using the CMS on the backend and just have a link to the newsletter ?


I don't think this is possible because there is nothing to actually link to - these blocks don't open up as their own pages.

I also tried putting the block in an iFrame but I couldn't get it to return back to the main site once someone submitted their email.

I think Rocky's solution is the best, I just can't get it to work!
Link to comment
Share on other sites

You also need to add the following to cms.php before the $smarty->display to pass the contents of the newsletter hook into cms.tpl:

$smarty->assign('HOOK_NEWSLETTER', Module::hookExec('newsletter'));




Hi Rocky, there's no "$smarty->display" in cms.tpl?

Or am I looking in the wrong place?
Link to comment
Share on other sites

Hi Rocky,

Not having much luck with it:

   <?php

include(dirname(__FILE__).'/config/config.inc.php');

//will be initialized bellow...
if(intval(Configuration::get('PS_REWRITING_SETTINGS')) === 1)
   $rewrited_url = null;

include(dirname(__FILE__).'/init.php');

if (($id_cms = intval(Tools::getValue('id_cms'))) AND $cms = new CMS(intval($id_cms), intval($cookie->id_lang)) AND Validate::isLoadedObject($cms))
{
   /* rewrited url set */
   $rewrited_url = $link->getCmsLink($cms, $cms->link_rewrite);

   include(dirname(__FILE__).'/header.php');
   $smarty->assign(array(
       'cms' => $cms,
       'content_only' => intval(Tools::getValue('content_only'))
   ));
   $smarty->assign('HOOK_NEWSLETTER', Module::hookExec('newsletter'));
   $smarty->display(_PS_THEME_DIR_.'cms.tpl');
   include(dirname(__FILE__).'/footer.php');
}
else
   Tools::redirect('404.php');

?>




Also I verified the CMS ID is right: http://i34.tinypic.com/nxn85g.png

Link to comment
Share on other sites

  • 2 months later...

Hello,

I have followed these instructions and it works great... except that when I click on ok for registering nothing happens and I'm sent to the home page.

What should I place on the form action attribute at blocknewsletter.tpl? Now it says {$base_dir}

Thank you in advance

SOLVED: Just deleting {$base_dir} and leaving it empty you get redirected to the same newsletter page and it works ok.

Link to comment
Share on other sites

  • 7 months later...

Done the following but its not working. Just a blank newsletter cms page

http://www.prestashop.com/forums/viewthread/22378/P0/general_discussion/how_to_move_the_newsletter_block_to_the_center_of_the_page


Create cms page for newsletter

######----SQL----#####


INSERT INTO `fcp_presta`.`ps_hook` (`id_hook`, `name`, `title`, `description`, `position`, `live_edit`) VALUES ('101', 'newsletter', 'Newsletter', 'newsletter hook to cms page', '1', '0');

############---INSERT INTO CMS.TPL (template folder)---#################

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


#WHERE 12 IS THE ID OF MY CMS PAGE

############---INSERT INTO CMS.PHP (shop root folder)---#################

$smarty->assign('HOOK_NEWSLETTER', Module::hookExec('newsletter'));


##########---modules/blocknewsletter/blocknewsletter.php---#############

###CHANGE

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


###TO

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


#######---blocknewsletter.tpl---###########

###change



###to



#########---Prestashop Back office

Modules -> Position -> Transplant a module

Module: Newsletter Block
Hook into: Newsletter

Save

Link to comment
Share on other sites

×
×
  • Create New...