I want my product belonging to attribute sets X use a different template without setting the layout update in all product one by one.
I created this new handle in the layout file :
<product_view_bis>
<reference name="product.info">
<action method="setTemplate"><template>catalog/product/view7.phtml</template></action>
<block type="core/template" name="replacements" template="catalog/product/replacements.phtml">
<block type="replacements/replacement" name="replacement_options" template="catalog/product/replacement_options.phtml">
<action method="addOptionRenderer"><type>select</type><block>replacements/options</block><template>catalog/product/view/options/type/replacement.phtml</template></action>
</block>
</block>
</reference>
</product_view_bis>
Then I extend the Related Helper (Mage_Catalog_Helper_Product_View) to fit this with :
if ($product->getAttributeSetId()==X) $update->addHandle('product_view_bis');
This should replace the catalog/product/view.phtml with my own file which call some custom blocks
It doesn’t work at all. But If I put this :
<reference name="product.info">
<action method="setTemplate"><template>catalog/product/view7.phtml</template></action>
<block type="core/template" name="replacements" template="catalog/product/replacements.phtml">
<block type="replacements/replacement" name="replacement_options" template="catalog/product/replacement_options.phtml">
<action method="addOptionRenderer"><type>select</type><block>replacements/options</block><template>catalog/product/view/options/type/replacement.phtml</template></action>
</block>
</block>
</reference>
Into the product Custom Layout Update in the backend it works.
Can anyone help me ?
I managed to get it working through Observer
I set an event observer on controller_action_layout_generate_blocks_after