Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Magento skin_js path in page.xml

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

like image 961
jeanluc legros Avatar asked Nov 18 '12 17:11

jeanluc legros


Video Answer


2 Answers

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

like image 105
Renon Stewart Avatar answered Oct 21 '22 17:10

Renon Stewart


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>
like image 37
S P Avatar answered Oct 21 '22 15:10

S P