I created a custom module where i want to show some information about an product. In config.xml i added
<blocks>
<mymodule>
<class>Namespace_MyModule_Block</class>
</mymodule>
</blocks>
The block class extends Mage_Catalog_Block_Product_View. But i can't call
$this->getProduct()
in the *.phtml file according to the module (mymodule.phtml). The xmls are configured well, so i can call the .phtml with
<?php echo $this->getChildHtml('mymodule'); ?>
but $product is always null. According to the configuration in modules config.xml $this->getProduct() should access Mynamespace_MyModule_Block_View and call the function. I tried with a dummy function which simply returns a string value, but this doesn't work either.
I hope someone can give me a hint weather there is some missing or wrong configuration.
EDIT 1: Content of layout.xml
<?xml version="1.0"?>
<layout>
<catalog_product_view>
<reference name="product.info">
<block type="core/template" name="product_available_price" as="product_available_price"
template="productavailable/price.phtml"/>
<block type="core/template" name="product_available_info" as="product_available_info"
template="productavailable/info.phtml"/>
<block type="core/template" name="product_available_button" as="product_available_button"
template="productavailable/button.phtml"/>
</reference>
</catalog_product_view>
</layout>
In button.phtml i call $this->getProduct() and the method is in Mynamespace_MyModule_Block_Button