Page 1 of 1

Javascript on checkout form load

PostPosted: Sun Jun 24, 2012 2:31 pm
by info@.....com
Hi,
I need to add some javascript (for some analytics) on the loading of the checkout form. This is similar to the Tracking configuration but on the loading of the form, not on the pressing of the submit button. As far as I can tell there isn't a way of configuring this? Would you have any recommendations as to which file to add the javascript in so as to minimized potential issues when upgrading One Page Checkout?

Thanks in advance

Mike

Re: Javascript on checkout form load

PostPosted: Wed Jun 27, 2012 6:16 pm
by admin
Hello Mike, there is now way to add it from the backend and you might want to do it this way:

For OPC1 each template does it's includes from include.php in /components/com_virtuemart/themes/default/templates/onepage/YOUR THEME/include.php (please have a look on three_column_templates which have the most includes of css or javascripts)

There is a guide how to add a custom after-page load script here:
http://docs.joomla.org/Adding_JavaScript_and_CSS_to_the_page

If you decide to use:
Code: Select all
window.addEvent("domready", function()   ...

your mootools cannot give any errors (pls check with ctrl + shift +j on FF or F12 on chrome). If you see any sort of errors, it is not sure if the javascript loads properly.

If you were ok with javascript AFTER the form validation AND button press, you can use the Tracking tab to add javascript.

Best Regards,
Stan