6

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'.

  • Which block references do you have for the cms_index_index page that are not available in default? Can you give an example? – Vinai Jun 14 '13 at 16:44
  • 1
    You can add custom page types. Just put a <label> in your layout update handle in a declared layout file and ensure that handle is applied on your page. – benmarks Oct 1 '13 at 3:35
5

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')) {

  • 1
    I'd like to see this suggested in a custom template/theme for admin. – benmarks Oct 1 '13 at 3:34
  • Was this ever fixed in 1.9.x/1.14.x? I'm still seeing this behavior out of box, unfortunately. – wlvrn Aug 12 '14 at 18:21
  • It's still bugged in 1.9.0.1 Why is contributing to the code so hard lol – Erfan Oct 7 '14 at 4:21
  • Been using @Paul Hachmang 's solution and it works great, but! I've found that with this change the block references for product pages no longer load. To fix I added an additional check afterward to see if layoutHandle is still blank, if so then try container.down('input.layout_handle_pattern') after all. – Yumecosmos May 9 '16 at 16:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.