News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

re-trigger script

Started by Zegenrijk, June 25, 2024, 14:02:10 PM

Previous topic - Next topic

Zegenrijk

Hello,

I'm using on the productdetails page the module Tabs & Accordions from Regularlabs. But after hitting a customfield these tabs are not on a row anymore,but below each other.

I asked Regularlabs, the answer: 
The VM options load the contents in via ajax/javascript.
You will need to re-trigger the Tabs & Accordions script after new content is added.
Ask VM support on how to do that.

You would need to trigger:

RegularLabs.TabsAccordions.init(null);



On this post there is a solution, but it's not working: https://forum.virtuemart.de/thread/4299-joomla-plugin-funktioniert-nicht-in-produktbeschreibung/

J5.1.1, VM4.2.10 11010

How to solve?

Regards Michel


Jumbo!

It is pretty simple. Add the following Javascript to your template.

(function($) {
    $('body').on('updateVirtueMartProductDetail', function() {
        if (typeof RegularLabs !== 'undefined' && typeof RegularLabs.TabsAccordions !== 'undefined' && typeof RegularLabs.TabsAccordions.init === 'function') {
            RegularLabs.TabsAccordions.init(null);
        }
    })
})(jQuery);

Zegenrijk

Hello Jumbo,

Thanks for the code, but where do i add it exactly. In the provided link suggested is to put it in the spacer-buy-area of de productdetails default.php but then it chrashes....

Regards Michel

Jumbo!

You need to add it to your template's custom Javascript file. If you use the default Cassiopea template, add it to the - media/templates/site/cassiopeia/js/user.js file. Create the file if it does not exist on your site.

If you use a 3rd party template, contact your template developer.

Zegenrijk

Thank you Jumbo, solved!

Note: using Gantry framework with the Hydrogen template, so you can add a script in the Page Settings and check: Before </body>

Jumbo!