PrestaShop Forums: How to move the newsletter block to the center of the page? - PrestaShop Forums

Jump to content


Welcome to the PrestaShop Forum! We hope you'll share your comments and suggestions with us. We ask that you please post in English to the main sections of the PrestaShop Forum. If you want to write in another language, please post in the corresponding PrestaShop Community section below.

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.

NYC

Vous parlez français ? par ici !


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


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

#1 Guest_google-friend_*

  • --
  • Guests

Posted 04 July 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?

#2 Guest__*

  • --
  • Guests

Posted 05 July 2009 - 03:44 AM

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

See my post here

#3 Guest__*

  • --
  • Guests

Posted 08 July 2009 - 12:22 AM

From 1246761843:

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.

#4 Guest__*

  • --
  • Guests

Posted 08 July 2009 - 01:22 AM

hookHome will put it in the centre of the home page only. Is that what you want?

#5 Guest__*

  • --
  • Guests

Posted 08 July 2009 - 03:17 AM

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.

#6 Guest__*

  • --
  • Guests

Posted 08 July 2009 - 03:32 AM

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.

#7 Guest__*

  • --
  • Guests

Posted 08 July 2009 - 04:23 PM

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?

#8 Guest__*

  • --
  • Guests

Posted 22 August 2009 - 01:23 PM

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

#9 Guest__*

  • --
  • Guests

Posted 30 August 2010 - 08:39 AM

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

#10 Guest__*

  • --
  • Guests

Posted 30 August 2010 - 08:43 AM

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!

#11 Guest__*

  • --
  • Guests

Posted 30 August 2010 - 12:09 PM

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'));


#12 Guest__*

  • --
  • Guests

Posted 30 August 2010 - 09:01 PM

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?

#13 Guest__*

  • --
  • Guests

Posted 31 August 2010 - 02:52 AM

Yes, you are looking in the wrong place. It is cms.php that has the $smarty->display, not cms.tpl.

#14 Guest__*

  • --
  • Guests

Posted 31 August 2010 - 03:21 AM

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

#15 Guest__*

  • --
  • Guests

Posted 31 August 2010 - 03:42 AM

Make sure that modules/blocknewsletter/blocknewsletter.php has the following code:


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


#16 Guest__*

  • --
  • Guests

Posted 31 August 2010 - 03:57 AM

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:

    


#17 Guest__*

  • --
  • Guests

Posted 01 November 2010 - 05:40 PM

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.

#18 Guest__*

  • --
  • Guests

Posted 16 June 2011 - 05:30 PM

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?





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users