2

I have try this code in controller to render the block.

$layout         = Mage::getSingleton('core/layout');
$block_header  = $layout->createBlock('core/template_facade');
$block_header->setDataByKey('alias_in_layout','container1');
$block_header->setDataByKeyFromRegistry('options_container','product');
$block_header->append('product.info.options.wrapper');
$block_header->append('product.info.options.wrapper.bottom');
echo $block_header->toHtml();

But its doesn't render the blocks.

And my layout file is

<block type="core/template_facade" name="product.info.container1" as="container1">
   <action method="setDataByKey"><key>alias_in_layout</key><value>container1</value></action>
   <action method="setDataByKeyFromRegistry"><key>options_container</key><key_in_registry>product</key_in_registry></action>
   <action method="append"><block>product.info.options.wrapper</block></action>
   <action method="append"><block>product.info.options.wrapper.bottom</block></action>
</block>

how can i render block.

Assist me.

2
  • have tried this on other controller except products controlles
    – Amit Bera
    Dec 4, 2015 at 18:27
  • Yes, I tired in my custom controller.
    – V-jay
    Dec 7, 2015 at 9:49

1 Answer 1

2

This code from the catalog xml moves the product.info.options.wrapper and product.info.options.wrapper.bottom blocks to the container but it does not create them.

This is the code that creates them (from the base/default theme):

<reference name="content">

    ...

    <block type="catalog/product_view" name="product.info.options.wrapper" as="product_options_wrapper" template="catalog/product/view/options/wrapper.phtml" translate="label">
        <label>Info Column Options Wrapper</label>
        <block type="core/template" name="options_js" template="catalog/product/view/options/js.phtml"/>
        <block type="catalog/product_view_options" name="product.info.options" as="product_options" template="catalog/product/view/options.phtml">
            <action method="addOptionRenderer"><type>text</type><block>catalog/product_view_options_type_text</block><template>catalog/product/view/options/type/text.phtml</template></action>
            <action method="addOptionRenderer"><type>file</type><block>catalog/product_view_options_type_file</block><template>catalog/product/view/options/type/file.phtml</template></action>
            <action method="addOptionRenderer"><type>select</type><block>catalog/product_view_options_type_select</block><template>catalog/product/view/options/type/select.phtml</template></action>
            <action method="addOptionRenderer"><type>date</type><block>catalog/product_view_options_type_date</block><template>catalog/product/view/options/type/date.phtml</template></action>
    </block>
            <block type="core/html_calendar" name="html_calendar" as="html_calendar" template="page/js/calendar.phtml"/>
        </block>
    <block type="catalog/product_view" name="product.info.options.wrapper.bottom" as="product_options_wrapper_bottom" template="catalog/product/view/options/wrapper/bottom.phtml" translate="label">
        <label>Bottom Block Options Wrapper</label>
        <action method="insert"><block>product.tierprices</block></action>
        <block type="catalog/product_view" name="product.clone_prices" as="prices" template="catalog/product/view/price_clone.phtml"/>
        <action method="append"><block>product.info.addtocart</block></action>
        <action method="append"><block>product.info.addto</block></action>
    </block>

    ...

</reference>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.