Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9210221
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T01:01:14+00:00 2026-06-18T01:01:14+00:00

I want my product belonging to attribute sets X use a different template without

  • 0

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 ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T01:01:15+00:00Added an answer on June 18, 2026 at 1:01 am

    I managed to get it working through Observer

    I set an event observer on controller_action_layout_generate_blocks_after

    public function generateBlocksAfter($event)
    {                      
        $controller   = $event->getAction();
    //limit to the product view page 
    if($controller->getFullActionName() != 'catalog_product_view')
    {
        return;
    }
    $layout       = $controller->getLayout();
    $root = $layout->getBlock('root');
    $product_info = $layout->getBlock('product.info');
    if(!$product_info)
    {
        Mage::log('Could not find product.info block');
        return;
    }
    $id = Mage::registry('current_product')->getId();
    $prod = Mage::getModel('catalog/product')->load($id);
    if ($prod->getAttributeSetId()==X) {
    $product_info->setTemplate('catalog/product/view7.phtml');
    $root->setTemplate('page/view7.phtml');
    $replacement =   $layout->createBlock('core/template')->setBlockAlias('replacements')->setTemplate('catalog/product/replacements.phtml')->setLayout($layout)->setNameInLayout('replacements');
    
    $options =     $layout->createBlock('replacements/replacement')->setBlockAlias('replacement_options')->setTemplate('catalog/product/replacement_options.phtml')->setLayout($layout)->setNameInLayout('replacement_options');
    $options->addOptionRenderer('select','replacements/options','catalog/product/view/options/type/replacement.phtml');
    $product_info->setChild('replacements',$replacement);
    $replacement->setChild('replacement_options',$options);
    }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've created simple ROR app on Heroku's server and I want to add product
Rails beginner here. I want to display a list of all products belonging to
When the value of the 'product-input' changes, I want the 'product-total' to update. I
We want to store product prices and weight (kg/pound) in MySQL. Can somebody tell
I want to demonstrate a product to a potential new customer. The best source
I want develop some web product with using javascript 3d library like three.js But
I want to create an observer for Product deletion. Means when admin deletes a
I want to show the closest related item for a product. So say I
I have a product listing page and want to load up a detail view
I have an SQL table like this : sales(product,timestamp) I want to display a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.