Process product attribute HTML values in Magento using template processor

Magento Logo

In case you are wondering how to parse HTML content of product attributes here is how:

// load product model resource
$productResource = Mage::getSingleton('catalog/product')->getResource();
  
// load HTML product attribute content and process using CMS template processor
$helper = Mage::helper('cms');
$processor = $helper->getPageTemplateProcessor();
$attributeContent = $processor->filter(Mage::registry('current_product')->getSomeAttributeByCode());

Using this approach you can of course process CMS block template placeholders too.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.