Magento 1.9 Custom Store View – Add Slider Plugin to Home Page

custommagento-1.9overridesstore-view

I'm new to Magento and I can't find out what must be done to enable Auguria Slider Plugin in my custom home page.

Here's what I've done so far:

  • In Magento admin I created a website, a store and a store view
  • Switched to this store context and setup a custom theme for it.
  • Copied stuff from default theme to my custom theme
  • Overridden things here and there, built a view for featured category…

Then I installed Auguria Slider, which let me enable it to any CMS pages I choose in Magento Admin.

My question is, how do I insert it in my custom home page theme, since it's not listed on CMS Pages?

I found the XML file for Auguria Sliders and copied to my local.xml what I found appropriate, it looks like this now:

<layout>
    <cms_index_defaultindex>
        <reference name="head">
            <action method="addCss"><stylesheet>css/auguria/sliders/default.css</stylesheet></action>
            <action method="addJs"><script>auguria/sliders/jquery-1.7.2.min.js</script></action>
            <action method="addItem"><type>skin_js</type><script>js/auguria/sliders/slides.min.jquery_forked.js</script></action>
        </reference>
        <reference name="root">
            <action method="setTemplate"><template>page/1column.phtml</template></action>
        </reference>
        <reference name="content">
            <block type="auguria_sliders/catalog_category_slider" name="auguria_sliders" after="-" as="slider" template="auguria/sliders/slider.phtml"/>
            <block type="newsletter/subscribe" name="featured" after="slider" as="featured" template="page/featured.phtml"/>
        </reference>
    </cms_index_defaultindex>
</layout>

If I enable Template Path Hints, I see it creates the html needed for the slider plugin, but shows nothing because no slider images data comes from backend.

Can you help me with this? What am I missing?
Thanks in advance.

Best Answer

A CMS Page has it's content loaded through specific XML file, under specifics XML tags, controlled by a certain PHP class.

The issue here is that you're trying to set the view for Auguria Slider under <cms_index_defaultindex> which is not where CMS Pages content are set to be shown.

If you enable a CMS Page for the homepage of the store you created, Template Path Hints will show that cms.xml is the one that controls CMS Page content loading, so, if you want to use the content that goes inside a CMS page, you must insert yours customization to override/add content for CMS Pages, which would be inside <cms_page></cms_page> tags. Your local.xml would look like this:

<layout>
<cms_page>
    <reference name="content">
        <block type="newsletter/subscribe" after="slider" template="newsletter/newsletter_calls.phtml" as="news_calls"/>
        <block type="newsletter/subscribe" after="news_calls" template="newsletter/subscribe.phtml" as="news_sub"/>
        <block type="newsletter/subscribe" name="featured" after="news_sub" as="featured" template="page/featured.phtml"/>
    </reference>
</cms_page>
</layout>

You can see that it's not loading Auguria blocks and assets (js,css) anymore. That's because it not necessary, since it's set to load for a CMS Page in Magento Admin, it will automatically do so. You just have to put your customization inside a block that loads CMS Pages content.

Related Topic