Slider Revolution magento extension FAQ

Slider Revolution: How to insert HTML slider in Magento 2

Tutorial requirements:

  • slider Revolution 5.x installed on magento 1.x.
  • magento 2 installation

This tutorial assumes that you have slider revolution for magento 1.x. You will need to export slider from that version in order to use it in magento 2. Do not upload magento 1.x extension to magento 2!.

  1. Login to magento 1.x admin and navigate to “NWDthemes > Revolution Slider > Slider Overview”.
  2. Open plugin’s “Global Settings”1global-settings-btn
  3. Set “Enable Markup Export option” to “On” and press “UPDATE” button in the bottom of popup.2enavle-markup-option
  4. Press F5 on your keyboard to refresh the browser’s page (or just reload the admin page manually).
  5. Select the “Export to HTML” option for your slider. This option will only be visible after performing steps #1-4 above.
    3export-to-html
  6. Slider zip has following structure:

    * assets
    * css
    * fonts
    * js
    * slider.html

    In slider html you can find the source code for the slider. You need to copy assets, css, fonts and js folder to your html site corresponding folders. Js and CSS includes can be found in head section of slider.html Slider source can be found in body section of slider.html

  7. Unzip slider package and copy it to web folder of your magento 2 theme. We will install the slider in default “Luma” theme. Usually custom themes located under app/design/frontend/. But in case with Luma it is located under vendor/magento/theme-frontend-luma/. We will install one of default sliders called classicslider. Result path would be vendor/magento/theme-frontend-luma/web/classicslider.
    Screenshot_1
  8. Now lets add slider css to the theme. First open classicslider/slider.html and open vendor/magento/theme-frontend-luma/Magento_Theme/layout/default_head_blocks.xml. Select fonts and stylesheet from slider.html HEAD tag and copy it to default_head_blocks.xml. In our case we need to copy this part from slider.html

    This code needs to be adjusted according to magento layout xml rules. Check magento 2 documentation for more information on including static resources – http://devdocs.magento.com/guides/v2.0/frontend-dev-guide/layouts/xml-manage.html#layout_markup_css

    CSS file include:
    was:
    <link rel="stylesheet" type="text/css" href="fonts/pe-icon-7-stroke/css/pe-icon-7-stroke.css">
    become:
    <css src="classicslider/fonts/pe-icon-7-stroke/css/pe-icon-7-stroke.css" />

    Google Font include:
    was:
    <link href="http://fonts.googleapis.com/css?family=Raleway%3A500%2C800" rel="stylesheet" property="stylesheet" type="text/css" media="all" />
    become:
    <link src="https://fonts.googleapis.com/css?family=Raleway:500,800" src_type="url" rel="stylesheet" type="text/css" />

    Resulting code for default_head_blocks.xml

  9. Next step is to specify dependencies for our javascript libraries. Create vendor/magento/theme-frontend-luma/requirejs-config.js with following content:
  10. Login to magento 2 admin panel
  11. I would highly recommend to disable WYSIWYG editor before creating static block. It can be done in Stores > Configuration > Content Management section

    Add static block that will represent slider code. It will also hold inline styles for the slider. To add static block you need to click on Content icon in right toolbar, click Blocks and press Add New Block button.
    Screenshot_3

    First lets copy inline styles from slider.html to static block content. They located in HEAD tag.
    Screenshot_4

    Next we will copy slider html code. It is located in BODY tag. Slider html require some changes in order to work correctly.

    • Change images path.
      Was:
      assets/datcolor.jpg
      Become:
      {{view url="classicslider/assets/datcolor.jpg"}}
    • Change javascript libraries path.
      Was:
      jsFileLocation:"//mysite.com/revslider/public/assets/js/",
      become:
      jsFileLocation:"{{view url="classicslider/js"}}/",
    • Wrap slider javascript into

      Was:

      Become:

  12. Create new “CMS Static Block” widget for home page. It can be done in Content > Widgets
    Screenshot_5

    Screenshot_6

  13. we need to remove “\pub\static” and “\var\” folders and execute commend through the console
    php bin/magento setup:static-content:deploy
  14. Clear cache ( System > Tools > Cache Management )
  15. Refresh your home page. You should have slider on frontend now.

Useful links:

http://devdocs.magento.com/guides/v2.0/frontend-dev-guide/layouts/xml-manage.html#layout_markup_css
http://devdocs.magento.com/guides/v2.0/javascript-dev-guide/javascript/custom_js.html

9 thoughts on “Slider Revolution: How to insert HTML slider in Magento 2

  1. Hello! I want buy slider revolution jquery and visual editor: create slide on my PC with visual editor, after use slider on my magento 2. I don’t want use version Revolution for Magento 2. Only Jquery. Is that possible? I do not want in my admin panel was a new module and use the database.

    • Hi Sergey

      It is 100% possible. But we wrote earlier, we do not test this tutorial with 2.1.
      Please update the comments with the result in case you will do it.

Leave a Reply

Your email address will not be published. Required fields are marked *