Are there any tools or techniques for identifying the overrides/merges/potential conflicts with layout XML in Magento?

I think what I'm looking for is something like n98-magerun's dev:module:rewrite:conflicts command.

I use Alan Storm's Layoutviewer module for ?showLayout=page to debug, but that only gives me the total merged layout. I also know that I can echo the filenames as they are loaded and merged in core, but I don't like to have to hook that up every time.

My question comes from the occasional frustration with tracking down which layout XML file from which package or theme is being loaded, as the handles aren't always logically placed.

UPDATE 2014-11-08: As an example (not a real situation), let's say I need to find where the block product.view.extra is configured in layout XML. It ends up being defined on the handle extra_product_stuff and called in via update node in the PRODUCT_TYPE_simple handle -- all this is contained in somemodulelayout.xml or other ambiguously named file.

Let's say that, to grind my gears even more, the file is duplicated but changed slightly in another design package and on a couple of themes in between.

I load up a product detail page, and see some "extra" content at the bottom of the page. Where did it come from? I turn on template hints, and find the block and template. There's a start. I use Alan Storm's layout viewer, and see the block name/alias. I start greping for that name on skin/frontend, and see several instances. I check the one I think is relevant to my current design config. Now I'm ready to modify it.

What I want to do is simplify the steps in the above to track this stuff down. So maybe I'd like to see, perhaps in the template hints feature, the layout XML file OUT OF WHICH this block was defined and generated.

And maybe that answers my own question: If there's not a tool for this, I either build it out myself or else keep truckin' with usual sleuthing techniques. I was just looking to hear about OTHER techniques in this arena.

Will close today for #MageStackDay if I don't get a reply :)

  • @ReidBlomquist Not quite - all the top answers are talking about dumping layout handles; Alan Storm's Layoutviewer module already does this for me. And I've also tried the Debug Toolbar extension -- not ideal for what I want. I've updated my question for clarification. Nov 8 '14 at 15:38

As described on page 55: http://theslidesareonline.de

You can comment the following to get more debug output.

# …/core/Mage/Core/Model/Layout.php:450
} elseif (isset($this->_blocks[$name]) && Mage::getIsDeveloperMode()) {
 //Mage::throwException(Mage::helper('core')->__('Block with name "%s" already exists', $name));
  • Also useful, but I guess I need to be more specific. I'm updating my question to clarify. Nov 8 '14 at 15:17

Deciding to answer my own question. It's broad and subjective, but I was hoping that there was some kind of silver bullet out there that everyone but me knew about.

So my answer is just to use common array of debugging techniques already established in the community for layout XML debugging, rather than seek a specific tool.

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