trustweb Posted July 15, 2012 Share Posted July 15, 2012 Hello, i am trying to move home featured products outside of the columns div in a "newdiv" as follow: <header> hook header </header> <container> <div central_column> . <!-- here is the featured products block --> . </div> <div right_column> hook right column </div> </container> <newdiv><--! here where i want to show featured products --></newdiv> <footer> hook footer </footer> to do this i edited FrontController.php adding the hook to display footer ( 'HOOK_FEATURED_HOME' => Module::hookExec('homeFeatured') ): public function displayFooter() { if (!self::$initialized) $this->init(); self::$smarty->assign(array( 'HOOK_RIGHT_COLUMN' => Module::hookExec('rightColumn', array('cart' => self::$cart)), 'HOOK_FEATURED_HOME' => Module::hookExec('homeFeatured'), 'HOOK_FOOTER' => Module::hookExec('footer'), 'content_only' => (int)(Tools::getValue('content_only')))); self::$smarty->display(_PS_THEME_DIR_.'footer.tpl'); //live edit if (Tools::isSubmit('live_edit') AND $ad = Tools::getValue('ad') AND (Tools::getValue('liveToken') == sha1(Tools::getValue('ad')._COOKIE_KEY_))) { self::$smarty->assign(array('ad' => $ad, 'live_edit' => true)); self::$smarty->display(_PS_ALL_THEMES_DIR_.'live_edit.tpl'); } else Tools::displayError(); } on the file footer.tpl i added the hook: <!-- featured products --> {if $page_name == 'index'} <div id="homeFeatured"> {$HOOK_FEATURED_HOME} </div> {/if} i added in the DB id name title descritption position live_edit 97 homeFeatured Home Featured Products NULL 0 0 in module/homefeatured/homefeatured.php i added: function install() { if (!Configuration::updateValue('HOME_FEATURED_NBR', 8) OR !parent::install() OR !$this->registerHook('home') OR !$this->registerHook('homeFeatured')) return false; return true; } and at the end of the class function homeFeatured($params) { // return $this->hookHome($params); echo 'hook test'; } i didn't see anything in the div newdiv. when i try to transplant the module to the new hook in the back office i receive: This module cannot be transplanted to this hook.[code] Link to comment Share on other sites More sharing options...
math_php Posted July 18, 2012 Share Posted July 18, 2012 Hi, The module homefeatured has only hookHome method that is why you have this error. You must modify the module by adding a public function hookFooter($params){ your code..} This after module re-install may fix the error message. Good dev Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now