Disable MooTools in VirtueMart - joomla

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.

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();

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).

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

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);
}
?>

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?

Related

What's the right way to save HTML in Laravel using eloquent particularily?

Do I need to use HTML::entities(Input::get('description')); in laravel to save the htmlText gotten off CKEditor. or has anyone tried it out... thanks.
The idea is to preserve the formatting and retain the text to display on another page, alternatively is there any package in packagist that one can download to strip and work on html inputs...
Please Note :: i am currently using laravel 4.2, so if there are changes in higher versions how can i implement it here..
Add Controller File:
echo e(Input::get('description'));

magento 2 custom phtml page

Having just got myself acquainted (enough) with Magento 1.9, and able to make the customisations required, I've been told that once it's out, we're moving to Magento v2.0.
Having found the differences in the file structure, I believe I can see where to place my code for the custom pages we use, but how can I add this page from my project to a static block for later use?
Previously, the method used was as follows (I realise this may not follow the best practise, but it worked):
Create element folder within theme or core templates directory.
eg. /app/design/frontend/<theme>/default/template/myelement/mypage.phtml
Add this page/element to a static block using the following in the content editor:
{{block type="<theme>/default" template="myelement/mypage.phtml"}}
This block can then be added to the category pages as required.
In Magento 2, I have tried what I believe to be required, which is replicating the file structure and adding phtml files to this, so the template file now resides in:
/app/code/<supplier>/<module>/view/frontend/templates/mypage.phtml
Adding to the content editor the following:
{{block type="<supplier>/<module>" template="mypage.phtml"}}
Unfortunately, this does not display the intended page (element). It doesn't display the calling "{{block" entry either, which usually happens when the line is invalid, so I can only assume that I'm missing something with the link to this template.
If anyone can offer some assistance with this, I would be most grateful.
EDIT:
Continued research on this has led me to the following assumptions:
Magento 2 requires more than just a new .phtml page, even for simple customizations.
I'm still missing something.....
Having gone through 3 different tutorials on creating new modules for Magento 2, each providing slightly different methods, but fundamentally being the same thing, I now have what I believe should be all the code elements to make a new .phtml template for display in a static block.
This has led to an additional problem though.
While I have the required code, I cannot add the module. Adding the module to etc/config.php, as suggested in 2 out of the 3 tutorials, simply crashed M2, both admin and frontend when you try to clear the cache. This is the case after manually clearing cache folders in the var directory.
Also, still unable to add the .phtml template file to a static block or page using content editor.
Not much hair left to pull out here, so looking for help! Thanks in advance
There are a few samples on GitHub, including https://github.com/magento/magento2-samples/tree/master/sample-module-newpage which shows a module adding a new page with a very simple PHTML template file. This example does not use CMS content editing however - it is a sample based on using layout files.
You mentioned you were getting crashes. Would need more details to help on that one. If you got it solved, could you update this question and accept a response to close it out? Thx!
You Should try "class" instead of "type". So your code should look like.
{{block class="<package>\<module>\Block\MyBlock" template="mypage.phtml"}}
You Should try "VenderName_Modulename::myelement/mypage.phtml" instead of "myelement/mypage.phtml". So your code should look like.
{{block class="VenderNameModulename\Block\MyBlock" template="VenderName_Modulename::myelement/mypage.phtml"}}

Magento "Shop By" URLs use "#%21" instead of a "?"

I'm working with a new Magento installation and using the shop-by links give me
example.com/catalogsearch/result/#%21color=1&q=shirt
instead of
example.com/catalogsearch/result/?color=1&q=shirt
I'm not sure where I should look to begin fixing this.
Thanks!
we had this same problem and found that a plugin was changing the url with str replace
changing the ? for #%21
the plugin changes the url so that it can be identified by the javascript file and updated via ajax.
the plugin in our case was vingento there seemed to be some confilcts with other plugins. After disabling this plugin and code our filter and paging links work again, although not via ajax.
Hope this helps you

Load page title in joomla 2.5 content

I am looking for a way to load a page title in the Joomla 2.5 content for SEO purposes. I know in joomla you can use a function to load a module such as {loadposition box1}.
Is there a way to have a feature or does anyone know an extension so you can do something similar to this {loadpagetitle}.
This will save me hours of work.
Thanks.
Firstly, install the Direct PHP plugin and enable it.
Then copy and paste the following code into your article:
<?php
$mydoc = JFactory::getDocument();
$mytitle = $mydoc->getTitle();
echo $mytitle;
?>
Make sure you use the php tags though.
Hope this helps. Regards.

How to include javascript in Joomla virtuemart product details

I am actually customizing product details page with the help of http://virtuemart.net/documentation/Developer_Manual/Modifying_the_Layout.html this page. I need to include some external and internal JavaScript.But don't know were to add script.Please some one help me to do this.
To modify product details page . i just worked in following file components/com_virtuemart/themes/default/templates/product_details/flypage.tbl.php.
Virtuemart version is VirtueMart 1.1.9 stable
Joomla Version is Joomla! 1.5.15 Stable
Thanks In advance.
Based on your responses in the comments here is the answer:
//This line defines what JavaScript file you wish to add, change it as needed.
$myJsFile = JURI::Base() . 'templates/my_template_name/js/myJsFile.js';
//this line fetchs the jdocument object which is needed to add items to the head (amongst other things)
$document =& JFactory::getDocument(); //Drop the & if PHP5
//This line adds the previously setup JS url
$document->addScript($myJsFile);
If you want to add or something custom like IE conditional tags then see here for more info: http://docs.joomla.org/Adding_JavaScript_and_CSS_to_the_page on how to use this object.

Resources