Jump to content

[Solved] Remove all CSS and JS using setMedia


Will O

Recommended Posts

Hello all,

We're in the middle of a store build using PrestaShop and need some help. We are completely restyling everything and pulling out a lot of modules and things that we don't need.

What I'd like to achieve is to remove all of the default CSS and JS (and add them back in one-by-one, as necessary). We're not using global.css and don't want to include all the page specific files included by each of the page specific controllers. i.e. category.css added by the setMedia call within CategoryControllerCore.
Is there any way to remove all "media" files across the board without having to create our own overrides for each page controller core?

Thanks for your help! :)

Cheers,

Will.

Link to comment
Share on other sites

An additional question...

I have created my own FrontController extending FrontControllerCore and created a setMedia function to apply our own css and js.
If we do have to override each page controller core (which it looks like we have to), is there any way for override Controllers to call FrontController's setMedia function directly? i.e. parent::setMedia() will call ControllerCore's setMedia - which in turn calls our FrontController.

I don't want to have to copy-paste my new setMedia function into each ControllerCore.

Thoughts?

Link to comment
Share on other sites

Thanks for the response mate.

Yes I was hoping not modify the core files (so that I can do an easier upgrade in the future). Looks like I'm going to have to modify those core files and keep track of my changes.

Thanks,

Will.

Link to comment
Share on other sites

Search the forum for "override" and learn about that concept.
It's different from "modify the core files" and is largely upgrade-proof.

Yep, thanks. Sorry I skimmed over your response and I thought you suggested to "modify the core files"!

I've read a lot about overriding classes and controllers and completely understand what's going on there.

I've already modified setMedia in my (override) FrontController class. What I'll do now is create an override class for Tools and replace the addJS/addCSS calls (to do nothing), and implement my own "myAddJS/myAddCSS" functions. Then modify my FrontController class to call Tools::myAddJS...

Thanks again for you help. Closing this issue now.
Link to comment
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...