On a Magento installation, I’m trying to insert xml into the Layout Update XML of my home page. I already have some xml in there that is working, but I would like to add a jQuery script to run my slideshow. I had it in page.xml (and was planning to move it to my local.xml at some point), where it was working, but it broke the Add to cart on product pages. So, I thought I would consolidate onto just the main page, and put it into the Layout Update XML. For some reason it isn’t coming through.
<reference name="head">
<action method="addJs"><script>jquery/jquery-1.7.1.noConflict.min.js</script></action>
<action method="addJs"><script>folder/slider.js</script></action>
</reference>
Any ideas why it would work in my page.xml and not in here?
Here is the nesting idea in page.xml
<default translate="label" module="page">
<label>All Pages</label>
<block type="page/html" name="root" output="toHtml" template="page/3columns.phtml">
<block type="page/html_head" name="head" as="head">
<action method="addJs"><script>prototype/prototype.js</script></action>
You can do as follows :
add javascript into local.xml
then make a custom home page template ( take reference from 1column.phtml ), select this template for homepage from CMS.
Put the following content in home page “XML Layout Update” section from Design tab.
Here is mine setting which I remove whole prototype scripts from homepage is because didn’t want.
Also, don’t create a specific noConflict page, just put end of the jQuery script which is working well.
For instance, here is mine :
jQuery&&define("jquery",[],function(){return f})})(window);var $jQuery = jQuery.noConflict();Also, yu should create
jqueryfolder in rootjsdirectory, not in skin folderjsdirectory.