Magento - Clone the "product.info" block into the sidebar and include the conditional product type data

Magento - Clone the "product.info" block into the sidebar and include the conditional product type data

September 22, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Magento - Clone the "product.info" block into the sidebar and include the conditional product type data

Moving Magento Blocks: A Comprehensive Guide

As senior developers and technical bloggers at Laravel Company, we often encounter challenges like the one you’ve described regarding moving blocks in Magento. Let’s break down this complex issue step-by-step.

Understanding the Current Approach

You’re on the right track by trying to create a new layout XML file within your theme directory. You’ve attempted to use the default scope and reference the sidebar block with the desired actions. However, there are a few key areas we need to address.

Firstly, let’s clarify the structure of your current approach:

<reference name="right">
    <action method="unsetChildren"/>
    <!-- remove all blocks -->

    <block type="catalog/product_view" name="product.sidebar"
           template="catalog/product/view/sidebar.phtml">
        <!-- ... various blocks and actions with conditional tags -->
    </block>
</reference>

You’ve successfully unset the children of the right sidebar block, indicating a clean slate for reconfiguring it. The main block you’re adding is catalog/product_view, which corresponds to your sidebar.phtml file.

The Missing Piece: Product Type Blocks

The crux of the issue lies in the conditional product type blocks (simple, configurable, etc.). You’ve correctly included these within the <PRODUCT_TYPE> tags, but they aren’t being appended to your main “product.sidebar” block.

Let’s take a closer look at one of these conditional blocks:

<PRODUCT_TYPE_simple translate="label" module="catalog">
    <label>Catalog Product View (Simple)</label>
    <reference name="product.sidebar">
        <!-- ... the block with the correct type and template -->
    </reference>
</PRODUCT_TYPE_simple>

The issue here is that you’re referencing product.sidebar without actually appending these blocks to it using an <action method="append">. This means Magento doesn’t recognize these product types as part of your sidebar structure.

The Solution: Appending Product Type Blocks

To resolve this, we need to append the desired product type blocks to your main “product.sidebar” block. Here’s how you can do it:

<reference name="right">
    <action method="unsetChildren"/>
    <!-- remove all blocks -->

    <block type="catalog/product_view" name="product.sidebar"
           template="catalog/product/view/sidebar.phtml">
        <!-- ... various blocks and actions with conditional tags -->
    </block>

    <PRODUCT_TYPE_simple translate="label" module="catalog">
        <reference name="product.sidebar">
            <action method="append">
                <block type="catalog/product_view_type_simple"
                       name="product.info.simple"
                       as="product_type_data"
                       template="catalog/product/view/type/default.phtml">
                    <!-- ... the rest of your block with extra text list -->
                </block>
            </action>
        </reference>
    </PRODUCT_TYPE_simple>
</reference>

In this updated version, I’ve added an <action method="append"> directly within the conditional <PRODUCT_TYPE> tag. This ensures that when Magento processes the layout XML and encounters a product of type “simple”, it appends the product.info.simple block to your main sidebar block.

Updating Your PHTML File

Your current sidebar.phtml file is correctly structured, but we need to make one small change to ensure the product type blocks are properly included. Update this line:

<?php echo $this->getChildHtml('product_type_data') ?>

Replace it with:

<?php if ($this->hasBlock('product_type_data')): ?>
    <?php echo $this->getBlock('product_type_data')->setTemplate("catalog/product/view/type/default.phtml")->toHtml() ?>
<?php endif; ?>

This change ensures that the product_type_data block is rendered only when it exists, and the correct template is applied.

Conclusion

In conclusion, moving blocks in Magento requires a deep understanding of layout XML files and conditional processing. By appending your product type blocks to the main sidebar block within the appropriate <PRODUCT_TYPE> tag, you can ensure they are included in the rendered output.

Remember, when working with Magento layouts, it’s essential to:

  1. Understand the structure of your current layout.
  2. Identify which blocks need to be moved or modified.
  3. Use the correct reference names and action methods for moving blocks.
  4. Test your changes thoroughly across different scenarios.

If you’re looking for more in-depth guidance on Magento development, feel free to explore our resources at Laravel Company. We offer a wide range of tutorials and guides designed to help developers like yourself master the complexities of this powerful e-commerce platform.

Catalog Themes Configuration Errors

Our network