Print
Category: Virtuemart
Hits: 25405
Star InactiveStar InactiveStar InactiveStar InactiveStar Inactive
 

How to disable mootools in Virtuemart 1.1.x?If Joomla's mootools conflicts with Virtuemart's mootols or there some other conflicts with Virtuemart's mootools, the best way to disable it is to disable it in the Virtuemart template. At least it works in Virtuemart 1.1.5 and Virtuemart 1.1.6.

/components/com_virtuemart/themes/YOURTHEME/theme.php

line about 37

function vmTheme() {
       parent::vmTemplate();
       vmCommonHTML::loadMooTools();
}

If you just comment line:

//##my Commented. It was: vmCommonHTML::loadMooTools();

it will disable virtuemart's mootools, but also virtuemart javascript functionality. I.e. ajax card add. To avoid it you should add two javascript files compatible with Joomla's mootools 1.2.4.

The files are:

  • fixedzip mooPrompt.js  (my fix of native Virtuemart file, my change is marked with ##my, the original development is abandoned)
  • modern version of zip slimbox.js (developer's link)

Or together in one archive: zip mooPrompt.js + slimbox.js 

So unpack this and place the two files into your VM theme:

/components/com_virtuemart/themes/YOURTHEME/js/mooPrompt.js

/components/com_virtuemart/themes/YOURTHEME/js/slimbox.js

And in file /components/com_virtuemart/themes/YOURTHEME/theme.php change

vmCommonHTML::loadMooTools();

width this:

  
        /*##my#2010-12-14 18:49:45 { Fix mootools
        //It was:
        vmCommonHTML::loadMooTools();
        //It became: */
        global $mosConfig_live_site, $vm_mainframe, $VM_LANG;
        if( !defined( "_MOOTOOLS_LOADED" )) {
            $vm_mainframe->addScriptDeclaration( 'var cart_title = "'.$VM_LANG->_('PHPSHOP_CART_TITLE').'";var ok_lbl="'.$VM_LANG->_('CMN_CONTINUE').'";var cancel_lbl="'.$VM_LANG->_('CMN_CANCEL').'";var notice_lbl="'.$VM_LANG->_('PEAR_LOG_NOTICE').'";var live_site="'.$mosConfig_live_site.'";' );
            $vm_mainframe->addScript( VM_THEMEURL .'/js/mooPrompt.js' );
            $vm_mainframe->addStyleSheet( $mosConfig_live_site .'/components/'. VM_COMPONENT_NAME .'/js/mootools/mooPrompt.css' );
            define ( "_MOOTOOLS_LOADED", "1" );
        }
        if( !defined( '_SLIMBOX_LOADED' )) {
            $vm_mainframe->addScriptDeclaration( 'var slimboxurl = \''.VM_THEMEURL.'/js/\';');
            $vm_mainframe->addScript( VM_THEMEURL .'/js/slimbox.js' );
            $vm_mainframe->addStyleSheet( $mosConfig_live_site .'/components/'. VM_COMPONENT_NAME .'/js/slimbox/css/slimbox.css' );
            define ( '_SLIMBOX_LOADED', '1' );
        }
        /*##my#2010-12-14 18:49:45 } */

Found a typo? Please select it and press Ctrl + Enter.
FaLang translation system by Faboba