VirtuosiMedia
VirtuosiMedia

Reputation: 53366

Disable MooTools in VirtueMart

I'm creating a custom module for displaying VirtueMart categories, but need to disable VirtueMart from loading MooTools because it uses an older version of MooTools than what I need. I've searched everywhere, but I can't seem to find the file or function that will allow me to disable it. Any help would be greatly appreciated.

Upvotes: 0

Views: 2652

Answers (5)

user604716
user604716

Reputation: 21

I created a custom component for front and back ends, and I couldn't (for the life of me) disable mootools. I tried unsetting headers array and all that, and it didn't work! It worked fine for regular pages where the component was a regular article, but not when it's my custom component.

I was using the JHTML::script() function in my template, and after reading one of the comments here, I tried adding a second parameter (FALSE) to the function and it worked!

Thank you!!!

Any ideas why unsetting mootools from the $document variable's _scripts array doesn't work with custom components?

Upvotes: 0

AHeavyObject
AHeavyObject

Reputation: 602

At least in virtuemart 1.5 go to components/com_virtuemart/themes/YOURTHEME/theme.php find line about 37, there is a function:

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

Just comment

vmCommonHTML::loadMooTools();

Upvotes: 1

Garrett Bluma
Garrett Bluma

Reputation: 1312

If that doesn't do it, put this in your template and it will remove any of the default scripts that Joomla tries to use. Obviously this might remove things necessary for Virtuemart to work right, but it might solve your problem too.

<?php
$user =& JFactory::getUser();
if ($user->get('guest') == 1) {
    $headers = $this->getHeadData();
    $headers['scripts'] = array();
    $this->setHeadData($headers); 
}
?>

Upvotes: 0

VirtuosiMedia
VirtuosiMedia

Reputation: 53366

I was able to resolve my issue. My custom module was using JHTML::script() to load my JavaScript files. That particular function has a third parameter that defaults to true that will automatically load MooTools. You can see the documentation here: http://docs.joomla.org/Adding_JavaScript

Upvotes: 0

zombat
zombat

Reputation: 94177

The only reference to it in the entire project is in mod_virtuemart_currencies.xml. I'm not 100% familiar with Joomla, but this looks like an installer file for a particular currency module.

I'd suggest removing that module, or updating the reference to the MooTools library it's using inside that XML file (line 30 in the currently available version, inside modules/mod_virtuemart_currencies_1.14.j15/mod_virtuemart_currencies.xml).

Upvotes: 0

Related Questions