recently i had an opportunity to pimp some cms pages of a customer. While we were exchanging ideas, we cam up with something that as far as i know is not going to work out of the box.

The Goal is to create one static block that can receive up to 5 variables ( in this case product ids ). With those ids, the static block should render the products related to those and create html-snippets. It shall work like a static block, where you easily enter a couple of ids and the static block should show them in a proper way.

i thought of something like:

{{widget type="cms/widget_block" template="cms/widget/static_block/default.phtml" block_id="16" variables="3,5,28,29"}}

where 3,5,28,29 is a comma seperated List of ids which the block could render via php...

Is there any way to achieve this? It would help so much to combine and relate content pages with products.

I am helpful for any idea!

2 Answers 2


I'm not sure whether this works the easy way.

You can try in your template to call

$blockId = $this->getData('variables');

this should contain your comma separated values.

If this doesn't work, you have to extend Mage_Cms_Block_Widget_Block and check there, where your values are and how to get them.

If you can't find them in Mage_Cms_Block_Widget_Block either, they are not passed. I have no clue where the widgets are parsed, so find this and change it, so you get your variable.

But I cross my fingers, that the first thing works.

  • Thanks for your answer! Can you tell me also where to extend the Mage_Cms_Block_Widget_Block ? The variables are not passed out of the box and i am not sure, where exactly i extend the block. Thanks! Commented Feb 2, 2015 at 13:29

I found a solution with this:

In app/code/local/Mage/Cms/Block/Widget/Block.php I placed a copy of app/code/core/Mage/Cms/Block/Widget/Block.php and added some script:

$productIds = $this->getData('productIds');
$productIdsList = explode("," , $productIds);

with this $productIdsList I will now try to get HTML blocks rendered to add this to

$this->setText( $processor->filter($block->getContent()) . $relatedHTML );

{{widget type="cms/widget_block" template="cms/widget/static_block/default.phtml" block_id="16" productIds="2961,2945"}}

Do i run into serious problems with this?

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.