Modal Popups do not work correctly in description of multi-variants

Started by brandiware, February 09, 2018, 12:19:43 PM

Previous topic - Next topic

brandiware

Hi all,

when adding a modal popup in the product description of a multi-variant I get the following behaviour:

1. When the page is loaded first time the popup works fine
2. When another variant is chosen then the popup content is shown in a joomla frame (i.e. Start Page) rather than as a popup
3. When I refresh the page after selecting a multi-variant the popup works

I assume the some javascripting does not load immediately after variant switch ?

I can circumvent the problem using inline scripts like this (which leads me to my assumption):

<script src="https://www.w3schools.com/lib/w3.js"></script>

<a href="#openModal">HIER EIN BEISPIELPOPUP</a>

<div id="openModal" class="modalDialog" style="width:40%;heigth:60%;">
   <div>
      <a href="#close" title="Close" class="close">X</a>
      <div w3-include-html="index.php?option=com_content&view=article&id=446:das-ist-ein-beispiel-popup&catid=177&tmpl=article"></div>   
      <script>
      w3.includeHTML();
      </script>         
   </div>
</div>


Thanks for any help
Stefan

Studio 42

If you need dynamic code update, you have to add
jQuery('body').on('updateVirtueMartCartModule',function(){
//yourcode here
});

It's not the ultimate solution, but should work.
Else you can override the function on jquery ready
eg.
Virtuemart.cartEffect = function(form) {
//yourcode here
});

function cartEffect is an example, i don't checked exactly.

brandiware

To Studio 42. Not quite sure I understand your suggestion. I would need to reload the Javascript underneath the popup plugin with the event that is
triggered when a product variant is selected.

Any idea where in the ProductDetail and Sublayouts this would need to happen ?

brandiware

Does anyone know a commercial modal popup that works despite multi-variant selection (page load after multi-variant selection) ?

If not, I will have to stick with the html/CSS solution and expand that functionally.

Studio 42

Can you send a link to your shop, so i can check.
Perhaps you have already a compatible modal(eg using bootstrap modal or virtuemart core included fancybox modal)

Milbo

brandiware, we use also popups here and there. Check the popup of the "ask a question" it maybe gives you an idea how todo it.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

brandiware

Milbo, I actually checked the "ask a question" function. Fact is, it also messes up the product detail page
by e.g. changing typeface and the selection of a new variant won't work anymore. VM simply hangs.

All works fine, until I open "ask a question".