Reputation: 2927
Did Magento change something with how the layout updates are merged in 1.9? I recently started working with 1.9.1.0 and I noticed that one of the blocks on the right side bar was duplicated. This block is added by a 3rd party module that stores its theme files in default/default. I had added code in my local.xml to unset the child and then re-add it so it appears at the bottom of the column. This used to work in 1.5.0.1 but does not work in 1.9.1.0. Instead, I was forced to remove the block completely using <remove name=...>
and then add it back in using a different name. It's a work-around I'm ok with, but is this supposed to be happening?
<default>
<reference name="right">
<block type="adjreminder/review" name="right.adjreminder" after="cart_sidebar" template="adjreminder/review.phtml" />
</reference>
</default>
<default>
<reference name="right">
<action method="unsetChild">
<name>right.adjreminder</name>
</action>
...
<block type="adjreminder/review" name="right.adjreminder" after="cart_sidebar" template="adjreminder/review.phtml" />
</reference>
</default>
This did not move the block but instead created a second copy. The unsetChild
wasn't doing anything. The only way to fix it was for me to put this in my local.xml:
<default>
<remove name="right.adjreminder" />
<reference name="right">
<block type="adjreminder/review" name="right.adjreminder" after="cart_sidebar" template="adjreminder/review.phtml" />
</reference>
</default>
Upvotes: 0
Views: 1727
Reputation: 157
The <remove>
directive does not remove blocks, but instead sets a flag to ignore block rendering of itself and all of it's children. If you wish to relocate a block, you need to use the <action>
directive with the method of insert
or append
.
<reference name="right">
<action method="unsetChild">
<name>right.adjreminder</name>
</action>
<action method="insert">
<name>right.adjreminder</name>
</action>
</reference>
These action methods will use the current block instance instead of creating a new block instance. The action method insert
will place it at the top of the list of children, while append
will place it at the bottom.
Upvotes: 1