1

I'm trying to add a custom Javascript file and a jQuery file to my site. I've place the following code in my local.xml

<?xml version="1.0"?>
<layout version="0.1.0">
    <default>
        <reference name="head">
            <action method="addJs"><script>lib/jquery-1.10.2.min.js</script></action>
            <action method="addItem"><type>skin_js</type><name>js/main.js</name></action>
        </reference>
    </default>
</layout>

But that didn't work. Then I added the lines to page.xml

<block type="page/html_head" name="head" as="head"> 
    <action method="addJs"><script>lib/jquery-1.10.2.min.js</script></action>
    <action method="addItem"><type>skin_js</type><name>js/main.js</name></action>
</block>

But that didn't do the trick either. Eventhough the I have the cache disabled,I did flush it again and I even rebuild the indexes. Now i've run out of ideas to try.

2
  • are you sure you are editing the correct theme? Commented Dec 4, 2014 at 9:22
  • @Marius yes, I am using the default modern theme Commented Dec 4, 2014 at 9:24

1 Answer 1

0

Sometime theme did not load additem function. you need to add manually

Go to

http://nwdthemes.com/2014/09/25/adding-javascript-magento-head-block/

2
  • explain the answer briefly and then link to source later don't add one line answers. Commented Dec 4, 2014 at 10:07
  • @Sarfaraz Ali Thank you! I thought additem function was a standard Magento function Commented Dec 4, 2014 at 10:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.