I’m using opencart (version 1.5.1.3.1) for a client store, and am wondering what the best way to code it so I can have certain stylesheets added for certain routes.
For example, on my category page I’d like to have a different stylesheet to the default one, or one that will over ride the default styles with my custom sheet. I have use for this for more than one route obviously, and want to do this with as little edits required as possible, so as to reduce the amount of edits in the framework should I need to upgrade at any stage (and with opencart’s well known random changes and bug fix releases this is quite probable)
Open
catalog/controller/common/header.phpRight after the line
protected function index() {on a new line putThen go to your current theme, and create a file in
catalog/view/your-theme/stylesheet/folder calledproduct_category.cssand put your styles in that. The stylesheets work off your route name except you replace the forward slash to an underscore followed by.css, iecommon/homebecomescommon_home.cssNote that is is going to use the override method rather than replacing your default stylesheet