rss
twitter
    Find out what I'm doing, Follow Me :)

Wednesday, January 20, 2010

Pin It

Widgets

Add a javascript file to your magento page templates

Customising your magento store can be a good way to set your store apart from the competition so adding features that require javascript files is a common task when building a project.  Learn how to include a javscript file into your magento page templates with this quick how to.The default layout template load is made primarily through the page.xml file located at the following url for custom themed installs /app/design/frontend/your-instance-name/your-theme-name/layout/page.xml , or for the default theme at /app/design/frontend/default/default/layout/page.xml.

Find the following block encapsulator <block type="page/html_head" name="head" as="head"> and simply add the following command inside the block

<action method="addJs"><script>yourscriptname.js</script></action>

Then upload you updated page.xml file. 

With that done, you need to now upload your javascript file to /skin/frontend/your-instance-name/your-theme-name/js/yourscriptname.js, or for the default theme /skin/frontend/default/default/js/yourscriptname.js

Source : http://www.magento-tutorial.com/

2 comments:

  1. This does not work, alwasys goes to the magento/js directory, not to your skin one. And, by the way, you have copied that from other site in the Internet... Write your own articles and test them before opening your big mouth!!! LAMER!!!

    ReplyDelete
  2. Javascript files need to be copied into /js, not in the skin folder. Skin folder is only used for css, images.

    ReplyDelete