varient price won't work in mobile view

  • Posts: 46
  • Thank you received: 3
7 hours 46 minutes ago #365818

-- HikaShop version -- : 5.0.2
-- Joomla version -- : 5.1.4
-- PHP version -- : 8.02

Hi,
I use variants to have different prices for my products by some characteristics, in the desktop view price will update by selecting different characters but in the mobile view it seems it is disabled and does not update the price, how can I fix this issue?

Thanks in advance

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

  • Posts: 83303
  • Thank you received: 13468
  • MODERATOR
2 hours 57 minutes ago #365821

Hi,

I can see that the view files are heavily customized. And a major change is that you have the price area twice, once for the desktop and one for the mobile.
And it's not only for the price but also for the add to cart button.
I'm afraid you might have the same issue with the add to cart button: On mobile, once you change the selected variant and click on the add to cart button, you might get the default product added to the cart.

Instead of having twice the HTML of these areas on the page, I would recommend to have it only once, and change the display with CSS to make the price / add to cart area fixed at the bottom.

However, seeing all the work already made to customize the display, an easier solution might be to edit the javascript of the show_block_characteristic view file in order to update the HTML of the main areas not based on the ID (as you can only have one element with one ID on a page with HTML, which is what is causing your problem), but based on the class, with a loop as to update all the main areas, both the one for mobile and the one for desktop.
You'll want to adapt the code in the javascript function hikashopUpdateVariantData

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

  • Posts: 46
  • Thank you received: 3
1 hour 33 minutes ago #365824

Hi,
Thanks for the help,
but I don't know exactly what to do, cause I don't know the javascript, is it possible to tell me what to do?
and also about the desktop and mobile view, as you can see I delete the desktop view code completely in the mobile view, is it still affecting the code?
Thanks in advance

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

  • Posts: 46
  • Thank you received: 3
14 minutes ago #365828

Hi,
I deleted the desktop view code and tested it again, everything works fine;
Is it possible to put desktop and mobile code in two separate PHP files to load each one when the viewport is set?
Thanks in advanced

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

Time to create page: 0.059 seconds
Powered by Kunena Forum