Magento – Widget Instance Block Bug

blockslayoutmagento-1.9widgets

I've noticed that if you create a widget instance, then add a layout update, if you choose to add a widget instance to a single page, say cms_index_index, the next time you edit the widget instance, the block reference list only includes the blocks in default. If you wish to save a change you have to select a difference page, then change it back to re-populate the block drop down with the correct value for that page.

I've been routing around the blocks and templates for the last 20mins look for a solution. I seem to be getting some success by editing Mage_Widget_Block_Adminhtml_Widget_Instance_Edit_Tab_Main_Layout::getDisplayOnContainers and doing $container['pages'] = $this->getPageGroups() before returning the $container array. This seems to ensure that when getDisplayOnContainers is called in the template, the required handles are present on the page for the current instance. I've not had enough time to dive deep enough into this to see if there are any repercussions however.

Does anybody else have any experience with this issue?

P.s. Has anybody reviewed any of this functionality in Magento 2. I've not had enough free time to look, but I'm kind of hoping they'll go a step further and allow developers to add their own 'page types'.

Best Answer

This is a known bug.

In the file

/app/design/adminhtml/default/default/template/widget/instance/edit/layout.phtml

=> Replace around line 291

if (layoutHandleField = container.down('input.layout_handle_pattern')) {

With

if (layoutHandleField = $('layout_handle')) {

Related Topic