Skip to main content
added 2 characters in body
Source Link
shemaya
  • 115
  • 8

I can't find a way to directly inject a variable to the CMS, but you could for instance insert a custom variable to the block like {{product_name}} , then get the block in product page:

$html = Mage::app()->getLayout()->createBlock('cms/block')->setBlockId('block_id')->toHtml();

and then inject your product name:

echo str_replace("{{product_idproduct_name}}",$product->getId>getName(),$html);

I can't find a way to directly inject a variable to the CMS, but you could for instance insert a custom variable to the block like {{product_name}} , then get the block in product page:

$html = Mage::app()->getLayout()->createBlock('cms/block')->setBlockId('block_id')->toHtml();

and then inject your product name:

echo str_replace("{{product_id}}",$product->getId(),$html);

I can't find a way to directly inject a variable to the CMS, but you could for instance insert a custom variable to the block like {{product_name}} , then get the block in product page:

$html = Mage::app()->getLayout()->createBlock('cms/block')->setBlockId('block_id')->toHtml();

and then inject your product name:

echo str_replace("{{product_name}}",$product->getName(),$html);
Source Link
shemaya
  • 115
  • 8

I can't find a way to directly inject a variable to the CMS, but you could for instance insert a custom variable to the block like {{product_name}} , then get the block in product page:

$html = Mage::app()->getLayout()->createBlock('cms/block')->setBlockId('block_id')->toHtml();

and then inject your product name:

echo str_replace("{{product_id}}",$product->getId(),$html);