How to add product attribute on product page via cms block magento

How to add product attribute on product page via cms block magento

August 31, 2026 · Illustrated author avatarBy Stefan Bogdanescu
How to add product attribute on product page via cms block magento

Adding Product Attributes via CMS Block in Magento

As a senior developer specializing in e-commerce platforms like Magento, I understand your desire to keep your template upgrade-safe while adding custom content to product pages. In this post, we’ll walk through the process of displaying an additional product attribute (in your case, the SKU) on the product page using a CMS block.

Understanding Your Current Setup

You’ve already created a CMS page and linked its content to the product page by calling a CMS block in your template’s PHTML file. This allows you to maintain a consistent look and feel while keeping your upgrade safe. However, you want to display the SKU number near the pricing section without modifying the core template files.

The Challenge: Incorporating a PHTML File in a CMS Block

You’ve attempted to create a new PHTML file (app/design/frontend/default/mytheme/template/page/getSku.phtml) and placed it inside a CMS block. However, this approach is causing your page not to render completely, indicating an issue with the way Magento processes the CMS content.

The Solution: A Cleaner Approach Using Magento’s Block System

Instead of attempting to embed PHTML files within CMS blocks, let’s use Magento’s built-in block system to display the SKU attribute. This approach ensures that your template remains upgrade-safe and doesn’t interfere with the page rendering process.

Step 1: Create a New PHTML File for the SKU Block

Create a new file under app/design/frontend/default/mytheme/template/catalog/product/view/additional.phtml.

<header class="page-header">
    <h1 class="page-title"><?php echo $this->getProduct()->getName() ?></h1>
</header>

<div class="product-collateral">

    <div class="additional-attributes">
        <?php if ($_additional = $this->getAdditionalData()) : ?>
            <dl>
                <?php foreach ($_additional as $_data) : ?>
                    <dt><?php echo $this->escapeHtml($_data['label']) ?></dt>
                    <dd><?php echo $this->escapeHtml($_data['value']) ?></dd>
                <?php endforeach; ?>
            </dl>
        <?php endif; ?>

        <!-- Add the SKU block here -->
        <?php if ($sku = $this->getProduct()->getSku()) : ?>
            <div class="product-sku">
                <strong>SKU: </strong><?php echo $this->escapeHtml($sku) ?></span>
            </div>
        <?php endif; ?>

    </div>

</div>

Step 2: Add the SKU Attribute to the Additional Data

In your app/design/frontend/default/mytheme/template/catalog/product/view/additional.phtml file, you’ll notice that we’re using $this->getAdditionalData() to fetch any additional attributes. However, this function doesn’t include the SKU attribute by default.

To add the SKU attribute, open your template’s catalog_product_view.xml layout update XML file and add the following code:

<reference name="content">
    <action method="setAdditionalData" translate="label">
        <label>SKU</label>
        <value><![CDATA[getSku()]]></value>
    </action>
</reference>

This tells Magento to set the SKU attribute as additional data, which will be displayed in our new PHTML file.

Step 3: Reference the New PHTML File in Your Template

Finally, you need to ensure that your template’s main product view page (usually located at app/design/frontend/default/mytheme/template/catalog/product/view.phtml) includes a reference to the new SKU block. Add the following code just above the closing </div> tag for the .product-collateral div:

<div class="additional-attributes">
    <?php if ($_additional = $this->getAdditionalData()) : ?>
        <!-- Existing additional data content -->
    <?php endif; ?>

    <!-- Include the SKU block -->
    <div class="product-sku">
        <strong>SKU: </strong><?php echo $this->escapeHtml($this->getProduct()->getSku()) ?></span>
    </div>

</div>

Conclusion

By following this approach, you can display an additional product attribute (such as the SKU) on your Magento product page without modifying the core template files. This ensures that your customization remains upgrade-safe and doesn’t interfere with the page rendering process.

Remember to clear your cache after making these changes for them to take effect. You can learn more about managing caches in our guide on Magento Cache Management.

Happy coding, and feel free to reach out if you have any further questions!

Catalog Themes Deployment Pricing

Our network