Add Css And Js To Specific Pages Only

Now I know how to add custom js and css using My Changes addon .

But how I can add js and css to specific pages only?

I got a related forum thread and the answer not works in version 4.3!

The thread says that I have to add condition in file.

{if $controller == 'pages' && $mode== 'view' && $smarty.request.page_id == 123}

The 123 is our page ID. But it not works.

Can any one help me?

hi there,

I think you can do this by putting 123 like "123"

{if $controller == 'pages' && $mode== 'view' && $smarty.request.page_id == "123"}

or else try printing value of page id in tpl then put condition.


In the latest versions please try:

{if $runtime.controller == 'pages' && $runtime.mode == 'view' && $smarty.request.page_id == "123"}


{if $location_data.dispatch == 'pages.view' && $page.page_id = 123}

in for js and in for css/less. Or put them in if you want them separately loaded instead of sucked into the cs-cart combined files.

Thank you all...

In version 4.3,

{if $runtime.controller == 'pages' && $runtime.mode == 'view' && $smarty.request.page_id == "123"}


{if $location_data.dispatch == ‘pages.view’ && $page.page_id == “123”}


works perfectly.

Thanks to @straygecko for additional tip.


Can somebody help me please...

My platform is and now i see that i have 700 requests.... :(

O lot of request is like this:


data:image/gif;base64,R0lGODlhAQABAIA… 0 B

How can i take this out from the website???

Looks like the issue is theme related and caused by images lazy load. Please contact theme developers and ask them about it