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

Nits
2,5341 gold badge11 silver badges21 bronze badges
asked Jun 13, 2013 at 20:15
2
  • Which block references do you have for the cms_index_index page that are not available in default? Can you give an example? Commented Jun 14, 2013 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. Commented Oct 1, 2013 at 3:35

1 Answer 1

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

Rohan Hapani
17.6k9 gold badges57 silver badges99 bronze badges
answered Aug 31, 2013 at 18:58
4
  • 1
    I'd like to see this suggested in a custom template/theme for admin. Commented 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. Commented Aug 12, 2014 at 18:21
  • It's still bugged in 1.9.0.1 Why is contributing to the code so hard lol Commented 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. Commented May 9, 2016 at 16:14

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.