Search code examples
magentoblock

Insert new block to product.info doesn't work


I have created two new blocks, which should be output before and after this block:

<block type="catalog/product_view" name="product.info.addtocart" as="addtocart" template="catalog/product/view/addtocart.phtml"/>

To do this I've created a new module, which updates the layout. In the refered XML file stands this:

<catalog_product_view>
  <reference name="product.info">
    <block type="disablecartonlogout/output" name="disablecartonlogout.outputbefore" as="whatever" before="product.info.addtocart" template="disablecartonlogout/product-options-bottom-before.phtml" />
    <block type="disablecartonlogout/output" name="disablecartonlogout.outputafter" as="whatever" after="product.info.addtocart" template="disablecartonlogout/product-options-bottom-after.phtml" />
  </reference>
</catalog_product_view>

I get no output. If I change the reference to "content", the blocks will be outputted, but on the wrong position.

Can you tell me, what I am doing wrong?


Solution

  • You need to explicitly call your blocks in the product.info block template (that should be catalog/product/view.phtml), at the place you want.

    The method you want to use only works for some specific blocks (usually, core/text_list or core/template doing an empty getChildHtml() call, what's not the case of product.info)