Jump to content

Recommended Posts

Hi

I added the files 

/httpdocs/themes/mytheme/assets/js/footable.js
/httpdocs/themes/mytheme/assets/js/footable.min.js

And I edited the file 

/httpdocs/classes/controller/FrontController.php

and I added 

 public function setMedia()
    {
        $this->registerStylesheet('theme-main', '/assets/css/theme.css', ['media' => 'all', 'priority' => 50]);
        $this->registerStylesheet('theme-custom', '/assets/css/custom.css', ['media' => 'all', 'priority' => 1000]);
        $this->registerStylesheet('theme-custom', '/assets/css/footable.standalone.css', ['media' => 'all', 'priority' => 1000]);
        $this->registerStylesheet('theme-custom', '/assets/css/footable.standalone.min.css', ['media' => 'all', 'priority' => 1000]);

        if ($this->context->language->is_rtl) {
            $this->registerStylesheet('theme-rtl', '/assets/css/rtl.css', ['media' => 'all', 'priority' => 900]);
        }

        $this->registerJavascript('corejs', '/themes/core.js', ['position' => 'bottom', 'priority' => 0]);
        $this->registerJavascript('theme-main', '/assets/js/theme.js', ['position' => 'bottom', 'priority' => 50]);
        $this->registerJavascript('theme-custom', '/assets/js/footable.js', ['position' => 'bottom', 'priority' => 50]);
        $this->registerJavascript('theme-custom', '/assets/js/footable.min.js', ['position' => 'bottom', 'priority' => 50]);
        $this->registerJavascript('theme-custom', '/assets/js/custom.js', ['position' => 'bottom', 'priority' => 1000]);
        

but the two files does not load 

Regards,

Share this post


Link to post
Share on other sites

Hi,

Not sure which PS version you are using but you might want to read this: https://devdocs.prestashop.com/1.7/themes/getting-started/asset-management/

Especially "Registering in themes" part.

Or you could just add links to your assets directly in your theme header.tpl file.

No need controller override here....

 

Thanks

Edited by Verlonimo (see edit history)

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
×
×
  • Create New...

Important Information

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