Please note that PrestaShop Community sections are largely self-moderated. PrestaShop team members may or may not participate in non-English sections. To improve the chances of receiving feedback to your question or comment, please post it in English to the main sections of our Forum.

Vous parlez français ? par ici !
How to move the newsletter block to the center of the page?
#1 Guest_google-friend_*
Posted 04 July 2009 - 09:24 PM
#3 Guest__*
Posted 08 July 2009 - 12:22 AM
From 1246761843:
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.
#4 Guest__*
Posted 08 July 2009 - 01:22 AM
#5 Guest__*
Posted 08 July 2009 - 03:17 AM
Any idea? Thank you a lot for your help.
#6 Guest__*
Posted 08 July 2009 - 03:32 AM
{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.
#7 Guest__*
Posted 08 July 2009 - 04:23 PM
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?
#8 Guest__*
Posted 22 August 2009 - 01:23 PM
#9 Guest__*
Posted 30 August 2010 - 08:39 AM
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
#10 Guest__*
Posted 30 August 2010 - 08:43 AM
From 1250943800:
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!
#11 Guest__*
Posted 30 August 2010 - 12:09 PM
$smarty->assign('HOOK_NEWSLETTER', Module::hookExec('newsletter'));
#12 Guest__*
Posted 30 August 2010 - 09:01 PM
From 1283166549:
$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?
#13 Guest__*
Posted 31 August 2010 - 02:52 AM
#14 Guest__*
Posted 31 August 2010 - 03:21 AM
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
#15 Guest__*
Posted 31 August 2010 - 03:42 AM
function hookNewsletter($params)
{
return $this->hookLeftColumn($params);
}
#16 Guest__*
Posted 31 August 2010 - 03:57 AM
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:
#17 Guest__*
Posted 01 November 2010 - 05:40 PM
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.
#18 Guest__*
Posted 16 June 2011 - 05:30 PM
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?
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











