I'm trying to add a block to an existing tab on the product view page in Magento, programmatically.
The tab is the pre-existing description tab, around line 185 of the catalog xml file at app/design/frontend/base/default/layout/catalog.xml
<block type="catalog/product_view_description" name="product.description" as="description" template="catalog/product/view/description.phtml">
<action method="addToParentGroup"><group>detailed_info</group></action>
<action method="setTitle" translate="value"><value>Description</value></action>
</block>
I'm using a custom module and trying to inject my block after the description content, in the same tab. Here's the code:
class My_Details_Block_Product extends Mage_Core_Block_Template
{
protected $_template = 'details/product_details.phtml';
protected function _prepareLayout() {
if ($addToTabBlock = $this->getLayout()->getBlock('product.description')) {
$addToTabBlock->insert($this, '', false, 'details');
}
return $this;
}
}
There are no errors available in any of the logs, but the block simply doesn't appear. I've also tried to use the append method:
$addToTabBlock->append($this, 'other');
But get the same (blank) result.
How can I insert a block to the existing tab? Thanks.
die();
inside yourpreapareLayout()
and give me the resultdie();
produces a blank page. Also,var_dump('anything');
inside theif(..)
loop spits out on the page. Thx.