0

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.

Gowri
  • 16,587
  • 26
  • 100
  • 160
  • Hi Gowri, are you asking for the HTML, or are you wanting to use the Joomla framework to add it to the head of the page? – udjamaflip Aug 18 '11 at 22:15
  • @udjamaflip:I'm not sure were to add.Because virtuemart is a module.So it'll not depends on joomla template. – Gowri Aug 19 '11 at 03:21
  • 1
    Virtuemart is a component yes, but you would still use the Joomla framework to add items to the header. The question still stands however, do you want the HTML to embed javascript in your template or do you want the PHP to place a JS link in your ? – udjamaflip Aug 21 '11 at 20:38
  • @udjamaflip:ok it make sense.how to add js in head. – Gowri Aug 22 '11 at 03:39

1 Answers1

0

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.

udjamaflip
  • 682
  • 1
  • 8
  • 24