I use magento 1.7 and I wish to change the position of my "sort by" block and "compare" block to left. What should I do to accomplish that?
Layout moves involve unsetting from original parent & inserting in new parent.
local.xml in your custom theme's
layout folder (create if you don't have it), you should add the following:
<default> <!-- Move compare sidebar block from right to left --> <action method="unsetChild" block="right"><child>catalog.compare.sidebar</child></action> <action method="insert" block="left"><child>catalog.compare.sidebar</child></action> </default>
Regarding the "Sort By" block - that is a part of the so-called toolbar block which contains all of the other controls, and there are additional factors which make this kind of messy to move. The same pattern as above holds true - the block's name in layout is product_list_toolbar, the parent block is product_list, and you will need to execute these directives in the following handles:
Ideally this would involve an
update layout update directive, but it might not work in this context, as
update-based directives are processed before all other directives in the particular handle in which they've been included, meaning that you would be operating on blocks which haven't been created. You could reduce the number of times that you need to call your directives by using the customer_logged_out and customer_logged_in handles which tend to execute at the end of layout processing, but this feels like a bit of a kludge.
At least you have some options.
<reference name="left"> <block type="catalog/product_compare_sidebar" name="catalog.compare.sidebar" template="catalog/product/compare/sidebar.phtml"/> </reference>
write this code app\design\frontend\default\YOUR_THEME\layout\catalog.xml instead of
<reference name="right"> <block type="catalog/product_compare_sidebar" name="catalog.compare.sidebar" template="catalog/product/compare/sidebar.phtml"/> </reference>
Thanks All for yours ideas. I moved many block that i whish to display them in the left like product_list_related,product_list_related,product_viewed,cart_sidebar Thats help and it is the solution who i addopted :
I changed the template used in catalog.xml.
Before it is 2columns-right.phtml
and now 2columns-left.phtml
i change the position of product_compare_sidebar and product_list_related to left
I changed in reports.xml product_viewed from right to left
I changed in chekout.xml cart_sidebar from right to left