Jump to content

Using custom hook with homefeatured module


robplugandplay

Recommended Posts

Hello,

I am currently having difficulty with the homefeatured module.

I am attempting to call the homefeatured module in a custom hook called TwocolsFeatured however it seems like homefeatured will only work on the Home hook. Am I writing the wrong code or is there a work around for this?

(N.B) I am using prestashop 1.4

The code is as follows:

FrontController.php

        self::$smarty->assign(array(
           'HOOK_HEADER' => Module::hookExec('header'),
           'HOOK_TOP' => Module::hookExec('top'),
           'HOOK_LEFT_COLUMN' => Module::hookExec('leftColumn'),
           'HOOK_NEWSLETTER' => Module::hookExec('newsletter'),
           'HOOK_TWOCOL_FEATURED' => Module::hookExec('homefeatured'),
           'HOOK_THREECOL_FEATURED' => Module::hookExec('homefeatured_bottom')
       ));



HomeFeatured.php

   function install()
   {
       if (!Configuration::updateValue('HOME_FEATURED_NBR', 8) OR !parent::install() OR !$this->registerHook('home') OR !$this->registerHook('twocolFeatured') OR !$this->registerHook('threecolFeatured'))
           return false;
       return true;
   }


       public function hooktwocolFeatured($params)
   {
       echo 'hook twocol';
       return $this->hookHome($params);
   }

       public function hookThreecolFeatured($params)
   {
       global $smarty;

       $category = new Category(1, Configuration::get('PS_LANG_DEFAULT'));
       $nb = (int)(Configuration::get('HOME_FEATURED_NBR'));
       $products = $category->getProducts((int)($params['cookie']->id_lang), 1, ($nb ? $nb : 10));
       $smarty->assign(array(
       'products' => $products,
       'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'),
       'homeSize' => Image::getSize('home_bottom')));

       return $this->display(__FILE__, 'homefeatured.tpl');
   }
}



index.tpl



ps_hook database entry

id_hook    name                            title                                                      description                                    position    live_edit

68           homefeatured                 Home Content Featured top left 4            Specials that appear twocols left     1            1
69           homefeatured_bottom     Home Featured Products on Bottom          Home featured products positioned on bottom    1    1




Thank You for any help that can be offered

Mr.Enigma



                   {$HOOK_TWOCOL_FEATURED}


               <!-- END LEFT -->

Link to comment
Share on other sites

  • 1 month later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...