Jump to content

Homeslider on CMS Page


Recommended Posts

Hello Community.

 

I would like to add the homeslider module to my CMS pages so that each page has the slider. Can someone walk me through it or provide a url to a discussion where this is done?

Share this post


Link to post
Share on other sites

I may have found an answer but the image is now duplicating. Can anybody provide some feedback on this?

 

Screenshot attached

 

Reference article: https://www.prestashop.com/forums/topic/385557-adding-homeslider-to-top-of-cms-pages/

https://www.prestashop.com/forums/topic/482657-why-is-the-hook-not-showing/

post-829377-0-22334200-1461107663_thumb.png

Edited by kdmonk1 (see edit history)

Share this post


Link to post
Share on other sites

Any thoughts on what could be the problem from anyone? What I can see, the javascript is not apart of the page which is causing the image not to work correctly. How can I get the javascript to attach properly on the CMS Pages?

Edited by kdmonk1 (see edit history)

Share this post


Link to post
Share on other sites

Getting close:

 

Inside of CmsController.php, you will need to add the javascript/css in this method.

 

public function setMedia()
    {
        parent::setMedia();
 
        if ($this->assignCase == 1) {
            $this->addJS(_THEME_JS_DIR_.'cms.js');
            $this->addJS(_THEME_JS_DIR_.'modules/homeslider/js/homeslider.js');
        }
 
        $this->addCSS(_THEME_CSS_DIR_.'cms.css');
        $this->addCSS(_THEME_CSS_DIR_.'modules/homeslider/homeslider.css');
    }
 
Slider functionality is missing now. Any thoughts?

Share this post


Link to post
Share on other sites

Final got it!

 

Here is the final code to get your cms page to have the homeslider:

 

public function setMedia()
    {
        parent::setMedia();
 
        if ($this->assignCase == 1) {
            $this->addJS(_THEME_JS_DIR_.'cms.js');
            $this->addJS(_THEME_JS_DIR_.'modules/homeslider/js/homeslider.js');
            $this->context->controller->addJS($this->_path.'js/jquery.bxSlider.min.js');
            $this->context->controller->addJqueryPlugin(array('bxslider'));
        }
 
        $this->addCSS(_THEME_CSS_DIR_.'cms.css');
        $this->addCSS(_THEME_CSS_DIR_.'modules/homeslider/homeslider.css');
        $this->context->controller->addCSS($this->_path.'bx_styles.css');
    }

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More