Remove unnecessary code

  • Posts: 1119
  • Thank you received: 114
5 years 4 months ago #308767

-- HikaShop version -- : 1907151726

Hi,

Been adapting template with new Hikashop 4.2.0 and found some hardcoded css probably with "addStyleDeclaration" which shouldn't be used if not needed.

Inside menu item->product options->Item Box configuration and Item Layout we everything have set to "NO".
In Configuration->Default parameters for DIVs everything is set set to "NO" too, but some styles are still added which shouldn't be. Like margin and text-align...

Please add some additional check to prevent this.







Thank you

Attachments:

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

  • Posts: 1119
  • Thank you received: 114
5 years 4 months ago #308774

One more.

If setting image width and height via module or menu item product options, the style is added too. As you have own grid system i don't think we need this at all....





If we remove height and width, thumbs are generated to big.

Thanks

Attachments:

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
5 years 4 months ago #308769

Hi,

For the margin, we can remove them if not set. For the text-align, you want to keep it so that the text is aligned to the left (in case the template has CSS code aligning all the text centered. Otherwise, the text would be centered while you selected "no" in the "text centered" setting.

Regarding the width, this CSS is necessary for when you have badges on the products as the badges are positioned on top of the main image.

Note that if you want to remove all that CSS, you can add an entry with the namekey no_css_header and the value 1 in the hikashop_config table via your phpmyadmin.

Last edit: 5 years 4 months ago by nicolas.

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

  • Posts: 1119
  • Thank you received: 114
5 years 4 months ago #308824

Hi,

Added value 1 for no_css_header and it has removed all css. Thank you for such feature.

1. Does it effect back-end? As far i can see there is no difference but still would like to know.

3. Will this be lost after update?

Thank you

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

  • Posts: 1119
  • Thank you received: 114
5 years 4 months ago #308828

Just noticed that some css is still added for product image height and width if used:

Attachments:

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

  • Posts: 1119
  • Thank you received: 114
5 years 4 months ago #308846

As my new question is related more to this topic i will ask it here.

1. With new ajax filter, looking at html of product listing i see checkout spinner classes are added twice which makes no sense, check image:




2. And displaying products via hikashop content module those spinner classes are there too. Why would it be here if ajax filtering is done only on product listing?



Thanks

Attachments:

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
5 years 4 months ago #308833

Hi,

No, that's just for this dynamic CSS on the listings, it won't affect elsewhere.

And no, the settings you add / change in the hikashop_config won't change with updates. It's like the settings of the configuration page. They don't change when you update.

And regarding that last bit of CSS, this comes directly from the item layout view file you're using. Some of it is necessary to handle the "fade" layout that you're using for this module. You can find it at the bottom of product / listing_fade.php so you can easily remove it with a view override via the menu Display>Views.

1. and 2. That's good points. While having these there when not needed doesn't create a problem, these are indeed not necessary. I've added a patch to remove them. The patch is online if you want to try.

Last edit: 5 years 4 months ago by nicolas.

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

  • Posts: 1119
  • Thank you received: 114
5 years 4 months ago #308873

Hi,

1. What about load_js and load_css new hidden settings? How can they be used? Does it effect back-end too?

2. Thanks. Having less DOM is always welcome.

Regards

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
5 years 4 months ago #308881

Hi,

1. It doesn't affect the backend. There is no point in removing the CSS/JS in the backend since normally you're using the Joomla template and you don't have to optimize the page speed like you need on the frontend.
You can use them by adding an entry with the namekey load_css or load_js and the value 0 in the table hikashop_config via your phpmyadmin.

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

  • Posts: 1119
  • Thank you received: 114
5 years 2 months ago #311125

Hi,

I have succesfully added no_css_header with value 1 and load_css with the value 0 in the hikashop_config. However some css is added in header if product thumbnail size is used via System->Images->Thumbnail (width x height).

Also if no thumbnail size is added i still see some empty html style attribute in the head, which probably comes from Hikashop... Attaching some screenshots





Thank you

Attachments:

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

  • Posts: 1119
  • Thank you received: 114
5 years 2 months ago #311127

Please ignore. Found it at the end in listing_img_title.php :)

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

Time to create page: 0.128 seconds
Powered by Kunena Forum