Fri. Apr 25th, 2025

10. Magento. How to change blocks order

1 min read

Sidebar blocks can be rearranged in one of the template files. Use either FTP or hosting cPanel to reach it. Open the following file on server /app/design/frontend/tm_themes/themeXXX/layout/local.xml. Use any HTML editor to check its content, locate the following piece of code:

1
2
3
4
5
6
7
8
9
10
<reference name=”left”>
        <block type=”checkout/cart_sidebar” name=”cart_sidebar” template=”checkout/cart/sidebar.phtml” after=”catalog.leftnav”>
            <action method=”addItemRender”><type>simple</type><block>checkout/cart_item_renderer</block><template>checkout/cart/sidebar/default.phtml</template></action>
            <action method=”addItemRender”><type>grouped</type><block>checkout/cart_item_renderer_grouped</block><template>checkout/cart/sidebar/default.phtml</template></action>
            <action method=”addItemRender”><type>configurable</type><block>checkout/cart_item_renderer_configurable</block><template>checkout/cart/sidebar/default.phtml</template></action>
            <block type=”core/text_list” name=”cart_sidebar.extra_actions” as=”extra_actions” translate=”label” module=”checkout”>
                <label>Shopping Cart Sidebar Extra Actions</label>
            </block>
        </block>
    </reference>

Update the reference name to be <reference name=”left_first”>:

Magento_How_to_change_blocks_order_1

This allows using before=”-“ and after=”-“ tools to reorder the sidebar blocks. Insert the actual block name instead of hyphen.

Let’s reorder ‘Shop By’ and ‘My Cart’ blocks as an example:

  1. Locate the following line in the local.xml file: <block type=”checkout/cart_sidebar” name=”cart_sidebar” template=”checkout/cart/sidebar.phtml” before=”-“>
    1
    <block type=”checkout/cart_sidebar” name=”cart_sidebar” template=”checkout/cart/sidebar.phtml” before=”-“>

    before=”-“is the value to update.

  2. Specify if you want to have cart before or after the Shop By filter. Let’s put it after Shop By filter. Code should be eventually updated as follows:
    1
    <block type=”checkout/cart_sidebar” name=”cart_sidebar” template=”checkout/cart/sidebar.phtml” after=”catalog.leftnav”>

    Magento_How_to_change_blocks_order_2

The same values can be changed for other sidebar blocks. Update the file once all modifications are applied.

Note: you might need to rebuild the index and clear cache to apply the changes.

Get back to the category page and refresh it. Sidebar blocks have been successfully reordered.

April 2025
M T W T F S S
« Jun    
 123456
78910111213
14151617181920
21222324252627
282930