Skip to main content
added 34 characters in body
Source Link
Anil Suthar
  • 4.7k
  • 1
  • 15
  • 22

Create a custom module and override Mage_Catalog_Helper_Product_View Helper OR put it to local codepool at \app\code\local\Mage\Catalog\Helper\Product\View.php

Now Update initProductLayout method of View.php helper

public function initProductLayout($product, $controller)
{
    ...

    $update->addHandle('PRODUCT_TYPE_' . $product->getTypeId());
    $update->addHandle('PRODUCT_' . $product->getId());
    
    //adding handle for custom VIEW pages
    $update->addHandle('CUSTOMPRODUCTVIEW_' . $product->getAttributeSetId());
    //END adding handle for custom VIEW pages
    
    $controller->loadLayoutUpdates();
    
    ...
}

Now you can use/add handles like this (in local.xml)

...

<CUSTOMPRODUCTVIEW_21>
    <reference name="root">
      <action method="addBodyClass">
          <className>CLASS-FOR-21-attr</className>
      </action>
    </reference>
</CUSTOMPRODUCTVIEW_21>
<CUSTOMPRODUCTVIEW_23>
    <reference name="root">
      <action method="addBodyClass">
          <className>CLASS-FOR-23-attr</className>
      </action>
    </reference>
</CUSTOMPRODUCTVIEW_23>

...

Where 21 and 23 are IDs of your attribute sets, change them with your attribute set IDs

Create a custom module and override Mage_Catalog_Helper_Product_View Helper OR put it to local codepool at \app\code\local\Mage\Catalog\Helper\Product\View.php

Now Update initProductLayout method of View.php helper

public function initProductLayout($product, $controller)
{
    ...

    $update->addHandle('PRODUCT_TYPE_' . $product->getTypeId());
    $update->addHandle('PRODUCT_' . $product->getId());
    
    //adding handle for custom VIEW pages
    $update->addHandle('CUSTOMPRODUCTVIEW_' . $product->getAttributeSetId());
    //END adding handle for custom VIEW pages
    
    $controller->loadLayoutUpdates();
    
    ...
}

Now you can use/add handles like this (in local.xml)

...

<CUSTOMPRODUCTVIEW_21>
    <reference name="root">
      <action method="addBodyClass">
          <className>CLASS-FOR-21-attr</className>
      </action>
    </reference>
</CUSTOMPRODUCTVIEW_21>
<CUSTOMPRODUCTVIEW_23>
    <reference name="root">
      <action method="addBodyClass">
          <className>CLASS-FOR-23-attr</className>
      </action>
    </reference>
</CUSTOMPRODUCTVIEW_23>

...

Where 21 and 23 are IDs of your attribute sets

Create a custom module and override Mage_Catalog_Helper_Product_View Helper OR put it to local codepool at \app\code\local\Mage\Catalog\Helper\Product\View.php

Now Update initProductLayout method of View.php helper

public function initProductLayout($product, $controller)
{
    ...

    $update->addHandle('PRODUCT_TYPE_' . $product->getTypeId());
    $update->addHandle('PRODUCT_' . $product->getId());
    
    //adding handle for custom VIEW pages
    $update->addHandle('CUSTOMPRODUCTVIEW_' . $product->getAttributeSetId());
    //END adding handle for custom VIEW pages
    
    $controller->loadLayoutUpdates();
    
    ...
}

Now you can use/add handles like this (in local.xml)

...

<CUSTOMPRODUCTVIEW_21>
    <reference name="root">
      <action method="addBodyClass">
          <className>CLASS-FOR-21-attr</className>
      </action>
    </reference>
</CUSTOMPRODUCTVIEW_21>
<CUSTOMPRODUCTVIEW_23>
    <reference name="root">
      <action method="addBodyClass">
          <className>CLASS-FOR-23-attr</className>
      </action>
    </reference>
</CUSTOMPRODUCTVIEW_23>

...

Where 21 and 23 are IDs of attribute sets, change them with your attribute set IDs

Source Link
Anil Suthar
  • 4.7k
  • 1
  • 15
  • 22

Create a custom module and override Mage_Catalog_Helper_Product_View Helper OR put it to local codepool at \app\code\local\Mage\Catalog\Helper\Product\View.php

Now Update initProductLayout method of View.php helper

public function initProductLayout($product, $controller)
{
    ...

    $update->addHandle('PRODUCT_TYPE_' . $product->getTypeId());
    $update->addHandle('PRODUCT_' . $product->getId());
    
    //adding handle for custom VIEW pages
    $update->addHandle('CUSTOMPRODUCTVIEW_' . $product->getAttributeSetId());
    //END adding handle for custom VIEW pages
    
    $controller->loadLayoutUpdates();
    
    ...
}

Now you can use/add handles like this (in local.xml)

...

<CUSTOMPRODUCTVIEW_21>
    <reference name="root">
      <action method="addBodyClass">
          <className>CLASS-FOR-21-attr</className>
      </action>
    </reference>
</CUSTOMPRODUCTVIEW_21>
<CUSTOMPRODUCTVIEW_23>
    <reference name="root">
      <action method="addBodyClass">
          <className>CLASS-FOR-23-attr</className>
      </action>
    </reference>
</CUSTOMPRODUCTVIEW_23>

...

Where 21 and 23 are IDs of your attribute sets