views:

434

answers:

1

I am using Magento Enterprise Edition. It includes a widget for banners, which I want to use inside of my template, rather than from inside of a CMS-run content block. I succeeded in generating the output from inside of a content block:

{{widget type="enterprise_banner/widget_banner" display_mode="fixed" rotate="series" banner_ids="4" template="banner/widget/block.phtml" unique_id="744a56c9a042cc9fa166163c12d869d9"}}

Simple enough. So inside of my layout xml, I tried this:

<block type="enterprise_banner/widget_banner" name="hero_banners" as="hero_banners" display_mode="fixed" rotate="series" banner_ids="4" template="banner/widget/block.phtml" unique_id="744a56c9a042cc9fa166163c12d869d9" />

Same parameters; I just added name and as. And then, inside of my template...

<?php echo $this->getChildHtml('hero_banners'); ?>

But I get no output. The profiler notes that the hero_banners block is loaded, but its template file (banner/widget/block.phtml) is never run.

Does anybody know what I'm doing wrong?

-P

+3  A: 

Turns out, it wasn't inserting any meaningful data because it wasn't receiving its parameters. It needs non-standard parameters to be set through action tags:

<block type="enterprise_banner/widget_banner" name="hero_banners" as="hero_banners" template="banner/widget/hero.phtml">
    <action method="setData"><key>display_mode</key><value>fixed</value></action>
    <action method="setData"><key>banner_ids</key><value>4</value></action>
</block>
Paul Frazee