Live Demo: https://www.tugasunwear.com/sc-tuga-test#horizontalTab4

Goal: Use existing magento short code (like below) to display a .phtml page in the app/design folder

Code in product attribute textarea:

{{block type="core/template" name="description" template="custom/fabric_care/01.phtml"}}

Code in .phtml file to be rendered:

Imported<br /><br />
<strong>Fabric</strong>:<br />80% Nylon&nbsp;/&nbsp;20% Spandex<br /><br />
<strong>Care</strong>:<br />Rinse, hand wash, drip dry, do not tumble dry/dry clean/iron, do not dry rolled up

Problem: Magento Short Code is being displayed instead of rendering the code in the .phtml page it is linking to.

Other Info: This attribute is a custom addition into the "Neighborhood" theme by Peerforest - who no longer provides support through themeforest on this theme. I wanted change it to a dropdown from a textarea, but that does not work properly.

This is the code rendering this custom attribute:

<?php $_product = $this->getProduct(); ?>
<?php if($_product->getCustomtext()): ?>
       <?php echo $_product->getCustomtext() ?>
<?php endif; ?>

This is the layout.xml rendering the custom attribute:

<action method="addTab" translate="title" module="catalog">
            <title>Fabric &amp; Care</title>

I also added this code change to the output.php file copied to my local code folder (as suggested by this post):

if ($attribute->getFrontendInput() != 'price') {
                  if($attributeName != 'customtext') {
                    $attributeHtml = $this->escapeHtml($attributeHtml);

Attribute Properties: enter image description here

Frontend Properties: enter image description here

If there is more info needed, please let me know. Hopefully this isn't an impossible task.


2 Answers 2


The content of .phtml file is simply echoing out attribute value as it's saved.

For it to render the Magento block codes, you need to use the CMS page template processor on the content which will effectively render any block codes or variables saved on your attribute.

To do this, you can use the following code:

$cmsHelper = Mage::helper('cms');
$processor = $cmsHelper->getPageTemplateProcessor();
echo $processor->filter($yourContentVariable);  //replace $yourContentVariable with the content that contains the block codes.

For your specific example, the code would look like this:

<?php $_product = $this->getProduct(); ?>
<?php if($_product->getCustomtext()): ?>
 $cmsHelper = Mage::helper('cms');
 $processor = $cmsHelper->getPageTemplateProcessor();
 echo $processor->filter($_product->getCustomtext());
<?php endif; ?>

Magento added a security feature where you have to explicitly set what blocks are allowed to render in WYSIWYG areas.

To use your block in WYSIWYG areas, you need to add it to the Magento permissions.

  1. Go to System > Permissions > Blocks
  2. Click Add New Block
  3. Set Block Name = core/template and Is Allowed = Yes and click save.
  4. Clear & flush all Magento caches under System > Cache Management

Your block should now be able to render on the frontend.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.