drugmirko Posted April 1, 2014 Share Posted April 1, 2014 You can hook featured, new and best sellers on home tab... What can be done, so I can hook specials module there? Thanks Link to comment Share on other sites More sharing options...
dioniz Posted April 2, 2014 Share Posted April 2, 2014 That module is not made to be put there. You can make your own module or find one maybe in addons Link to comment Share on other sites More sharing options...
NemoPS Posted April 2, 2014 Share Posted April 2, 2014 If you want to place it there, you have to modify the code and add a method named hookDisplayHomeTabContent to the php file, returning the same content of hookRightColumn. Of course then you need to style css and change the tpl file accordingly! 1 Link to comment Share on other sites More sharing options...
vekia Posted April 2, 2014 Share Posted April 2, 2014 + displayHomeTab to display tab "specials" 2 Link to comment Share on other sites More sharing options...
drugmirko Posted April 2, 2014 Author Share Posted April 2, 2014 I registered new hooks, put in these two methods, try to do similar like in other 3 modules. I managed to show tab on front but it's not clickable, because all other tabs have attributes data-toggle="tab" and href assigned to them. If you hardcode them into tab.tpl it doesn't really do anything. Guess is some javascript or something, I don't really know. I tried, but this is way over my knowledge of PHP. Maybe someone will do this in the future heh. Till then... Thanks for all the help anyway. Link to comment Share on other sites More sharing options...
roz Posted April 4, 2014 Share Posted April 4, 2014 + displayHomeTab to display tab "specials" hi Vekia. what do you mean by this? is there an easy way to show Specials at homepage? together with the tabs? thanks! Link to comment Share on other sites More sharing options...
NemoPS Posted April 4, 2014 Share Posted April 4, 2014 He means you need to add that hook to display the tab label Link to comment Share on other sites More sharing options...
roz Posted April 4, 2014 Share Posted April 4, 2014 He means you need to add that hook to display the tab label i have tried Transplanting the Specials module to displayHomeTab. is that what he means? however, i get this error, "This module cannot be transplanted to this hook." is there something i'm missing? thanks Link to comment Share on other sites More sharing options...
NemoPS Posted April 4, 2014 Share Posted April 4, 2014 yes, you need to add the hookDisplayHomeTab method to the module as well. It should return a template file similar to <li><a class="homefeatured">{l s='Popular' mod='homefeatured'}</a></li> Link to comment Share on other sites More sharing options...
labeleng Posted April 4, 2014 Share Posted April 4, 2014 i will love to also have the 'specials' module transplanted to hookDisplayHomeTab. I very sure it will help improve sales Link to comment Share on other sites More sharing options...
roz Posted April 4, 2014 Share Posted April 4, 2014 yes, you need to add the hookDisplayHomeTab method to the module as well. It should return a template file similar to <li><a class="homefeatured">{l s='Popular' mod='homefeatured'}</a></li> care to share how to do it in details? apologies as i am new to prestashop i'm still crawling my way to customizing thank you! Link to comment Share on other sites More sharing options...
NemoPS Posted April 4, 2014 Share Posted April 4, 2014 Add this to the module: public function hookDisplayHomeTab($params) { if (!$this->isCached('tab.tpl', $this->getCacheId('specialproducts-tab'))) $this->_cacheProducts(); return $this->display(__FILE__, 'tab.tpl', $this->getCacheId('specialproducts-tab')); } As well as the one I mentioned above, the create the tab.tpl file and add the <li> content, and use the blockspecials.tpl one for the tab content function Link to comment Share on other sites More sharing options...
roz Posted April 7, 2014 Share Posted April 7, 2014 Add this to the module: public function hookDisplayHomeTab($params) { if (!$this->isCached('tab.tpl', $this->getCacheId('specialproducts-tab'))) $this->_cacheProducts(); return $this->display(__FILE__, 'tab.tpl', $this->getCacheId('specialproducts-tab')); } As well as the one I mentioned above, the create the tab.tpl file and add the <li> content, and use the blockspecials.tpl one for the tab content function in which php file do i need to add this function? sorry taking it slow. as i still need a step by step procedure on this hehehe.. please be patient with me Link to comment Share on other sites More sharing options...
NemoPS Posted April 7, 2014 Share Posted April 7, 2014 blockspecials.php Link to comment Share on other sites More sharing options...
roz Posted April 7, 2014 Share Posted April 7, 2014 okay i already added public function hookDisplayHomeTab($params) { if (!$this->isCached('tab.tpl', $this->getCacheId('specialproducts-tab'))) $this->_cacheProducts(); return $this->display(__FILE__, 'tab.tpl', $this->getCacheId('specialproducts-tab')); } in blockspecials.php. next is? Link to comment Share on other sites More sharing options...
roz Posted April 8, 2014 Share Posted April 8, 2014 blockspecials.php hope you can help me with the next steps. because i'm not a php coder too so i am not that very familiar with these stuffs Link to comment Share on other sites More sharing options...
roz Posted April 8, 2014 Share Posted April 8, 2014 I registered new hooks, put in these two methods, try to do similar like in other 3 modules. I managed to show tab on front but it's not clickable, because all other tabs have attributes data-toggle="tab" and href assigned to them. If you hardcode them into tab.tpl it doesn't really do anything. Guess is some javascript or something, I don't really know. I tried, but this is way over my knowledge of PHP. Maybe someone will do this in the future heh. Till then... Thanks for all the help anyway. hi drugmirko. were you able to solve your issue? care to help by sharing me the steps you went to finally make it? i'm already lost after adding the code to blockspecials.php thanks in advance! Link to comment Share on other sites More sharing options...
vekia Posted April 8, 2014 Share Posted April 8, 2014 what actually is the problem? you've got trobules with .... ? Link to comment Share on other sites More sharing options...
roz Posted April 8, 2014 Share Posted April 8, 2014 what actually is the problem? you've got trobules with .... ? hi vekia. thank you for replying. i'm kinda lost with what to do next after adding the function in blockspecials.php. i'm not sure what's next to be done. would appreciate much a step by step after it Link to comment Share on other sites More sharing options...
vekia Posted April 8, 2014 Share Posted April 8, 2014 so, if you added this function to your php file go to modules > positions, click on transplant button and try to attach your module to dispalyHomeTab hook Link to comment Share on other sites More sharing options...
roz Posted April 9, 2014 Share Posted April 9, 2014 i only added this code. transplanted the module and i get a blank page. public function hookDisplayHomeTab($params) { if (!$this->isCached('tab.tpl', $this->getCacheId('specialproducts-tab'))) $this->_cacheProducts(); return $this->display(__FILE__, 'tab.tpl', $this->getCacheId('specialproducts-tab')); } Nemo1 is telling about If you want to place it there, you have to modify the code and add a method named hookDisplayHomeTabContent to the php file, returning the same content of hookRightColumn. Of course then you need to style css and change the tpl file accordingly! how about this? this is the one i can't understand. thanks Vekia Link to comment Share on other sites More sharing options...
NemoPS Posted April 9, 2014 Share Posted April 9, 2014 You need to add homeDisplayTabContent as well You can copy it from blocknewproducts for example, then just make sure you use the same content of the hookDisplayLeftCOlumn method of blockspecials.php Link to comment Share on other sites More sharing options...
roz Posted April 9, 2014 Share Posted April 9, 2014 You need to add homeDisplayTabContent as well You can copy it from blocknewproducts for example, then just make sure you use the same content of the hookDisplayLeftCOlumn method of blockspecials.php hi Nemo. thank you for replying. i have added this code in blockspecials.php public function hookDisplayHomeTab($params) { if (!$this->isCached('tab.tpl', $this->getCacheId('specialproducts-tab'))) $this->_cacheProducts(); return $this->display(__FILE__, 'tab.tpl', $this->getCacheId('specialproducts-tab')); } public function hookdisplayHomeTabContent($params) { if (Configuration::get('PS_CATALOG_MODE')) return; // We need to create multiple caches because the products are sorted randomly $random = date('Ymd').'|'.round(rand(1, max(Configuration::get('BLOCKSPECIALS_NB_CACHES'), 1))); if (!Configuration::get('BLOCKSPECIALS_NB_CACHES') || !$this->isCached('blockspecials.tpl', $this->getCacheId('blockspecials|'.$random))) { if (!($special = Product::getRandomSpecial((int)$params['cookie']->id_lang)) && !Configuration::get('PS_BLOCK_SPECIALS_DISPLAY')) return; $this->smarty->assign(array( 'special' => $special, 'priceWithoutReduction_tax_excl' => Tools::ps_round($special['price_without_reduction'], 2), 'mediumSize' => Image::getSize(ImageType::getFormatedName('medium')), )); } return $this->display(__FILE__, 'blockspecials.tpl', (Configuration::get('BLOCKSPECIALS_NB_CACHES') ? $this->getCacheId('blockspecials|'.$random) : null)); } then transplanted the Specials block module in displayHomeTab & displayHomeTabContent. i still get a blank page. something else i'm still missing? sorry for the trouble Link to comment Share on other sites More sharing options...
vekia Posted April 9, 2014 Share Posted April 9, 2014 blank page = turn error reporting on then you will see detailed log information what and where doesnt work Link to comment Share on other sites More sharing options...
roz Posted April 9, 2014 Share Posted April 9, 2014 blank page = turn error reporting on then you will see detailed log information what and where doesnt work okay i got this error Fatal error: Call to undefined method BlockSpecials::_cacheProducts() in /var/www/prestaPOL/modules/blockspecials/blockspecials.php on line 219 some lines of code i'm missing? Link to comment Share on other sites More sharing options...
herve haurie Posted April 10, 2014 Share Posted April 10, 2014 Hello I have added to blockspecials.php the following code = public function hookDisplayHomeTab($params) { if (!$this->isCached('tab.tpl', $this->getCacheId('specialproducts-tab'))) $this->_cacheProducts(); return $this->display(__FILE__, 'tab.tpl', $this->getCacheId('specialproducts-tab')); } I managed to hook specials block module in displayHomeTab. BUT after that my webpage turns blank and nothing will appear. I guess I miss something ... Can you help? Thanks !!!! Herve Link to comment Share on other sites More sharing options...
NemoPS Posted April 11, 2014 Share Posted April 11, 2014 @roz add this as well public function _cacheProducts() { if (!isset(HomeFeatured::$cache_products)) { $category = new Category(Context::getContext()->shop->getCategory(), (int)Context::getContext()->language->id); $nb = (int)Configuration::get('HOME_FEATURED_NBR'); HomeFeatured::$cache_products = $category->getProducts((int)Context::getContext()->language->id, 1, ($nb ? $nb : 8), 'position'); } if (HomeFeatured::$cache_products === false || empty(HomeFeatured::$cache_products)) return false; } Of course change the homefeature related variables!! @Herve, enable error reporting as described in my signature Link to comment Share on other sites More sharing options...
roz Posted April 11, 2014 Share Posted April 11, 2014 @roz add this as well public function _cacheProducts() { if (!isset(HomeFeatured::$cache_products)) { $category = new Category(Context::getContext()->shop->getCategory(), (int)Context::getContext()->language->id); $nb = (int)Configuration::get('HOME_FEATURED_NBR'); HomeFeatured::$cache_products = $category->getProducts((int)Context::getContext()->language->id, 1, ($nb ? $nb : 8), 'position'); } if (HomeFeatured::$cache_products === false || empty(HomeFeatured::$cache_products)) return false; } Of course change the homefeature related variables!! @Herve, enable error reporting as described in my signature hi Nemo1. sorry again so i already added this chunk of code replaced the variables (which i'm not sure if correct ) and i get this error Fatal error: Access to undeclared static property: BlockSpecials::$cache_products in /var/www/prestaPOL/modules/blockspecials/blockspecials.php on line 253 so i guess i'm using a wrong variable? Link to comment Share on other sites More sharing options...
NemoPS Posted April 11, 2014 Share Posted April 11, 2014 no, you have to declare it at the beginning of the file protected $cache_products; Link to comment Share on other sites More sharing options...
roz Posted April 14, 2014 Share Posted April 14, 2014 no, you have to declare it at the beginning of the file protected $cache_products; hi Nemo1! i already have declare it but i still get the same error Fatal error: Access to undeclared static property: BlockSpecials::$cache_products in /var/www/prestaPOL/modules/blockspecials/blockspecials.php on line 254 these are the lines of codes at the end of my file so far. public function hookDisplayHomeTab($params) { if (!$this->isCached('tab.tpl', $this->getCacheId('specialproducts-tab'))) $this->_cacheProducts(); return $this->display(__FILE__, 'tab.tpl', $this->getCacheId('specialproducts-tab')); } public function hookdisplayHomeTabContent($params) { if (Configuration::get('PS_CATALOG_MODE')) return; // We need to create multiple caches because the products are sorted randomly $random = date('Ymd').'|'.round(rand(1, max(Configuration::get('BLOCKSPECIALS_NB_CACHES'), 1))); if (!Configuration::get('BLOCKSPECIALS_NB_CACHES') || !$this->isCached('blockspecials.tpl', $this->getCacheId('blockspecials|'.$random))) { if (!($special = Product::getRandomSpecial((int)$params['cookie']->id_lang)) && !Configuration::get('PS_BLOCK_SPECIALS_DISPLAY')) return; $this->smarty->assign(array( 'special' => $special, 'priceWithoutReduction_tax_excl' => Tools::ps_round($special['price_without_reduction'], 2), 'mediumSize' => Image::getSize(ImageType::getFormatedName('medium')), )); } return $this->display(__FILE__, 'blockspecials.tpl', (Configuration::get('BLOCKSPECIALS_NB_CACHES') ? $this->getCacheId('blockspecials|'.$random) : null)); } public function _cacheProducts() { if (!isset(BlockSpecials::$cache_products)) { $category = new Category(Context::getContext()->shop->getCategory(), (int)Context::getContext()->language->id); $nb = (int)Configuration::get('BLOCKSPECIALS_NB_CACHES'); BlockSpecials::$cache_products = $category->getProducts((int)Context::getContext()->language->id, 1, ($nb ? $nb : 8), 'position'); } if (BlockSpecials::$cache_products === false || empty(BlockSpecials::$cache_products)) return false; } the additional declaration i added here because if i put it on top of it it gives error class BlockSpecials extends Module { protected $cache_products; private $_html = ''; private $_postErrors = array(); something wrong with my codes? thank you Link to comment Share on other sites More sharing options...
NemoPS Posted April 14, 2014 Share Posted April 14, 2014 Uh error! Weird, what kind of error? The declaration looks fine to me (or I am still sleeping!) Link to comment Share on other sites More sharing options...
roz Posted April 15, 2014 Share Posted April 15, 2014 Uh error! Weird, what kind of error? The declaration looks fine to me (or I am still sleeping!) this was the error Fatal error: Access to undeclared static property: BlockSpecials::$cache_products in /var/www/prestaPOL/modules/blockspecials/blockspecials.php on line 254 Link to comment Share on other sites More sharing options...
roz Posted April 16, 2014 Share Posted April 16, 2014 any idea? Link to comment Share on other sites More sharing options...
NemoPS Posted April 16, 2014 Share Posted April 16, 2014 I'm clueless, the declaration is okay so I have no idea why you are still getting that It must be added exactly there, at the beginning of the class Link to comment Share on other sites More sharing options...
roz Posted April 16, 2014 Share Posted April 16, 2014 I'm clueless, the declaration is okay so I have no idea why you are still getting that It must be added exactly there, at the beginning of the class care to double check my blockspecials php file? i have attached the file here. thanks Nemo1! blockspecials.php Link to comment Share on other sites More sharing options...
NemoPS Posted April 16, 2014 Share Posted April 16, 2014 It's okay At this point you might try with self::$cached_products instead of BlockSpecials:: Link to comment Share on other sites More sharing options...
roz Posted April 17, 2014 Share Posted April 17, 2014 It's okay At this point you might try with self::$cached_products instead of BlockSpecials:: it's still showing the same error Link to comment Share on other sites More sharing options...
roz Posted April 17, 2014 Share Posted April 17, 2014 i upgraded the module hoping it will fix then added the codes again. but still the same error Fatal error: Access to undeclared static property: BlockSpecials::$cache_products in /var/www/prestaPOL/modules/blockspecials/blockspecials.php on line 255 the error is referring to this line, self::$cache_products = $category->getProducts((int)Context::getContext()->language->id, 1, ($nb ? $nb : 8), 'position'); anyone please help Link to comment Share on other sites More sharing options...
roz Posted April 23, 2014 Share Posted April 23, 2014 anyone? Link to comment Share on other sites More sharing options...
roz Posted April 23, 2014 Share Posted April 23, 2014 (edited) hmm.. how come i can't see your post here vekia? i received an email that you replied Edited April 23, 2014 by roz (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted April 23, 2014 Share Posted April 23, 2014 yess i replied and then removed it because my post was not useful :/ (i noticed that after posting it) and regarding to your problem (new idea) i see that here, around the forum, you can find several topics related to problems with this "tab" feature. problems are related to caching, so maybe in this case it is worth to remove caching from this module? you will hit two birds with one stone: - it's a fix for actual problem - you will avoid problems with caching in the future Link to comment Share on other sites More sharing options...
roz Posted April 24, 2014 Share Posted April 24, 2014 yess i replied and then removed it because my post was not useful :/ (i noticed that after posting it) and regarding to your problem (new idea) i see that here, around the forum, you can find several topics related to problems with this "tab" feature. problems are related to caching, so maybe in this case it is worth to remove caching from this module? you will hit two birds with one stone: - it's a fix for actual problem - you will avoid problems with caching in the future i see. so.. what exactly do i need to do here? do you mean i need to remove caching from the codes? or where else? let me know please. will try to read on other "tab issue" topics too. but thank you if you'll guide me Link to comment Share on other sites More sharing options...
vekia Posted April 24, 2014 Share Posted April 24, 2014 remove whole funciton: public function _cacheProducts() { if (!isset(BlockSpecials::$cache_products)) { $category = new Category(Context::getContext()->shop->getCategory(), (int)Context::getContext()->language->id); $nb = (int)Configuration::get('BLOCKSPECIALS_NB_CACHES'); BlockSpecials::$cache_products = $category->getProducts((int)Context::getContext()->language->id, 1, ($nb ? $nb : 8), 'position'); } if (BlockSpecials::$cache_products === false || empty(BlockSpecials::$cache_products)) return false; } change: return $this->display(__FILE__, 'blockspecials.tpl', (Configuration::get('BLOCKSPECIALS_NB_CACHES') ? $this->getCacheId('blockspecials|'.$random) : null)); to: return $this->display(__FILE__, 'blockspecials.tpl'); change: public function hookDisplayHomeTab($params) { if (!$this->isCached('tab.tpl', $this->getCacheId('specialproducts-tab'))) $this->_cacheProducts(); return $this->display(__FILE__, 'tab.tpl', $this->getCacheId('specialproducts-tab')); } to: public function hookDisplayHomeTab($params) { return $this->display(__FILE__, 'tab.tpl'); } change: return $this->display(__FILE__, 'blockspecials.tpl', (Configuration::get('BLOCKSPECIALS_NB_CACHES') ? $this->getCacheId('blockspecials|'.$random) : null)); to: return $this->display(__FILE__, 'blockspecials.tpl'); Link to comment Share on other sites More sharing options...
roz Posted April 25, 2014 Share Posted April 25, 2014 remove whole funciton: public function _cacheProducts() { if (!isset(BlockSpecials::$cache_products)) { $category = new Category(Context::getContext()->shop->getCategory(), (int)Context::getContext()->language->id); $nb = (int)Configuration::get('BLOCKSPECIALS_NB_CACHES'); BlockSpecials::$cache_products = $category->getProducts((int)Context::getContext()->language->id, 1, ($nb ? $nb : 8), 'position'); } if (BlockSpecials::$cache_products === false || empty(BlockSpecials::$cache_products)) return false; } change: return $this->display(__FILE__, 'blockspecials.tpl', (Configuration::get('BLOCKSPECIALS_NB_CACHES') ? $this->getCacheId('blockspecials|'.$random) : null)); to: return $this->display(__FILE__, 'blockspecials.tpl'); change: public function hookDisplayHomeTab($params) { if (!$this->isCached('tab.tpl', $this->getCacheId('specialproducts-tab'))) $this->_cacheProducts(); return $this->display(__FILE__, 'tab.tpl', $this->getCacheId('specialproducts-tab')); } to: public function hookDisplayHomeTab($params) { return $this->display(__FILE__, 'tab.tpl'); } change: return $this->display(__FILE__, 'blockspecials.tpl', (Configuration::get('BLOCKSPECIALS_NB_CACHES') ? $this->getCacheId('blockspecials|'.$random) : null)); to: return $this->display(__FILE__, 'blockspecials.tpl'); hi Vekia! okay i finally got rid of the error but this message is appearing on the tabs area No template found for module blockspecials and then this block appears below what did i do wrong this time? sorry for the trouble Link to comment Share on other sites More sharing options...
roz Posted April 29, 2014 Share Posted April 29, 2014 up Link to comment Share on other sites More sharing options...
roz Posted May 3, 2014 Share Posted May 3, 2014 pleeeaaaasseeee Link to comment Share on other sites More sharing options...
roz Posted May 7, 2014 Share Posted May 7, 2014 up.. still unsolved Link to comment Share on other sites More sharing options...
zeezuiper Posted May 7, 2014 Share Posted May 7, 2014 (edited) I have exactly the same problem as the topic starter. I have read all the comments and changed everything according the suggestions but I can't get it to work either . I created a issue for it: http://forge.prestashop.com/browse/PSCSX-2036 Please vote Edited May 7, 2014 by zeezuiper (see edit history) Link to comment Share on other sites More sharing options...
roz Posted May 7, 2014 Share Posted May 7, 2014 i think i'm almost there. only a few changes left only. i think it's only a template tweak. but i don't know where to start. Link to comment Share on other sites More sharing options...
weelh1 Posted May 7, 2014 Share Posted May 7, 2014 I wish also display the "specials" module in the hometabs. If somebody has a good solution, please help. Thank you. Link to comment Share on other sites More sharing options...
roz Posted May 15, 2014 Share Posted May 15, 2014 remove whole funciton: public function _cacheProducts() { if (!isset(BlockSpecials::$cache_products)) { $category = new Category(Context::getContext()->shop->getCategory(), (int)Context::getContext()->language->id); $nb = (int)Configuration::get('BLOCKSPECIALS_NB_CACHES'); BlockSpecials::$cache_products = $category->getProducts((int)Context::getContext()->language->id, 1, ($nb ? $nb : 8), 'position'); } if (BlockSpecials::$cache_products === false || empty(BlockSpecials::$cache_products)) return false; } change: return $this->display(__FILE__, 'blockspecials.tpl', (Configuration::get('BLOCKSPECIALS_NB_CACHES') ? $this->getCacheId('blockspecials|'.$random) : null)); to: return $this->display(__FILE__, 'blockspecials.tpl'); change: public function hookDisplayHomeTab($params) { if (!$this->isCached('tab.tpl', $this->getCacheId('specialproducts-tab'))) $this->_cacheProducts(); return $this->display(__FILE__, 'tab.tpl', $this->getCacheId('specialproducts-tab')); } to: public function hookDisplayHomeTab($params) { return $this->display(__FILE__, 'tab.tpl'); } change: return $this->display(__FILE__, 'blockspecials.tpl', (Configuration::get('BLOCKSPECIALS_NB_CACHES') ? $this->getCacheId('blockspecials|'.$random) : null)); to: return $this->display(__FILE__, 'blockspecials.tpl'); hi Vekia! okay i finally got rid of the error but this message is appearing on the tabs area No template found for module blockspecials and then this block appears below what did i do wrong this time? sorry for the trouble Link to comment Share on other sites More sharing options...
weelh1 Posted May 15, 2014 Share Posted May 15, 2014 Hi, "No template found for module blockspecials" : you have to create a "blockspecials" folder in your theme/modules/ and create a "tab.tpl". {counter name=active_li assign=active_li} <li{if $active_li == 1} class="active"{/if}><a data-toggle="tab" href="#blockspecials" class="blockspecials">{l s='Specials' mod='blockspecials'}</a></li> Link to comment Share on other sites More sharing options...
roz Posted May 15, 2014 Share Posted May 15, 2014 Hi, "No template found for module blockspecials" : you have to create a "blockspecials" folder in your theme/modules/ and create a "tab.tpl". {counter name=active_li assign=active_li} <li{if $active_li == 1} class="active"{/if}><a data-toggle="tab" href="#blockspecials" class="blockspecials">{l s='Specials' mod='blockspecials'}</a></li> hi weelh1! thanks! i had the tab name sorted out. now i think i only need to know how to display the products the way featured, and new arrivals are presented. any idea how? Link to comment Share on other sites More sharing options...
roz Posted May 19, 2014 Share Posted May 19, 2014 Hi, "No template found for module blockspecials" : you have to create a "blockspecials" folder in your theme/modules/ and create a "tab.tpl". {counter name=active_li assign=active_li} <li{if $active_li == 1} class="active"{/if}><a data-toggle="tab" href="#blockspecials" class="blockspecials">{l s='Specials' mod='blockspecials'}</a></li> hey weelh1! i received an email notification of your reply but i see nothing here? did you deleted it or something? Link to comment Share on other sites More sharing options...
weelh1 Posted May 19, 2014 Share Posted May 19, 2014 You have to look at this tutorial and see how the newproduct tab / featured tab .css works. Link to comment Share on other sites More sharing options...
bullet_tooth Posted September 25, 2014 Share Posted September 25, 2014 maybe someone done .tpl for hookdisplayHomeTabContent, like best-sellers, popular and new products in 1.6? Link to comment Share on other sites More sharing options...
waldiPL Posted September 25, 2014 Share Posted September 25, 2014 yes! Vekia did with his homepage products pro module Link to comment Share on other sites More sharing options...
ciburator Posted September 27, 2014 Share Posted September 27, 2014 Guys if you want to keep caching you have to fix declaration "protected static $cache_products" and everything works now i have a problem with it showing only one product. Link to comment Share on other sites More sharing options...
ciburator Posted September 28, 2014 Share Posted September 28, 2014 i got that module(blockspecials) working now it shows products with discount and on-sale status on it(home tab content). Link to comment Share on other sites More sharing options...
vekia Posted September 28, 2014 Share Posted September 28, 2014 Guys if you want to keep caching you have to fix declaration "protected static $cache_products" and everything works now i have a problem with it showing only one product. from where? module .php file? you're reffering to recently released version? and what exactly you mean by "fix declaration" ? Link to comment Share on other sites More sharing options...
ciburator Posted September 28, 2014 Share Posted September 28, 2014 if you want to keep caching function for custom blockspecials module, as i saw in earlier posts, just fix declaration in blockspecials.php and yes im reffering to current version Link to comment Share on other sites More sharing options...
L E O Posted November 26, 2014 Share Posted November 26, 2014 Hello, I follow this topic to add specials tab and it works fine. I would like now to add a translation to the word "Specials" and I don't know where to do this ! Here are the files I use : modules/blockspecials/tab.tpl : <li><a data-toggle="tab" href="#blockspecials" class="blockspecials">{l s='Specials' mod='blockspecials'}</a></li> modules/blockspecials/blockspecials.php with hooks : public function hookDisplayHomeTab($params) { if (Configuration::get('PS_CATALOG_MODE')) return; if (!$this->isCached('tab.tpl', $this->getCacheId('blockspecials-tab'))) BlockSpecials::$cache_specials = Product::getPricesDrop((int)$params['cookie']->id_lang, 0, Configuration::get('BLOCKSPECIALS_SPECIALS_NBR')); if (BlockSpecials::$cache_specials === false) return false; return $this->display(__FILE__, 'tab.tpl', $this->getCacheId('blockspecials-tab')); } public function hookDisplayHomeTabContent($params) { if (Configuration::get('PS_CATALOG_MODE')) return; if (!$this->isCached('blockspecials-home.tpl', $this->getCacheId('blockspecials-home'))) { $this->smarty->assign(array( 'specials' => BlockSpecials::$cache_specials, 'homeSize' => Image::getSize(ImageType::getFormatedName('home')) )); } if (BlockSpecials::$cache_specials === false) return false; return $this->display(__FILE__, 'blockspecials-home.tpl', $this->getCacheId('blockspecials-home')); } Thanks for your help !! Link to comment Share on other sites More sharing options...
kondor75 Posted February 13, 2015 Share Posted February 13, 2015 Hello, I follow this topic to add specials tab and it works fine. I would like now to add a translation to the word "Specials" and I don't know where to do this ! Here are the files I use : modules/blockspecials/tab.tpl : <li><a data-toggle="tab" href="#blockspecials" class="blockspecials">{l s='Specials' mod='blockspecials'}</a></li> modules/blockspecials/blockspecials.php with hooks : public function hookDisplayHomeTab($params) { if (Configuration::get('PS_CATALOG_MODE')) return; if (!$this->isCached('tab.tpl', $this->getCacheId('blockspecials-tab'))) BlockSpecials::$cache_specials = Product::getPricesDrop((int)$params['cookie']->id_lang, 0, Configuration::get('BLOCKSPECIALS_SPECIALS_NBR')); if (BlockSpecials::$cache_specials === false) return false; return $this->display(__FILE__, 'tab.tpl', $this->getCacheId('blockspecials-tab')); } public function hookDisplayHomeTabContent($params) { if (Configuration::get('PS_CATALOG_MODE')) return; if (!$this->isCached('blockspecials-home.tpl', $this->getCacheId('blockspecials-home'))) { $this->smarty->assign(array( 'specials' => BlockSpecials::$cache_specials, 'homeSize' => Image::getSize(ImageType::getFormatedName('home')) )); } if (BlockSpecials::$cache_specials === false) return false; return $this->display(__FILE__, 'blockspecials-home.tpl', $this->getCacheId('blockspecials-home')); } Thanks for your help !! To end this guide you have to go to modules --> position -.> transplant modules --> select Block Specials with displayHomeTab --> Save and after select Block Special with displayHomeTabContent --> Save. Good Work!!! Link to comment Share on other sites More sharing options...
Recommended Posts