I want to create different product views based on the attribute to which the product belongs: does Magento do a way to do this?
- UPDATE -
Following the suggestion of dan.codes, I added
$update->addHandle('PRODUCT_ATTRIBUTE_SET_ID_'.$product->getAttributeSetId());
in Mage_Catalog_ProductController (I duplicated ProductController.php and put it in local / Mage / Catalog / controllers /).
Then I added this to catalog.xml
<PRODUCT_ATTRIBUTE_SET_ID_9> // PRODUCT ID of Book Attribute Set <label>Catalog Product View (Book)</label> <reference name="product.info"> <block type="catalog/product_view_type_book" name="product.info.book" as="product_type_data" template="catalog/product/view/attribute_set/book.phtml"> <block type="core/text_list" name="product.info.book.extra" as="product_type_data_extra"/> </block> </reference> </PRODUCT_ATTRIBUTE_SET_ID_9>
right after
<PRODUCT_TYPE_virtual translate="label" module="catalog"> <label>Catalog Product View (Virtual)</label> <reference name="product.info"> <block type="catalog/product_view_type_virtual" name="product.info.virtual" as="product_type_data" template="catalog/product/view/type/virtual.phtml"> <block type="core/text_list" name="product.info.virtual.extra" as="product_type_data_extra"/> </block> </reference> </PRODUCT_TYPE_virtual>
Then I created the directory / product / view / attribute _set / book.phtml, but it does not appear on my product view page.
- UPDATE MAGENTO 1.5 -
I noticed that the handler update has moved to the latest version of Magento.
$update->addHandle('PRODUCT_TYPE_'.$product->getTypeId()); $update->addHandle('PRODUCT_'.$product->getId());
located in Mage / Catalog / Helper / Product / View.php now.
I tested and it still works great!
source share