How to move image slider module from home to top in PrestaShop

move image slider to top prestashop


In this tutorial you will read about PrestaShop image slider default module and you will know how to move it from home section to top section of your shop. By default, this module can't be transplanted to this part of your store. But it is possible to modify the module, it's simple and easy. 


As we say above, this module can't be transplanted to the top section of your shop, when you trying to do that in your back office you probably see this error:

this module cannot be transplanted to this hook

 

How to modify the homeslider module?

In first step you must open the homeslider.php file localized in modules/homeslider directory. 

 

copy code attached below

1
2
3
4
5
6
7
8
9
10
11
12
public function hookdisplayTop(){
	if(!$this->_prepareHook())
	return;
 
	if ($this->context->getMobileDevice() != false)
	return false;
 
	$this->context->controller->addJS($this->_path.'js/jquery.bxSlider.min.js');
	$this->context->controller->addCSS($this->_path.'bx_styles.css');
	$this->context->controller->addJS($this->_path.'js/homeslider.js');
	return $this->display(__FILE__, 'homeslider.tpl');
}

 

and paste it into homeslider.php file just before the code: public function hookDisplayHome(). Save the file and go to the PrestaShop back office and try to transplant module homeslider to "Top of pages" known as "displayTop" position. Now everything works fine. You must also delete homeslider module from old position.

 

You transplanted homeslider module properly to new position, but as you probably see, there is something wrong like on image attached below. 


homeslider in top error


How to fix this issue?

So what to do? Go to homeslider module configuration and change the width parameter value to: 979

 

next you must open bx_styles.css file localized in modules/homeslider directory, edit the .bx_wrapper section exactly as above:

1
2
3
4
5
.bx-wrapper {
	margin-bottom:20px;
	height:300px;
	clear:both;
}

 

save changes and refresh your website. Now slider works properly.

 

homeslider module on top in prestashop

author milos myszczuk
Article by Milosz Myszczuk PrestaShop expert, official PrestaShop community moderator. PHP developer, specialist in relative and spatial databases management, GIS Analyst, CEO & founder of VEKIA interactive agency. Read more about VEKIA company
If you like my articles and want much more valuable tips, feel free to send me donation
1.4 version 1.4.11 1.6 404 addon admin advertise ahref ajax alpha animation api app application authentication back office backup badge banner basics block bootstrap button cache carrier cart catalog category certificate changelog chat class clear client clip cms code colors columns comments configuration contact container content controller cookie counter country coupon css csv currency customer dashboard database debug default delete delivery desktop developer device disable discount displayNav displayTop download dynamic editor effect empty encrypt engine error exchange exclude export facebook faceshop fade fancoupon fancybox fanpage fatal feature feed field file fix fixed font footer free friendly url front ftp full gallery generate gift global godaddy google google+ gray grid groupon header help hide highlight homefeatured homepage hook hosting hover howto htaccess html html5 ID image import include input instagram installation integration iPhone issue javascript jquery kgb knowhow languages law left likebox link list livingsocial loading log login logo loyality mail mailing maintenance manufacturer marketing marquee mcrypt menu meta mobile modification module movie moving multilanguage multiupload must have mysql news newsletter notification number open graph order override page password performance PHP phpmyadmin picture pinterest plugin popup post prestashop prestashop 1.0 prestashop 1.1 prestashop 1.2 prestashop 1.3 prestashop 1.4 prestashop 1.5 price rules problem product profile promotion proslider purifier quantity query quick tip random rates register reinsurance release reporting reset responsive restore results ribbon rich text right sales search security seo service shadow share shipping shop shopmania slider smarty social networks SQL SSL statistics stock store style subcategory superuser support switcher tab tablet tag tax template text theme tinyMCE tips and tricks tpl tracking translations tree trends trigger tumblr tutorial twitter update upgrade upload variables video visits voucher vulnerability web2print wide widget width window wishlist wysiwyg youtube zip zopim