How to move the newsletter block to the center of the page?
Started by google-friend, Jul 04 2009 09:24 PM
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?
You'll need to add a hookFooter function to the modules/blocknewsletter/blocknewsletter.php
See my post here
See my post here
Check out Nethercott Constructions for PrestaShop guides and modules. Like us on Facebook for news updates.
From 1246761843:
You'll need to add a hookFooter function to the modules/blocknewsletter/blocknewsletter.php
See my post here
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.
hookHome will put it in the centre of the home page only. Is that what you want?
Check out Nethercott Constructions for PrestaShop guides and modules. Like us on Facebook for news updates.
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.
Any idea? Thank you a lot for your help.
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:
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.
{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.
Check out Nethercott Constructions for PrestaShop guides and modules. Like us on Facebook for news updates.
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
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?
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?
Why not just created a new page link using the CMS on the backend and just have a link to the newsletter ?
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
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
From 1250943800:
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!
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'));
Check out Nethercott Constructions for PrestaShop guides and modules. Like us on Facebook for news updates.
From 1283166549:
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?
Yes, you are looking in the wrong place. It is cms.php that has the $smarty->display, not cms.tpl.
Check out Nethercott Constructions for PrestaShop guides and modules. Like us on Facebook for news updates.
Hi Rocky,
Not having much luck with it:
Also I verified the CMS ID is right: http://i34.tinypic.com/nxn85g.png
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
Make sure that modules/blocknewsletter/blocknewsletter.php has the following code:
function hookNewsletter($params)
{
return $this->hookLeftColumn($params);
}
Check out Nethercott Constructions for PrestaShop guides and modules. Like us on Facebook for news updates.
Thanks Rocky, that worked!
It's not sitting in the centre, I tried adding div align tags to the .tpl file but that didn't work
http://i36.tinypic.com/2m5cups.png
EDIT: woohoo I got it!
in blocknewsletter.tpl:
It's not sitting in the centre, I tried adding div align tags to the .tpl file but that didn't work
http://i36.tinypic.com/2m5cups.png
EDIT: woohoo I got it!
in blocknewsletter.tpl:
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.
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.
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
Any ideas?




Back to top









