Make hikashop.css overridable by the template

  • Posts: 15
  • Thank you received: 0
6 years 11 months ago #269155

-- HikaShop version -- : 3.0.1
-- Joomla version -- : 3.7.0
-- PHP version -- : 7.0.1

This isn't a bug report, but hopefully an improvement to the way stylesheet files are included on the front-end. At the moment hikashop.css is included with the following (/administrator/components/com_hikashop/helpers/helper.php Line 3777):

$doc->addStyleSheet(HIKASHOP_CSS.'hikashop.css?v='.HIKASHOP_RESSOURCE_VERSION);

Can this be changed to:

JHtml::stylesheet('com_hikashop/hikashop.css',array('version'=>'v='.HIKASHOP_RESSOURCE_VERSION,'relative'=>true));

This produces exactly the same stylesheet declaration on the front-end, but the difference is that hikashop.css can now be overridden in the template by including a file at /templates/[my-template]/css/com_hikashop/hikashop.css

I understand that hikashop.css has important css declarations, but it would be great to give template creators the option to edit these rather than just adding css to override that file.

The same could also be done for the other stylesheets like tooltip.css, dropdown.css, etc and also javascript files.

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

  • Posts: 81484
  • Thank you received: 13062
  • MODERATOR
6 years 11 months ago #269177

Hi,

It's actually done like that on purpose. Because if you flat out override the whole CSS file in your template, that means that you need to keep it up to date each time we release a new version of HikaShop since the new CSS we add is not taken into account anymore.
It's safer to just override the CSS pieces you need in the template's CSS. Updates will be much smoother for the users of HikaShop and the template that way.

The following user(s) said Thank You: sashau

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

  • Posts: 15
  • Thank you received: 0
6 years 11 months ago #269232

Thanks for the reply nicolas. I understand your reasoning behind the decision, but is this something that can be reconsidered? That same logic could be applied to view files as these can change between Hikashop versions, but they are still able to be overridden. I don't think too many people would override hikashop.css, but those that do would understand the need to keep it updated with new Hikashop versions.

I understand that you would be concerned that a commercial template provider could override hikashop.css and then if they didn't keep it updated then their users could have issues - but this situation could already happen with overridden view files and it doesn't seem to be a big problem. It would also be easier to debug this issue since viewing the source of a page will easily show where hikashop.css is being loaded from.

For me, I would particularly like to use my own grid and button styles with Hikashop and so if I would like to take out a lot of what is in hikashop.css rather than load styles that won't be used.

Anyway, I hope this is something that can be reconsidered.

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

  • Posts: 81484
  • Thank you received: 13062
  • MODERATOR
6 years 11 months ago #269233

Hi,

It is a big problem. Most of our work time is eaten up by support and most of the support issues reported are actually not bugs from us but because CSS or view files are not kept up to date.
Even for view files, instead of simply copying the whole content of the view file in your override, it's much smarter to actually include the original view file after modifying the variables used in it, or replacing the HTML after the original view does its thing.
That way, you have a much higher chance of keeping your modifications valid with updates of the component and you get improvments in the views automatically. That goes for HikaShop, but for any other component too.
If you look at the templates listed on www.hikashop.com/download/templates-for-hikashop.html
almost none of them has made any update to support HikaShop 3's new view files and CSS files in their overrides and thus the templates don't work properly with HikaShop 3 even though it's now been 5 months that the 3 has been released and the first beta of the 3 was in September. It is in fact often easier to use any other template than these to avoid issues with HikaShop 3.
Besides, if you want to style the buttons your way, we've created specific options in the Display tab of the HikaShop configuration so that the merchant can specify the class he wants to use for the buttons. That way, he can easily switching between the CSS of HikaShop or of the template for them.
And as for the grid system, We've made it on purpose different than bootstrap's to be independent of the template so that the listings will be responsive regardless of how the template is made. Again, this is to reduce the support on our end.
In fact, we've had a few intense months fixing all the bugs in HikaShop 3 at the beginning of 2017, but now that it's stable, we notice that even though the sales are going like before, we have a decrease in support and a big part of it is because there are less issues with templates.
And again, I don't see how that's a problem for you. If you want to override the CSS on your template, just copy/paste the CSS from hikashop to your template, modify it and make sure that the template CSS file is after HikaShop's. It will take over HikaShop's CSS automatically.
So really, having CSS file overrides looks more like a way to make it easier for template designers to not do their job properly and increasing work for us than anything else as far as I can see.
I hope you can understand our position.

The following user(s) said Thank You: sashau

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

  • Posts: 15
  • Thank you received: 0
6 years 11 months ago #269343

Thanks nicolas I appreciate your response even if it wasn't what I hoped for. I at least now understand why it is done that way.

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

Time to create page: 0.063 seconds
Powered by Kunena Forum