Jump to content

How to hook newletter block on footer page (Sloved)


Recommended Posts

In blocknewsletter.php in the install function make the modules to hook to the footer

     public function install()
    {
         if (parent::install() == false OR $this->registerHook('leftColumn') == false OR $this->registerHook('footer') == false)




Create a new code for hooking to the footer, you can copy from hookLeftColumn (note the name of the function, hookFooter and the tempate being loaded - blocknewsletterfooter.tpl) :

     function hookFooter($params)
    {
       global $smarty;

       if (Tools::isSubmit('submitNewsletter'))
       {
           $this->newsletterRegistration();
           if ($this->error)
           {
               $smarty->assign(array('color' => 'red',
                                       'msg' => $this->error,
                                       'nw_value' => isset($_POST['email']) ? pSQL($_POST['email']) : false,
                                       'nw_error' => true,
                                       'action' => $_POST['action']));
           }
           elseif ($this->valid)
           {
               if (Configuration::get('NW_CONFIRMATION_EMAIL') AND isset($_POST['action']) AND intval($_POST['action']) == 0)
                   Mail::Send(intval($params['cookie']->id_lang), 'newsletter_conf', $this->l('Newsletter confirmation'), array(), pSQL($_POST['email']), NULL, NULL, NULL, NULL, NULL, dirname(__FILE__).'/mails/');
               $smarty->assign(array('color' => 'green',
                                       'msg' => $this->valid,
                                       'nw_error' => false));
           }
       }
       $smarty->assign('this_path', $this->_path);
         return $this->display(__FILE__, 'blocknewsletterfooter.tpl');
    }



copy blocknewsletter.tpl to blocknewsletterfooter.tpl & modify it to your needs.

Link to comment
Share on other sites

Check this code

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




the function hookLeftColumn is not exist in the class. Just copy from hookFooter, rename the function to hookLeftColumn and dont forget to set the proper tpl file (blocknewsletter.tpl).

Link to comment
Share on other sites

×
×
  • Create New...