2

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?

  • Can you please be more specific on what you mean by 'sort by' block? is that in the list view? – Sander Mangel Sep 3 '13 at 8:31
3

Layout moves involve unsetting from original parent & inserting in new parent.

In 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:

  • catalog_category_default
  • catalog_category_layered
  • catalogsearch_result_index
  • catalogsearch_advanced_result

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.

| improve this answer | |
  • I am using magento 1.7 and is not using theme’s local.xml. I should add my local.xml in 'app/design/frontend/default/default/layout/' ? – Amirov Sep 4 '13 at 16:14
  • 1
    yes you can add local.xml in your theme layout – Keyur Shah Sep 5 '13 at 10:08
  • To be clear, yes, local.xml should go into your "highest priority" theme. – benmarks Sep 5 '13 at 11:47
  • Thanks. I used the catalog.xml of my template and it's work. – Amirov Sep 5 '13 at 11:55
  • Just be aware that you will need to merge changes from the new catalog.xml into the custom one when you upgrade (within the 1.x branch - so you should be safe, as it is terminating after 1.8) – benmarks Sep 5 '13 at 11:59
0
<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>
| improve this answer | |
  • 2
    Better to use local.xml – benmarks Sep 3 '13 at 12:33
  • ya thats right ...you can also use local.xml – Keyur Shah Sep 3 '13 at 12:36
  • When i edit the name in catalog.xml my block is disappeared – Amirov Sep 5 '13 at 9:46
  • your layout is 3 columns or 2-columns-right? – Keyur Shah Sep 5 '13 at 10:12
-1

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

page/2columns-right.phtml

and now 2columns-left.phtml

page/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

Thanks :)

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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