How to include javascript in Joomla virtuemart product details - joomla

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.

Related

Joomla Insert Content into product details

I use VirtueMart. I need to add some content to product details page to specific DIV. I cant only change template. I need to do this by php because it will be Joomla plugin.
Look at the override system for customizing Joomla, it also applies to Virtuemart. You can add code or simple html to the product details page and place it in the templates HTML folder (where overrides go).
If you only wish to have this on some products, you can have that product details file named something other than default.php and then it will be available to select as the layout to use in the Virtuemart product edit screen.

I want to customize profile edit with some additional fields on database(users table) in Joomla 2.5

I tried to override profile.xml file along with edit.php (view file) by placing them within templates/template_name/html/com_users/profile folder, and also made sure the edit.php file know about new profile.xml ($this->form->loadFile( dirname(__FILE__) . DS . "profile.xml");) but i cant seem to make it work while updating custom fields from profile editing page at the front end. Also i can see that custom fields are not in order as it should be with respect to profile.xml. Please somebody help me...
You can't override an Joomla xml file. You need to create a user plugin to install separately for the form fields to appear. There is a profile plugin that comes with the default Joomla installation. Further details on this can be found here.

How can I add custom fields in cms edit page (Admin Panel)?

I am facing an issue in Magento. I want to add some custom fields to Magento Admin Panel CMS Edit Page. I got a page while searching where it describes adding a custom field in CMS page: http://blog.flexishore.com/2011/08/add-custom-field-to-cms-page/ .
I have followed every step in this, but I am still getting an error Call to undefined function getLoad().
Can anyone here explain me how to add custom fields in CMS page?
You can try this article (http://www.atwix.com/magento/adding-custom-attribute-to-a-cms-page/) as well, it's more simple, maybe it will be helpful for you.
Also don't forget about cache, I recommend you disable it when you are testing your own modules.

How does joomla breadcrumbs work internally?

I've already gone thru: http://docs.joomla.org/How_to_add_breadcrumbs
and http://api.joomla.org/Joomla-Framework/Application/JPathway.html
but they don't help.
I have not found any more info in any books or internet.
My website has 1000's of pages generated thru script.
I want to generate breadcrumb navigation for the pages.
Google has refused me Adsense account due to this lack of navigation.
I'm not sure what else there is to explain. Joomla stores breadcrumbs in the $pathway object. A components adds items to that object using 2 parameters, name and link.
You call the object with:
$pathway =& $mainframe->getPathway();
Then you add to it with:
$pathway->addItem('name of item', 'link to item');
Then you add the breadcrumb module in the module manager. There is no more too it, what else would you need?
The breadcrumb is generally updated by the component that is being called.
$pathway =& $mainframe->getPathway();
And then
$pathway->addItem($membership->name, JRoute::_('index.php?option=com_rsmembership&view=membership&cid='.$membership->id.':'.JFilterOutput::stringURLSafe($membership->name) . "&Itemid=" . $itemid));
The above is an example from rsmembership
Essentially the breadcrumb is maintained (or stored) by Joomla, and added to by the components.

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

Resources