Reply to comment

Thanks for your tip.
What i am doing for adding jquery is this:
1. In the root folder of magento installation there is folder js, in it i create another folder called jquery.
2. In root/js/jquery i put the jquery library and another javascript file jquery_functions.js cause from page.xml i see that it is using that folder name space to add the javascripts.
3. Make folder in app/design/frontend/default/ to represent your new theme, i call mine zoran and in it i create 3 folders (template, layouts and locale).
4. I copy the app/design/frontend/default/default/layouts/page.xml to app/design/frontend/default/zoran/layouts/page.xml. Just make sure you turn on this theme from the admin panel (with cache disabled)... How themes are organized, the page.xml will be loaded from the zoran folder cause it is higher in the hierarchy of the themes.
5. Add

                   <action method="addJs"><script>jquery/jquery-1.4.min.js</script></action>
		   <action method="addJs"><script>jquery/functions.js</script></action>
 

after
mage/cookies.js

in the head section, cause this part is loaded on every page of magento it will add the jquery library and the jquery_functions.js files.
To test it, open jquery_functions.js and add this code:
var jq = jQuery.noConflict();
 
jq(document).ready(function()
{
	alert('I am from jquery');
 
        //or
        //console.log('I am from from jquery');
});

Go to the frontend home page and refresh.

Reply

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <apache>, <bash>, <c>, <cpp>, <drupal5>, <drupal6>, <java>, <javascript>, <perl>, <php>, <python>, <ruby>, <xml>. The supported tag styles are: <foo>, [foo].

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.