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'.
1 Answer 1
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')) {
-
1I'd like to see this suggested in a custom template/theme for admin.benmarks– benmarks2013年10月01日 03:34:30 +00:00Commented Oct 1, 2013 at 3:34
-
Was this ever fixed in 1.9.x/1.14.x? I'm still seeing this behavior out of box, unfortunately.CVEEP– CVEEP2014年08月12日 18:21:23 +00:00Commented Aug 12, 2014 at 18:21
-
It's still bugged in 1.9.0.1 Why is contributing to the code so hard lolErfan– Erfan2014年10月07日 04:21:02 +00:00Commented Oct 7, 2014 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– Yumecosmos2016年05月09日 16:14:09 +00:00Commented May 9, 2016 at 16:14
cms_index_indexpage that are not available indefault? Can you give an example?<label>in your layout update handle in a declared layout file and ensure that handle is applied on your page.