1

I've created a file called page.xml that contains the action method and addJs of the file.

This page.xml file is saved in /app/design/frontend/default/blank/layout and looks like:

<?xml version="1.0"?>
<layout>
  <default>        
    <reference name="head">
      <action method="addJs"><script>custom/progress.js</script></action>
    </reference>
  </default> 
</layout>

I have put the JS file in the main js folder at root under custom/progress.js

When i load the page, no JS file loads up, and I have no idea what file i need to actually edit.

Joomla is so much better at being able to add JS files, why isn't it easy in Magento?

Someone please help me! Also, it's stupid that you can't paste any code here.

  • 3
    Magento is different then Joomla, so no use in going into a discussion about that. The SE editor does offer a code pasting functionality in the editor designated with {} as an icon. Please paste your XML content with that extension – Sander Mangel Oct 14 '13 at 14:48
  • Hmm okay, well i've added it now. Is there no easy file just to open and edit, and manually add the JS file in (like a global header file) – Lee Collings Oct 14 '13 at 14:53
  • Did you manage to solve the issue? – Sander Mangel Oct 17 '13 at 7:21
  • Not really I gave up. I may return to it at a later date, but I ruled that there was far too much work involved for what I was trying to do – Lee Collings Oct 17 '13 at 11:09
  • Could you please close the question by deleting, putting on hold or accepting an answer so we koop the score up? Good luck with the project! – Sander Mangel Oct 17 '13 at 11:12
3

Instead of overwriting the page.xml I would suggest using the layout/local.xml file in your active template.

If it doesn't exist please create the file app/design/frontend/default/blank/layout/local.xml and add the page.xml content you've already created.

Please make sure caching and JS script compression are disabled to see the changes

| improve this answer | |
  • This prevents my website from being shown, I jsut get a blank white page now. I deleted the layout.xml file, re-flushed all cache.. and my website still can't be shown... what has it done!? – Lee Collings Oct 14 '13 at 15:03
  • just adding the XML file won't completely break your shop in this way. Try turning off cache. – Sander Mangel Oct 14 '13 at 15:07
  • I've flushed all cache - Magento, and CSS/JS. I've got the site working now, i removed both Page.xml and local.xml, added the local.xml back.. the site works, but nothing's changing. When I inspect the page, the new JS file isn't being loaded – Lee Collings Oct 14 '13 at 15:08
  • If that didn't work turn the cache off. Might be a writing error – Sander Mangel Oct 14 '13 at 15:08
  • How do I turn cache off? – Lee Collings Oct 14 '13 at 15:09
2

Your inclusion of page.xml is effectively overwriting page.xml in the base/default theme. Place these changes into local.xml file or create a new module which defines a custom xml file to be included.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.