PrestaShop slideshow banner images (with jQuery Javascript)
May 2, 2010 PrestaShop Customization, PrestaShop Tips
Is this useful? Like it.
This post is for guiding our PREMIUM theme users to convert the homepage’s header banner to jQuery Javascript powered image slideshow/scroller/rotator — with fade-in effect, clickable banner images and “Next/Previous” buttons. Therefore the code examples and instructions will be based on our premium theme (Pres 2 to Pres 7 — Pres 1 is not included as it does not come with a header banner). If you use themes from elsewhere, you can try to modify the code examples and your own theme files to add the slideshow.
CLICK TO VIEW DEMO
IMPORTANT: Two files need to edited. So backup these files before you start(YOUR_THEME_NAME is the folder name of the theme you are using):
\themes\YOUR_THEME_NAME\header.tpl
\themes\YOUR_THEME_NAME\css\global.css
STEP 1
Open header.tpl from your theme’s folder with any text editor — Paste the code shown below on a new line, right below/after the line with the <body… > tag (about line 40).
IMPORTANT: Change YOUR_THEME_NAME to your theme’s folder name.
{if $page_name == 'index'}
<script type="text/javascript" src="{$content_dir}themes/YOUR_THEME_NAME/js/slide/jquery.cycle.all.min.js"></script>
<script type="text/javascript" src="{$content_dir}themes/YOUR_THEME_NAME/js/slide/simslide_scripts.js"></script>
{/if}STEP 2
Still with header.tpl — Paste this code to replace the “banner” or “banner1” DIV block
NOTE:
- IMPORTANT: Change the image filename and YOUR_THEME_NAME below to match you own images.
- IMPORTANT: Change the width (980) and height (300) below to the dimension of your images.
- You can copy the line of the slide2 below to add more images to your slideshow.
- You can also remove the links for the images (or edit the links so that the images are clickable).
<!--- Display jQuery slideshow on home page start --> <div id="slideshow"> <ul id="nav"> <li id="prev"><a href="#">Previous</a></li> <li id="next"><a href="#">Next</a></li> </ul> <ul id="slides"> <li><a href="http://www.google.com"><img width="980" height="300" src="{$base_dir}themes/YOUR_THEME_NAME/img/slide1.jpg" alt="" /></a></li> <li><a href="http://www.google.com"><img width="980" height="300" src="{$base_dir}themes/YOUR_THEME_NAME/img/slide2.jpg" alt="" /></a></li> </ul> </div> <!-- slideshow --> <!--- Display jQuery slideshow on home page end -->

STEP 3
Open global.css from your theme’s folder — Paste this block of code at the bottom.
IMPORTANT: Change the width (980px) and height (300px) below to the dimension of your slideshow images (decide on a dimension that fits your theme layout and make sure all your images have the same dimension)
IMPORTANT: After you have completed all steps of this guide, you may need to change the “padding” and “margin-bottom” of the “div#slideshow” block, to position your slideshow area properly.
/* **************** jQuery slideshow on home page *********************************************************** */ div#slideshow { width: 980px; height: 300px; padding: 0 0 0 0; margin-bottom: 7px; overflow: hidden; position: relative; z-index: 5; } div#slideshow img { border: none; } div#slideshow ul#nav { display: none; list-style: none; position: absolute; bottom: 15px; right: 0px; z-index: 15; width: 125px; } div#slideshow ul#nav li#prev { float: left; margin: 0 0 0 20px; display: inline; } div#slideshow ul#nav li#next { float: right; margin: 0 20px 0 0; display: inline; } div#slideshow ul#nav li a { display: block; width: 31px; height: 31px; text-indent: -9999px; } div#slideshow ul#nav li#prev a { background: url(../img/prev.png); } div#slideshow ul#nav li#next a { background: url(../img/next.png); } div#slideshow ul#slides { list-style: none; } div#slideshow ul#slides li { margin: 0 0 20px 0; } a {outline: none; } /* **************** jQuery slideshow on home page *********************************************************** */
STEP 4
The steps above are all you need to do to edit your files. Besides that, you also need to upload some new files:
- Upload the jQuery script and navigation arrow images files:
\themes\YOUR_THEME_NAME\js\slide\jquery.cycle.all.min.js
\themes\YOUR_THEME_NAME\js\slide\simslide_scripts.js
\themes\YOUR_THEME_NAME\img\prev.png
\themes\YOUR_THEME_NAME\img\next.pngYou need to create the “slide” folder as shown above to store the jQuery/Javascript files.
>>> Click to download the files here <<< - Upload your own banner images to this folder:
\themes\YOUR_THEME_NAME\img\
Remember, the image filenames and dimensions are what you need to enter to the header.tpl file, as outlined in STEP 2 above. All our premium themes come with a readme file, where you can find the recommended banner dimension/size — please follow.
OPTIONAL – Changing slide/rotate effects
The script will give you the ‘fade in’ effect for the banner images by default. But you can change to other effects. Open this file:
\themes\YOUR_THEME_NAME\js\slide\simslide_scripts.js
At line 5, you can see fx: ‘fade’ — change fade to shuffle or zoom or turnDown or curtainX.
You can see the demos at Cycle Plugin — it is the source of the jQuery Cycle Plugin, which we are using for the different types of transition effects.
Compatibility:
PrestaShop 1.2.4, 1.2.5, 1.3
Acknowledgements:
Based on the jQuery slideshow by Line25.













May 6th, 2010 at 12:33 pm
How to publish PRESTASHOP on the web(www)w/ my hosting service?
May 6th, 2010 at 2:08 pm
Please see the PrestaShop download and installation guide, http://www.prestashop.com/en/downloads/
June 30th, 2010 at 8:22 am
excelente trabaja 100%, probado en la versiĂłn 1.3.1 y 1.3.0
Excellent works 100%, tested on version 1.3.1 and 1.3.0
July 9th, 2010 at 3:20 am
Does it only works with premium templates? I have the free version 1.3, and did it exactly how you tell us to do, but it didn´t work.
Any suggestion?
July 9th, 2010 at 10:54 am
Manoel,
As detailed in the post, this works with any theme. But easier to integrate to our premium themes (except Pres 2), because those premium themes already have a block of banner code which can be easily replaced by the slideshow code.
If you use any other theme, you need to create a DIV block to hold the slideshow.
July 16th, 2010 at 12:41 am
Very nice explanation even for beginners. I have only one question. When I enable SSL on prestashop in IE can not see banner. In FF works fine.
July 16th, 2010 at 1:07 am
Boris,
Yes, because you have the slide images displayed on ALL pages, including the secure pages (user account & login pages). The browser will “complain” if there are images source in your code that are coded as HTTP:// instead of HTTPS://
(maybe you can try to code the image link using relative instead of absolute path)
As for our themes, like most paid themes, the slide is only on the home page (non https).. therefore, there will be no problems.
July 16th, 2010 at 1:17 am
Boris,
On STEP 2 above, you can see the example code has $base_dir in the path of the slide images… try replacing them with $base_dir_ssl
July 21st, 2010 at 4:17 am
Thank you for your advice. I will try and report about results.
July 21st, 2010 at 4:45 am
I try and it works fine. Thank you for your help.
August 29th, 2010 at 6:45 am
Hey, can you pretty please tell me where and how to create a DIV block to hold the slideshow, im using the default prestashop theme.
Thank you in advance!
August 29th, 2010 at 11:00 am
math,
One of the commenter above uses a theme similar to default theme. You can have a look.
Anyway, create the DIV in the header.tpl file. Other than that, the steps are very similar to the guide above.