Magento 2 - Porto: Add a Product Slider at the Bottom of the Product Landing Page

Magento 2 - Porto: Add a Product Slider at the Bottom of the Product Landing Page

This article will guide you through setting up a product slider at the bottom of your product landing pages.

Step 1: Creating the Product Slider

First, we need to create the product slider.

  1. Login to the Magento Admin Panel.
  2. Go to Content>Elements> Blocks.
  3. Click Add New Block. You should be directed to a page that looks like the below image:
    1. 53646172.png
      1. Enabled: this toggle sets whether the product slider will show or not. Click the toggle to switch it to Yes.
      2. Block Title:this field sets the alias for the product slider which you will need to reference later in this guide. Enter a memorable name such as "Product Page Slider".
      3. Identifier: this field is what the website uses to reference the slider. You will want to label it similar toBlock Title.
        1. Using Product Page Slider as an example, this would be set as "product_page_slider".
      4. Store View: this field determines which store view the slider will show on. For most websites, you will want to selectAll Store Views.
  4. Next, we will add the product slider code.
    1. There are a few different product sliders that come with the theme for your site.
      1. Latest
        1. This will show the products most recently added to the site.
        2. Click Expand Source on the right to see the code to add the default latest slider:
          1. Latest Slider
            <style>.page-layout-1column .block.widget #product-slider .products-grid .product-item {width: auto;padding-left: 10px;padding-right: 10px;}[class*='.page-layout-2columns'].block.widget #product-slider .products-grid .product-item {width: auto;padding-left: 10px;padding-right: 10px;}</style><div id="latest-slider"><h2>Latest Products</h2>{{block class="Smartwave\Filterproducts\Block\Home\LatestList" name="latest_product" product_count="5" aspect_ratio="0" image_width="250" image_height="250" template="Smartwave_Filterproducts::owl_list.phtml"}}</div><script>require(['jquery','owl.carousel/owl.carousel.min'], function ($) {$("#latest-slider .owl-carousel").owlCarousel({autoplay: true,autoplayTimeout: 5000,autoplayHoverPause: true,dots: false,nav: true,navRewind: true,animateIn: 'fadeIn',animateOut: 'fadeOut',loop: true,lazyLoad: true,navText: ["<em class='porto-icon-left-open-big'></em>","<em class='porto-icon-right-open-big'></em>"],responsive: {0: {items: 1},768: {items: 2},992: {items: 2},1200: {items: 4}}});});</script>
      2. Featured
        1. This will show the products marked as featured.
        2. Click Expand Source on the right to see the code to add the default featured slider:
          1. Featured Slider
            <style>.page-layout-1column .block.widget #product-slider .products-grid .product-item {width: auto;padding-left: 10px;padding-right: 10px;}[class*='.page-layout-2columns'].block.widget #product-slider .products-grid .product-item {width: auto;padding-left: 10px;padding-right: 10px;}</style><div id="featured-slider"><h2>Featured Products</h2>{{block class="Smartwave\Filterproducts\Block\Home\FeaturedList" name="featured_product" product_count="5" aspect_ratio="0" image_width="250" image_height="250" template="Smartwave_Filterproducts::owl_list.phtml"}}</div><script>require(['jquery','owl.carousel/owl.carousel.min'], function ($) {$("#featured-slider .owl-carousel").owlCarousel({autoplay: true,autoplayTimeout: 5000,autoplayHoverPause: true,dots: false,nav: true,navRewind: true,animateIn: 'fadeIn',animateOut: 'fadeOut',loop: true,lazyLoad: true,navText: ["<em class='porto-icon-left-open-big'></em>","<em class='porto-icon-right-open-big'></em>"],responsive: {0: {items: 1},768: {items: 2},992: {items: 2},1200: {items: 4}}});});</script>
      3. Bestsellers
        1. This will show the products that are purchased the most on your site.
        2. Click Expand Source on the right to see the code to add the default bestsellers slider:
          1. Bestsellers Slider
            .page-layout-1column .block.widget #product-slider .products-grid .product-item {width: auto;padding-left: 10px;padding-right: 10px;}[class*='.page-layout-2columns'].block.widget #product-slider .products-grid .product-item {width: auto;padding-left: 10px;padding-right: 10px;}</style><div id="bestsellers-slider"><h2>Bestselling Products</h2>{{block class="Smartwave\Filterproducts\Block\Home\BestsellersList" name="bestsellers_product" product_count="5" aspect_ratio="0" image_width="250" image_height="250" template="Smartwave_Filterproducts::owl_list.phtml"}}</div><script>require(['jquery','owl.carousel/owl.carousel.min'], function ($) {$("#bestsellers-slider .owl-carousel").owlCarousel({autoplay: true,autoplayTimeout: 5000,autoplayHoverPause: true,dots: false,nav: true,navRewind: true,animateIn: 'fadeIn',animateOut: 'fadeOut',loop: true,lazyLoad: true,navText: ["<em class='porto-icon-left-open-big'></em>","<em class='porto-icon-right-open-big'></em>"],responsive: {0: {items: 1},768: {items: 2},992: {items: 2},1200: {items: 4}}});});</script>
      4. Sale
        1. This will show the products that are on sale.
        2. Click Expand Source on the right to see the code to add the default sale slider:
          1. Sale Slider
            <style>.page-layout-1column .block.widget #product-slider .products-grid .product-item {width: auto;padding-left: 10px;padding-right: 10px;}[class*='.page-layout-2columns'].block.widget #product-slider .products-grid .product-item {width: auto;padding-left: 10px;padding-right: 10px;}</style><div id="sale-slider"><h2>On Sale</h2>{{block class="Smartwave\Filterproducts\Block\Home\SaleList" name="sale_product" product_count="5" aspect_ratio="0" image_width="250" image_height="250" template="Smartwave_Filterproducts::owl_list.phtml"}}</div><script>require(['jquery','owl.carousel/owl.carousel.min'], function ($) {$("#sale-slider .owl-carousel").owlCarousel({autoplay: true,autoplayTimeout: 5000,autoplayHoverPause: true,dots: false,nav: true,navRewind: true,animateIn: 'fadeIn',animateOut: 'fadeOut',loop: true,lazyLoad: true,navText: ["<em class='porto-icon-left-open-big'></em>","<em class='porto-icon-right-open-big'></em>"],responsive: {0: {items: 1},768: {items: 2},992: {items: 2},1200: {items: 4}}});});</script>
    2. If you need to filter by category, you can add the category_id option to the block as shown below:

      1. {{block class="Smartwave\Filterproducts\Block\Home\LatestList" name="latest_product"category_id="3"product_count="5" aspect_ratio="0" image_width="250" image_height="250" template="Smartwave_Filterproducts::owl_list.phtml"}}
        1. You can find a category's ID under Catalog> Categories. You'll see the ID next to the category name.
          1. 45449591.png
  5. Press Save in the upper right hand corner to save the slider.

Next, we will be adding the slider to the bottom of the product page.

Step 2: Add the Slider to the Product Page

  1. In the navigation menu on the left, navigate to Content> Widgets.
  2. Click Add Widget in the upper right hand corner.
  3. For Type, select CMS Static Block:
    1. 45449592.png
  4. For Theme, select Smartwave Porto CPC:
    1. 45449593.png
  5. Click Continue.
  6. For Widget Title, type in Product Page Slider.
  7. For Assign to Store Views, most websites can select All Store Views.
    1. If you have multiple websites with CPCommerce and only want to select one store, click on the respective store in the list.
  8. For Sort Order, you can leave this blank.
  9. Under Layout Update, click Add Layout Update.
  10. Next to Display On, select All Product Types.
  11. Under Container, select Before Page Footer.
  12. On the left hand side, click Widget Options.
    1. 45449594.png
  13. Click Select Block and then click on the product slider title you setup earlier.
  14. Press Save.
    • Related Articles

    • How to Add/Modify Homepage Slideshow - Porto

      This article covers the basics of adding and modifying the slide contents on your homepage. Please note that this tutorial only applies to Porto Themes actively installed. Your slider(s) on the homepage is powered by a JQuery plugin calledOWL ...
    • How to Setup Featured, Latest, Bestseller, or Sale Product List Slider

      This article will guide you on how to setup the different types of product sliders. Pre-requisites Adding the Styles Before adding a slider, you will want to add the following styles under Stores> Configuration> Porto> Porto - Settings Panel> ...
    • Porto Configuration - Updating the Design

      Overview Having a well-designed website is crucial to attracting customers to your online store. The Porto theme has a dedicated design panel that allows you to brand many aspects of your store while also providing a section for custom stylings for ...
    • Mageplaza Instagram Feeds for Magento 2

      TABLE OF CONTENTS Overview Features Setup Step 1) Creating Your Instagram API Key Step 2) Add the Key to the Website Step 3) Add the Feed Troubleshooting Why are the Instagram images not showing up in the feed? Overview Mageplaza Instagram Feeds for ...
    • CPC: Products Page

      This article covers all the tasks within the products page of the sync interface. For an overview of how to interact with each task, visit this article. TABLE OF CONTENTS Items Categories Category Items Inventory Price Changes Images Updating Product ...