I switch the display of Wishlist_Sidebar from right to left, using the following codes, but the sidebar remains in both right and left sidebar.
<reference name="right">
<action method="unsetChild"><name>wishlist_sidebar</name></action>
//.....
</reference>
<reference name="left">
<action method="insert"><blockName>wishlist_sidebar</blockName></action>
</reference>
How to fix this problem
I think the unsetChild function might operate using the alias (the as attribute rather than the name attribute. Try using...
<reference name="right">
<action method="unsetChild"><name>wishlist</name></action>
//.....
</reference>
Related
How would I go about adding a static block on my left column on the category pages?
I would like the static block to go underneath the main column so that it looks like this: http://imgur.com/iopEesf
Thank-you.
override catalog.xml layout file in your template.
in and
<catalog_category_layered>
<reference name="left">
<block type="cms/block" name="block-name">
<action method="setBlockId"><block_id>block_id</block_id></action>
</block>
</reference>
</catalog_category_layered>
<catalog_category_default>
<reference name="left">
<block type="cms/block" name="block-name">
<action method="setBlockId"><block_id>block_id</block_id></action>
</block>
</reference>
</catalog_category_default>
I am trying use the Custom Layout Update field of a category to add something to the left sidebar for just this category but can't quite get it to work. I had it working before so I know I can do it but then my client accidentally deleted the category.
This works, so I know I have the ability to add something - but I don't want a static block:
<reference name="left">
<block type="cms/block" name="Designer Sidebar" before="-">
<action method="setBlockId"><block_id>designer_sidebar</block_id></action>
</block>
</reference>
I want to include a phtml file from my theme folder and trying this, but can't get it to output anything:
<reference name="left">
<block type="cms/block" name="Designer Sidebar" before="-" template="catalog/category/view_sidebar.phtml" />
</reference>
<reference name="left">
<block type="core/template" name="Designer Sidebar" template="catalog/category/view_sidebar.phtml"/>
</reference>
I've got a custom category view.phtml for this category:
http://www.touchfix.nl/onderdelen
The sub-categories use their parent's XML-update, which is:
<reference name="catalog_category_default">
<reference name="content">
<remove name="category.products" />
<block type="catalog/category_view" name="alphabase.parts" template="catalog/category/view.parts.phtml">
<block type="catalog/product_list" name="product_list" template="catalog/product/list.parts.phtml"></block>
</block>
</reference>
</reference>
<reference name="right">
<remove name="cms_waaromkiezen" />
<block type="cms/block" name="block_speerpunten_onderdelen">
<action method="setBlockId"><block_id>block_speerpunten_onderdelen</block_id></action>
</block>
</reference>
<reference name="head">
<action method="addCss"><stylesheet>css/categoryblocks.css</stylesheet></action>
</reference>
I want to achieve that the changes to "right" are also applied to products in these categories.
But when I apply these changes to products too in category settings, the "content" reference screws up my page and it returns a blank page.
How can I reference the catalog_category view, so that the "content" update is only done when in category view and not in product view?
catalog_category_default isn't a reference, it's a handle
have you tried changing to:
<catalog_category_default>
I managed to do the trick with the following:
<reference name="content">
<reference name="category.products">
<action method="setTemplate"><template>catalog/category/view.repair.phtml</template></action>
<reference name="product_list">
<action method="setTemplate"><template>catalog/product/list.repair.phtml</template></action>
</reference>
</reference>
</reference>
<reference name="right">
<remove name="cms_waaromkiezen" />
<block type="cms/block" name="block_speerpunten_reparatie">
<action method="setBlockId"><block_id>block_speerpunten_reparatie</block_id></action>
</block>
</reference>
<reference name="head">
<action method="addCss"><stylesheet>css/categoryblocks.css</stylesheet></action>
</reference>
The difference was not to delete the blocks and add new ones with the correct template, but to change the template files of the corresponding items. I can now also refer to the product view block with <reference name="product.info">, which will be my next step.
I want to keep the currency selector in top. So i added this code in local.xml:
<default>
<reference name="header">
<block type="directory/currency" name="currency" before="catalog.leftnav" template="directory/currency.phtml"/>
</reference>
</default>
Now how can i remove currency selector from left, right position. I tried this:
<default>
<reference name="left">
<remove name="currency"/>
</reference>
</default>
It removes all currency selector!
You named your header block currency as well. I would try renaming that header block (try header.currency) and see if that does it for you.
To remove from search results left side bar I used this:
Commet this out from directory.xml
<catalogsearch_result_index>
<reference name="left">
<block type="directory/currency" name="currency" before="-" template="directory/currency.phtml"/>
</reference>
</catalogsearch_result_index>
<remove name="currency"/>
Removes curreny module.If you want to remove currency from left sidebar and use it somewhere,code must be
<default>
<reference name="left">
<action method="unsetChild"><name>currency</name></action>
</reference>
</default>
Is it possible to change the order of already existing blocks via the local.xml file?
I know you can change the order of a block with the after or before attribute, but how can one change those attributes of existing blocks.
For example, if I want to place the layered navigation block underneath the newsletter subscription block in the left column, how would I do that?
You need to perform a small trick, remove child block and add it in new position:
<reference name="parent.block.name">
<action method="unsetChild">
<alias>child_block_alias</alias>
</action>
<action method="insert">
<blockName>child.block.name</blockName>
<siblingName>name_of_block</siblingName>
<after>1</after>
<alias>child_block_alias</alias>
</action>
</reference>
This Layout XML instruction does what you want. Look at this short reference of parameters for insert method:
blockName is your block unique name across the layout, product.view for example
siblingName is an block unique name, that is already exists in insertion target block, used for positioning of your block. Leave empty to display it at the top or at the bottom.
after is a boolean identifier of block position. If equals to 1, then the block will be added after siblingName or in the bottom of the children list if siblingName is empty
alias is the alias of your block, if it is empty the name of block will be used.
Some Examples:
Move cart sidebar block after recently viewed products
<reference name="right">
<action method="unsetChild">
<alias>cart_sidebar</alias>
</action>
<action method="insert">
<blockName>cart_sidebar</blockName>
<siblingName>right.reports.product.viewed</siblingName>
<after>1</after>
</action>
</reference>
Move cart sidebar block before recently viewed products
<reference name="right">
<action method="unsetChild">
<alias>cart_sidebar</alias>
</action>
<action method="insert">
<blockName>cart_sidebar</blockName>
<siblingName>right.reports.product.viewed</siblingName>
<after>0</after>
</action>
</reference>
Move cart sidebar block at the end of the right block
<reference name="right">
<action method="unsetChild">
<alias>cart_sidebar</alias>
</action>
<action method="insert">
<blockName>cart_sidebar</blockName>
<siblingName></siblingName>
<after>1</after>
</action>
</reference>
Move cart sidebar block at the top of the left block
<reference name="right">
<action method="unsetChild">
<alias>cart_sidebar</alias>
</action>
</reference>
<reference name="left">
<action method="insert">
<blockName>cart_sidebar</blockName>
</action>
</reference>
Enjoy working with Magento!
You can remove previous layered navigation block and add a new layered navigation block after newsletter block.
<reference name="left">
<remove name="catalog.leftnav" />
<block type="catalog/layer_view" name="catalog.leftnavcustom" after="left.newsletter" template="catalog/layer/view.phtml"/>
</reference>
Note that I use a custom name for the new block.
The accepted answer didn't work for me (EE1.14) but something close to it, this:
<wishlist_index_index>
<reference name="customer.wishlist.items">
<action method="unsetChild">
<name>customer.wishlist.price</name>
</action>
<action method="insert">
<blockName>customer.wishlist.price</blockName>
<after>customer.wishlist.qty</after>
</action>
</reference>
</wishlist_index_index>