How To Create Featured Products Slider in Prestashop 1.7

Aug 23, 20171250Lena Tsybulenko
How To Create Featured Products Slider in Prestashop 1.7

After the article Slider for home featured products in Prestashop 1.6 was released, people usually ask how to create a slider for featured products in Prestashop 1.7. This article will describe all the steps of creating a slider and will help you perform it easily.

featured-products slider in prestashop 1.7

First, let’s decide which slider plugin we will use to implement into featured product list. There are many slider plugins and you are able to implement any in Prestashop 1.7. I like and I’ll show how to implement it into the product list. Let’s start.

First, we need to include Swiper files into our theme. There are several ways to do that. General information about how to include Swiper files listed here. The ways to include Swiper into Prestashop 1.7 theme are following.

1. Using NPM:

In the downloaded package, we need files from the dist/ folder. Style files should be included into theme.scss file:

@import “~swiper/dist/swiper.min.css”;

Java Script files should be included into theme.js file:

import ‘swiper/dist/swiper.jquery.min’;

2. Include files into _dev theme folder. Download actual Swiper files. Place style files into _dev/css/ components folder and call them into theme.scss file:

@import “components/swiper.min”;

Place Java Script files into _dev/js/lib folder and call them into theme.js file:

import ‘./lib/swiper.jquery.min’;

These two ways described above are expected that you are using theme compilation with Webpack. Those our blog reader who found it’s hard to compile theme, may use custom.css (classic/assets/css/custom.css) and custom.js(classic/assets/css/custom.js) files in order to include Swiper files.

Next step we’ll create a HTML markup. Open ps_featuredproducts.tpl file. Here is a full path to this file:
themes/classic/modules/ps_featuredproducts/views/templates/hook/ps_featuredproducts.tpl. When we open file we see the following code:

Let’s modify this code in order to implement slider. Wrap product.tpl inclusion into “swiper-slide” container. Then wrap “swiper-slide” into “swiper-wrapper” container and add class “swiper-container” to “products” container. This is a base markup of Swiper Slider. This markup listed at Swiper API. Also let’s add “swiper-pagination” and “swiper-button” containers that are being slider controls. Below is a final markup:

Next step we need to initialize Swiper using the following function:

new Swiper(swiperContainer, parameters) – initialize swiper with options:

  • swiperContainer – HTMLElement or string (with CSS Selector) of swiper container HTML element. Required.
  • parameters – object – object with Swiper parameters. Optional.

Let’s create file featured-products-slider.js and include it into theme.js file:

import ‘./components/featured-products-slider’;

Now let’s initialize Swiper in featured-products-slider.js file:

The result you can see  here

Feel free to ask any questions and I’ll reply you as soon as possible.


  1. hi lena,
    thanks for the tutorial very very good.
    hm.. i want ask.
    how to instal swiper in my hosting.
    thank you.

    enda :)

  2. hello Lena..i cannot understand your instructions. could you plz instruct me one more time??

  3. I dont understand how to instal with npm .. coz i know that must be instal via terminal or console right ?

  4. Dear Lena,

    Thank you for this amazing tutorial.

    i just have a question about someting.
    i followd the tutorial but de slider does not slide when i click on the next and prev buttons.
    can you please help me out?

    Thanx a lot!

  5. Dear Iryna,

    It would be kind, if you could describe how to integrate without compilation but per and tag (no Webpack) as you just touch it very briefly. To me this is not clear and not working. Must of your readers would prefer this way of integration swipe as far as I can read above. I have test it and cannot get it running with and integration.

    Kind regards,

  6. Dear All,

    I tested it and use it now. But to me the above description was not working due to the JQuery call. After I followed the instructions on the Swiper webpage, it worked. You can user other Swiper style from the Swiper webpage indeed.

    <code><!– Swiper –>

    {l s=’Popular Products’ d=’Shop.Theme.Catalog’}

    {foreach from=$products item=”product”}
    {include file=”catalog/_partials/miniatures/product.tpl” product=$product}

    <a href=”{$allProductsLink}” rel=”nofollow”>
    {l s=’All products’ d=’Shop.Theme.Catalog’}<i></i>

    <!– Swiper JS –>

    <!– Initialize Swiper –>

    var swiper = new Swiper(‘.swiper-container’, {
    slidesPerView: 4,
    spaceBetween: 30,
    slidesPerGroup: 4,
    loop: true,
    loopFillGroupWithBlank: true,

    pagination: {
    el: ‘.swiper-pagination’,
    clickable: true,
    navigation: {
    nextEl: ‘.swiper-button-next’,
    prevEl: ‘.swiper-button-prev’,

    <!– Swiper –></code>

    Kind regards,

  7. Call Swiper CSS and JS :

    And also call following:

    So, you do not need Webpack.

  8. Where i create the featured-products-slider.js file? is it in the _dev or module folder? Plz help i am able to develop the slider. I have already include swiper js and css in custom css and js. and already done html markup.

  9. Dhusor, include featured-products-slider.js file into _dev/js/components folder.

  10. Thank You very much.
    is working perfect.
    For people what are copying the above code, please review:
    {include file=”catalog/ _partials/miniatures/product.tpl” product=$product}

    there is a space between catalog/ and _partials/miniatures/product.tpl” product=$product}

    If you delete the space, it should work as described

    Thank you for the great tutorial

  11. Swiper was not defined, so in featured-products-slider.js file you need to add:

    import Swiper from ‘swiper/dist/js/swiper.min’;

Post a new comment

BelVG Newsletter
Subscribe to our mailing list and get interesting stuff and updates to your email inbox.
Email *