Teodosio Posted May 9, 2014 Share Posted May 9, 2014 Hello everyone, I have a 'simple' question: how can I modify the base Blockspecials module in order to display four products (not one as in default) horizontally in the home page? I am using Prestashop 1.6 and I am trying to modify the default-bootstrap theme. Thanks! Link to comment Share on other sites More sharing options...
vekia Posted May 9, 2014 Share Posted May 9, 2014 it's not default behaviour if you see only one product. this blocks shows 4 products by default you've got more specials in shop? (specials = product with defined special price) Link to comment Share on other sites More sharing options...
Teodosio Posted May 9, 2014 Author Share Posted May 9, 2014 (edited) it's not default behaviour if you see only one product. this blocks shows 4 products by default you've got more specials in shop? (specials = product with defined special price) Thanks you for your reply! I have installed Prestashop 1.6.0.6 on my computer (using apache and mysql) and I have not deleted nor modified yet the default products (women dresses). There are two dresses on sale but I only see one of them (at random) on the specials block. I added this code to file /modules/blockspecials/blockspecials.php: public function hookDisplayHome($params) { return $this->hookRightColumn($params); } and now I am able to position the block on the homepage but I guess this is not enough to show four products... Edited May 9, 2014 by Teodosio (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted May 9, 2014 Share Posted May 9, 2014 ahh my bad you're talking about bestsellers module, i just thought that you're talking about other addon. sorry for the confusion. this module doesnt support displayHome hook unfortunately, the way of how you're trying to transplant it is not so good because right column displays only one picture. you can try to use the way of how pictures appearing in homepage featured module, you can copy code of tpl file Link to comment Share on other sites More sharing options...
Teodosio Posted May 9, 2014 Author Share Posted May 9, 2014 Thanks, good suggestion, I will try that! Link to comment Share on other sites More sharing options...
cz_petr Posted May 19, 2014 Share Posted May 19, 2014 (edited) Display 10 specials in block special in prestashop 1.5.6.1 in /themes/your_theme/modules/blockspecials/blockspecials.tpl change line {if $specials} <ul> {foreach from=$specials item=special} + </div> </li>{/foreach} </ul> and in file /modules/blockspecials/blockspecials.php line { if (!($specials = Product::getPricesDrop((int)$params['cookie']->id_lang, 0, 10)) && !Configuration::get('PS_BLOCK_SPECIALS_DISPLAY')) // 0, 10 value displayed items return; $this->smarty->assign(array( 'specials' => $specials, Heureka Edited May 19, 2014 by cz_petr (see edit history) Link to comment Share on other sites More sharing options...
Teodosio Posted May 20, 2014 Author Share Posted May 20, 2014 Hello and thank you for your reply, at the end I used your suggestion to implement another solution. Since I wanted to display the special products in home page and to make them appear in the same way as the featured products, I modified one of the existing modules in order to display several special products in home page. I decided to sacrify the "new products" block and I have pasted below the lines I inserted in the blocknewproducts.php file. I hope this can be useful to someone else! Thanks to the repliers, I will sign the thread as 'solved' now. public function hookdisplayHomeTabContent($params) { if (!$this->isCached('blocknewproducts_home.tpl', $this->getCacheId('blocknewproducts-home'))) { // $this->smarty->assign(array( // 'new_products' => BlockNewProducts::$cache_new_products, // 'mediumSize' => Image::getSize(ImageType::getFormatedName('medium')), // 'homeSize' => Image::getSize(ImageType::getFormatedName('home')) // )); if (!($specials = Product::getPricesDrop((int)$params['cookie']->id_lang, 0, 5)) && !Configuration::get('PS_BLOCK_SPECIALS_DISPLAY')) return; $this->smarty->assign(array( 'new_products' => $specials, 'mediumSize' => Image::getSize(ImageType::getFormatedName('medium')), 'homeSize' => Image::getSize(ImageType::getFormatedName('home')) )); } if (BlockNewProducts::$cache_new_products === false) return false; return $this->display(__FILE__, 'blocknewproducts_home.tpl', $this->getCacheId('blocknewproducts-home')); } Link to comment Share on other sites More sharing options...
TiaNex Shopping Posted April 12, 2015 Share Posted April 12, 2015 (edited) i find we should modify the getPricesDrop() function instead of getRandomSpecial(), it's easy Edited May 29, 2017 by Irder (see edit history) 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