js and css hikashop loaded on all pages

  • Posts: 202
  • Thank you received: 3
10 years 11 months ago #137481

-- HikaShop version -- : HikaShop Business 2.2.3
-- Joomla version -- : 2.5.14
-- PHP version -- : 5.4.3

Hi,

I saw that hikashop css and js were loaded on all pages of the site, wich is really bad, because I use it only certain pages, and I don't want my performances be slower because of scripts and css needed on other pages. There's no reason these scripts are loaded on all pages.
So I tried to clean that, but the problem is these scripts are called in the file:
administrator/components/com_hikashophelperes/helper.php line 2583
and I cant' succeed in restricting the load of the files to hikashop pages.

Would you know how to do that? I have already many scripts on my all pages, I really need to get rid of what is uselesss.

in advance thanks for your answer

Raphaelle

Please Log in or Create an account to join the conversation.

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
10 years 11 months ago #137501

Hi,

If the cart is display on all pages, the CSS and the JS would be useful.
If you have a HikaShop system plugin which load HikaShop on every pages, it could insert the JS and CSS too.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

  • Posts: 202
  • Thank you received: 3
10 years 10 months ago #137839

thanks for this answer but as you said it's useful only in these cases:

If the cart is display on all pages, If you have a HikaShop system plugin which load HikaShop on every pages

for all other cases it's not only useless, it's nocive for the website's speed.

In my case for example Hikashop is used only on Hikashop pages, wich represents 20% of my site. So I can't afford to make heavier 80% pages of my site uselessly. I really need to know please how I can remove these scripts from my other pages please?
or saying other: how can I load these scripts only when they're needed?

in advance thanks for your answer

Raphaelle

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
10 years 10 months ago #137897

The HikaShop library is loaded by one or several Hikashop system plugins on your other pages. Disable the ones you don't use and which load the HikaShop library on the other pages and you won't get the HikaShop js/css files there.
To find out which ones you can enable, disable all of the enabled system plugins, and reenable them one by one and check the frontend page each time you enable a HikaShop system plugin.

Please Log in or Create an account to join the conversation.

  • Posts: 202
  • Thank you received: 3
10 years 10 months ago #137990

Thanks for your answer but I made several tests and here is what I get: the hikashop js and css are loaded when my menu module is published !
when I deactivate the hikashop menu items from this menu, my js and css aren't loaded any more... but I can't access anymore to my hikashop pages! :S

It really looks like a bug, please could you fix it?

in advance thanks for your answer!

Raphaelle

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
10 years 10 months ago #138002

It's not a bug. It's because the routing system needs the HikaShop library to SEF the URLs of HikaShop. If you turn off the SEF and keep the HikaShop menu items enabled, you should not have the js/css files loaded either.

If you don't want the js/CSS files and still want the SEF turned on on your website, renaming the file components/com_hikashop/router.php so that the HikaShop SEF URLs are not optimized anymore by HikaShop and you will see that you don't get the js/CSS files anymore in such cases.

Please Log in or Create an account to join the conversation.

  • Posts: 202
  • Thank you received: 3
10 years 10 months ago #139083

thanks for your answer but if I rename the router file, I don't have any more sef on all my hikashop pages... :dry:
can't you unlink the call to js and css to the sef router please?

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
10 years 10 months ago #139119

No. Because the router needs to load the params of the configuration to know how to handle the SEF and for that it needs to load the main helper of HikaShop, and in that same file the js/CSS is loaded, and that file is loaded only once, which means that if we don't do it directly, it will be missing on all the pages as the helper file won't be reloaded and thus the JS/CSS not added. And loading the file several time is out as well as it would crash.

The only way is for you to remove all the piece of code there which uses parameters of the configuration and it will then work without taking them into account, and without loading the helper of Hikashop. Thr drawback is that the URLs will probably not be like you want and that it's not that easy to change the router for that, and we definitely can't do that by default in HikaShop.

Last edit: 10 years 10 months ago by nicolas.

Please Log in or Create an account to join the conversation.

  • Posts: 78
  • Thank you received: 5
  • Hikashop Business
10 years 8 months ago #149176

I have to say that this is really not ideal. I'm in the same situation as OP, and to have my entire site slowed down because Hikashop has to load js and css on unrelated pages is extremely frustrating. I can't imagine there is not a solution to this.

Please Log in or Create an account to join the conversation.

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
10 years 8 months ago #149248

Hi,

If you display an HikaShop module like the HikaShop cart, a product listing (feature products), the currency switcher or any other Hikashop module, these module could require the HikaShop JS and HikaShop CSS files.

If no HikaShop module and no HikaShop system plugin are published, there is no reason for HikaShop to be loaded and to include is JS & CSS files because HikaShop helper won't be loaded.

More than that, the inclusion of a JS and CSS file will not slow down your server.

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

Please Log in or Create an account to join the conversation.

  • Posts: 78
  • Thank you received: 5
  • Hikashop Business
10 years 8 months ago #149267

Not publishing a module is no problem, as I can limit those to certain sections of the site. But I can't target plugins, so they either are on or off, so I'm not sure how that helps.

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
10 years 8 months ago #149325

The only plugins of HikaShop that are loaded on all the pages are the system plugins. And not all of them always load the HikaShop library.
For example, the Affiliate plugin does because it needs to load the parameters of the configuration in order to know if it needs to run or not. But if you don't need an affiliate system on your website, you could disable the plugin since it is to one use to you.
The massaction plugin can also be disabled if you don't use any mass action.
etc
Note that the HikaShop user synchronization plugin should be kept published but it won't load the library unless he has to do some work (like after a user is created or modified).

Please Log in or Create an account to join the conversation.

Time to create page: 0.086 seconds
Powered by Kunena Forum