I\u2019ve been asked to customize the front page of a magento store. The client wanted the ability to specify a set of variables that can be used in CMS static blocks so static blocks can be a little more dynamic.<\/p>\n\n\n\n
By default, the standard magento CMS static blocks don\u2019t provide access to the custom variables. so I thought I was going to have to build an extension to pass the variables in. However after a little bit of finding, I found that this functionality is available as standard in Magento, you just need to do it properly.<\/p>\n\n\n\n\n\n\n\n
The way to do this is as follows. Within you template file add in the following code:<\/p>\n\n\n\n
\n$quote = $this->getData(<\/code>'quote');\n$identifier = Mage::getStoreConfig('qquoteadv\/patches\/quote_success_msg<\/code>');\n\n$filter = Mage::getModel('core\/email_template_filter');\n$filter->setVariables(array('quote_number' => $quote-<\/code>>increment_id));\n$block = $this->getLayout()->createBlock(<\/code>'cms\/block')->setBlockId($identifier);\n\n$html = $filter->filter($block->toHtml());<\/code><\/pre>\n\n\n\nThis will then display the static block with your variables expanded to values you\u2019ve set.<\/p>\n\n\n\n
then you can use this variable in cms block {{var quote_number}}<\/p>\n","protected":false},"excerpt":{"rendered":"
I\u2019ve been asked to customize the front page of a magento store. The client wanted the ability to specify a set of variables that can be used in CMS static blocks so static blocks can be a little more dynamic. By default, the standard magento CMS static blocks don\u2019t provide access to the custom variables….<\/p>\n