1

I am creating a custom theme and would like to use EE banners. When I use the example from this question: https://stackoverflow.com/questions/22793051/magento-enterprise-banners

Mage::getModel('enterprise_banner/banner')
  ->getResource()
  ->getBannersContent(array(0 => 1), 1); 

It works but I have to specify the id of the banner. I have no way of knowing what the id is going to be.

How can I get either the first active banner or all active banners?

Edit


Based on the answer provided by B00MER I am now attempting to use Enterprise Banners via widgets. Following the instructions here: http://docs.magento.com/m1/ce/user_guide/cms/widget-create.html I am able to create and add widgets to my theme. When I use CMS Static Blocks in my widgets and they show up correctly. However when I attempt to use a Banner Rotator nothing shows up on the frontend.

I have also tried putting a banner inside a CMS Static Block like this:

before banner
{{widget type="enterprise_banner/widget_banner" display_mode="fixed" banner_ids="1,2" template="banner/widget/block.phtml" unique_id="xxxxxxxxx"}}
after banner

And this is what is output on the frontend:

<div class="widget widget-static-block">before banner
after banner</div>

Based on this question: Magento EE 1.14.1 RWD not displaying Rotating banner widget I thought maybe the problem was my theme parent. So I changed from <parent>rwd/default</parent> to <parent>rwd/enterprise</parent>. Still nothing...

Why are my banners not showing up?

1

You shouldn't need to use resource models just for displaying banners:

A banner rotator can be used to display a single banner, or multiple banners in a specific sequence or random order. The next banner in the sequence appears when the page is refreshed. As a widget, the banner rotator can be assigned to a specific page, product, or category, and placed most anywhere in your store. In addition, a banner rotator can be associated with a specific shopping cart or catalog rule.

As an alternative, you can also use a jQuery slider or carousel that changes images automatically, like the one on the home page of the Magento demo store. There is a wide assortment of jQuery sliders available online, and many are free. To add a slider to your store, first create a static block. Follow the slider instructions to add the jQuery code to the block. Then, use the Widget tool to place the static block where you want it to appear in your store.

Technically you should be able to control and create through the widgets, layout options and even linking banners to cart/catalog promos. If you are making a custom theme that would be reusable, keeping away from hard coded IDs and leveraging the admin controls and layout system is the best approach.

If you're unfamiliar with the layout mechanisms I'd highly checkout Alan's http://store.pulsestorm.net/products/no-frills-magento-layout No frills layout book.

| improve this answer | |
  • 1
    Thanks for your answer! Yes, it really makes sense to just use widgets... I am able to create other widgets and add them to the page, but for some reason the banner widget doesn't work. (I've cleared the cache, used the same block reference as other widgets, made sure it's not hidden with css, etc). Do you have any idea why it's not showing up? – NateW Feb 15 '17 at 19:21
  • @NateW docs.magento.com/m1/ce/user_guide/cms/widget-create.html This may help? – B00MER Feb 15 '17 at 20:28
  • 1
    Yes, that's what I've done and it works for other types of widgets... Just not the Banner Rotator. I found this magento.stackexchange.com/questions/60581/… and changed my theme's parent to rwd/enterprise but still nothing. – NateW Feb 15 '17 at 20:36
  • 1
    I've updated my question with these new details. – NateW Feb 15 '17 at 21:20
  • 1
    Any ideas why it's not working? – NateW Feb 28 '17 at 0:35

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.