Magento skin_js path in page.xml

17,741

Solution 1

Try changing (assuming that myjs.js is in skin/frontend/default/blank2/js/myjs.js)

<action method="addItem"><type>skin_js</type><name>myjs.js#notify</name></action>

to

<action method="addItem"><type>skin_js</type><name>js/myjs.js#notify</name></action>

Because myjs.js is not found in your theme then it will try to look for it in the base theme folder

Solution 2

It means that it cannot find the js in your theme nor the default folder.

Change to:

    <action method="addItem"><type>skin_js</type><name>js/myjs.js#notify</name></action>

Solution 3

If the file doesn't exist into your custom theme path then skin_js will return the base theme folder path. So make sure your file exist into your custom path and give the correct path.

Share:
17,741
Admin
Author by

Admin

Updated on July 23, 2022

Comments

  • Admin
    Admin almost 2 years

    I tried to add a javascript with a custom template through its page.xml like this:

    <action method="addItem"><type>skin_js</type><name>myjs.js#notify</name></action>
    

    Notify will throw an alert windows so I can check if it's correct after reload. In addition I check the source code to see where it tries to go. Template is correctly setup and cache is flushed.

    With the above script it goes to:

    <script type="text/javascript" src="http://127.0.0.1/magento/skin/frontend/base/default/myjs.js#notify"></script>
    

    Which doesn't exist here.

    Script is located in skin/frontend/default/blank2/js/live.js