Saturday, September 14, 2013

Magento Add Block DIV Wrapper/Container Using Template

Problem:
How to wrap block html in a div wrapper/container (and set class name) using a template file (e.g. local.xml).

Solution:
e.g. wrap a div wrapper/container around the standard Magento newsletter subscribe block.

<block type="page/html_wrapper" name="subscribe.container" translate="label">
    <label>Subscribe Container</label>
    <action method="setElementClass"><value>subscribe-container</value></action>
    <block type="newsletter/subscribe" name="newsletter" after="leftMenu" template="newsletter/subscribe.phtml"/>
</block>

5 comments:

  1. Thanks For sharing this Superb article.I use this Article to show my assignment in college.it is useful For me Great Work. magento2 shipping rates

    ReplyDelete
  2. This comment has been removed by a blog administrator.

    ReplyDelete
  3. Pretty blog, so many ideas in a single site, thanks for the informative article, keep updating more article.
    logo design company chennai

    ReplyDelete
  4. Open source softwares, such as - Magento were founded on the idea and belief that you shouldn't be locked down to so many specifications and in many ways to limitations. plakatų dizainas

    ReplyDelete
  5. Been searching for such a remarkable blog like this for a long time.
    Setup Router VPN

    ReplyDelete