Modal window won't always work on variant pages

  • Posts: 100
  • Thank you received: 2
11 years 5 months ago #105820

Hi,

I have an odd problem -- not sure if you can help. On several of my product pages I have set up a customer upload link (for photos) that opens in a modal window. These products are custom photo light boxes that have two variants and can be ordered in either cedar or pine -- cedar is the default.

when the product page first opens the modal window works (Upload Your Photos button halfway down the page). When you click the radio button for the optional variant "pine" for instance, the modal window no longer works unless you refresh the page. If you go back to the first variant "cedar" it won't work either.

I think it has something to do with the browser caching the page. I tried putting some different info onto the pages to force the browser to refresh but it still didn't refresh the modal script.

Any ideas or suggestions?

site under development: amykandco.com/dev2/photo-d-lights/product/55-photo-d-light-4x4

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

  • Posts: 82760
  • Thank you received: 13346
  • MODERATOR
11 years 5 months ago #105933

Hi,

The problem is that you put the popup button in the description and that the description is refreshed when you select another variant as you can have different descriptions for different variants. And your popup button doesn't handle the reinit of the popup modal system for the new button.
In your button, you should actually have an onclick attribute which would call the fromElement function of the modal JS library to reload the button when you click on it and that would work.
But as a quick fix, you can simply remove the code:

<div id="hikashop_product_description_<?php echo $variant_name;?>" style="display:none;">
					<?php echo JHTML::_('content.prepare',preg_replace('#<hr *id="system-readmore" */>#i','',$variant->product_description));?>
				</div>
of the file "show" of the view "product" via the menu Display->Views and that will remove the refresh of the description on the product page when you select a variant.

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

  • Posts: 100
  • Thank you received: 2
11 years 5 months ago #105965

Thanks for you answer and solution.

I'm not sure I understand properly, but if possible and not too complicated, I would prefer to code the button properly instead of doing the quick fix.

Do you know where I could find the code that uses the onClick attribute?

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

  • Posts: 82760
  • Thank you received: 13346
  • MODERATOR
11 years 5 months ago #105969

No, I don't know how you added it to the description. You will have to do that on your end if you don't want to use the solution I provided via HikaShop to circumvent the problem.

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

  • Posts: 100
  • Thank you received: 2
11 years 5 months ago #105972

Thanks for all your help! I did use your solution for now and it works perfectly.

I will have to learn a bit more about javascript if I want to do it the other way you mentioned.

Thanks again.

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

Time to create page: 0.056 seconds
Powered by Kunena Forum