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>

2 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