Tabs don't work after adding options

  • Posts: 49
  • Thank you received: 3
  • Hikashop Business
1 year 9 months ago #342956

-- HikaShop version -- : 4.6.0
-- Joomla version -- : 3.10.10
-- PHP version -- : 8.0.20
-- Browser(s) name and version -- : firefox

Hello,

I am having an issue on my product page after adding options to the product.

After adding any options to the product the tabs for description, specifications etc., are no longer are functioning.
I cannot change tabs and no text is displayed under any tabs.
This only happens when i add options to the product.

Do you know what is causing the tabs to stop functioning?

Last edit: 1 year 9 months ago by jfischer_hika.

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

  • Posts: 81476
  • Thank you received: 13058
  • MODERATOR
1 year 9 months ago #342962

Hi,

There is probably a javascript error for some reason.
Can you provide the URL of a product page with the issue as well as a user account since your website is in maintenance so that we can check on the situation ?
That should enable us to understand what's going on and tell you what to do.

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

  • Posts: 49
  • Thank you received: 3
  • Hikashop Business
1 year 9 months ago #342973

Yes, I agree it is likely a Javascript error or some code that is preventing it from loading.

I sent a PM with the information you asked for.

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

  • Posts: 81476
  • Thank you received: 13058
  • MODERATOR
1 year 9 months ago #342981

Hi,

From what I can see, the issue is two folds:
- You have the "Synchronized add to cart" setting activated in the HikaShop configuration. You probably want to turn off that setting.
- You have a view override of product / option made via the menu Display>Views which contains old javascript code and thus that new option's javascript it not compatible with the old code of the view override.

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

  • Posts: 49
  • Thank you received: 3
  • Hikashop Business
1 year 9 months ago #342993

Ok,

The synchronize add to cart setting was causing the issue. I disabled it and the tabs are now functioning again.
I also changed the view/options to include the code that was missing.

I did not realize that creating view overrides where going to cause problems. I thought it would be safe to update Hikashop with the overrides in place.

How would I know if there is updated code in the views that will cause compatibility issues with older view overrides?
Do I need to recreate the overrides every time I update Hikashop?
This seems counter intuitive to the idea of overriding views.

Thank You

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

  • Posts: 81476
  • Thank you received: 13058
  • MODERATOR
1 year 9 months ago #342996

Hi,

We try to make new code backward compatible, at least as long as new features are not activated.
So normally, you don't have to redo your overrides.
But it's hard to know whether you'll have to redo them or not.
It depends on what we change, how your shop is setup and how you do your overrides.
Also, you need to be careful of the version number when you update. When it's a minor update (from 4.6.0 to 4.6.1 it means we changed less critical things). When it's a major update (from 4.6.1 to 5.0.0 for example, it means we changed core functions of HikaShop and you might need to adapt more things).

Now, there is a way to minimize issues with view overrides (and that's not only for HikaShop but for any extension, including Joomla's views themselves). When you do the override, instead of keeping the whole code and modifying it, it's better to require the original file and modify variables before, or change the HTML after.
Here is an example for product / option :

<?php 

// at the beginning you can change data in the attributes of $this so that it will affect the rendering in the original view file

ob_start(); // start a new buffer
require_once(HIKASHOP_ROOT.'components/com_hikashop/views/product/tmpl/option.php'); // load the original view file
$html = ob_get_clean(); // get the HTML generated and store it in $html
$html = str_replace('', '', $html); // you can use str_replace or preg_replace to replace things in the HTML
echo $html; // display the HTML of the view

Doing it like that, your override will automatically get the code modifications of the original view file when you update. So there is a lot less chance that something would break.
However, it means less freedom in what you can change in the view file. But for small changes like adding classes, or extra text, etc you should be able to do it like that.
Also, don't forget that you can also use translation overrides (to change text) and hidden options or even trigger events to change / add things to views without creating a view override.
To me, the view override of the whole code of the view is really the last resort when I can't do what I want any other way in order to minimize the troubles for future me.

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

  • Posts: 2143
  • Thank you received: 747
1 year 9 months ago #342997

nicolas wrote: But it's hard to know whether you'll have to redo them or not.


Hi,
I don't find it hard. For each new version's changelog there is - thankfully - a link to the "list of all the files changed". In that list, a quick scan tells you which view files have been changed, if any.


Need help with customisations of layouts, style or other site development? PM me!
(Don't forget to turn on "E-mail notification of new messages" )

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

  • Posts: 81476
  • Thank you received: 13058
  • MODERATOR
1 year 9 months ago #342998

Hi,

Sure. What I mean is that even with that list, in most cases you shouldn't need to redo your overrides. But yes, if a view file is listed in the changelog and you made an override on it, it's best to check your override is still working after the update.

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

Time to create page: 0.079 seconds
Powered by Kunena Forum