Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Move “My Cart” to the top of the sidebar
 
alertmybanjos
Jr. Member
 
Total Posts:  3
Joined:  2008-08-11
 

I’m working on a theme that’s derived from Magento’s “Modern” theme.  On the catalog pages—particularly the product view page—I’d like the “My Cart” box to appear first in the sidebar.  The default order seems to be:

* Related Products
* My Cart
* Compare Products
* Popular Tags

I need to move “My Cart” above “Related Products”.  I’ve searched and searched, and can’t seem to figure this out.  Can anyone summarize how the sidebar blocks are ordered, or direct me to a resource that would give me the needed info?

 
Magento Community Magento Community
Magento Community
Magento Community
 
lotusseedsD
Mentor
 
Avatar
Total Posts:  1144
Joined:  2007-08-31
 

I have never really work on Modern theme, but I believe this should fix it.

In the layout > catalog.xml, look for

<!--
Product view
-->

then look for

<block type="catalog/product_list_related" name="catalog.product.related" [b]before="-" [/b]template="catalog/product/list/related.phtml"/>
]

Notice the ’before="-” ‘ in the code? This tells the product view page to place the Related Product block on the top of the sidebar.

You can change it to ‘after="cart.sidebar" ‘

This should do the trick.

Another way is changing the ‘cart_sidebar’ placement in ‘checkout.xml’.

Look for

<!--
Default 
layoutloads most of the pages
-->
then place ’before="-” ‘ in

<block type="checkout/cart_sidebar" name="cart_sidebar" template="checkout/cart/sidebar.phtml"[b] before="-"[/b]>
 
Magento Community Magento Community
Magento Community
Magento Community
 
nikefido
Guru
 
Avatar
Total Posts:  481
Joined:  2008-07-11
New Haven, CT
 

just don’t use the [ b ] tags you see in there rasberry

 
Magento Community Magento Community
Magento Community
Magento Community
 
alertmybanjos
Jr. Member
 
Total Posts:  3
Joined:  2008-08-11
 

Changing before="-” to after="cart.sidebar” worked perfectly.  Thank you chinesedream!

I have two follow-up questions that might help myself and others when dealing with similar issues in the future:

Question 1:
What is the rule for the syntax of the before/after value?  In identifying the cart sidebar, you use a “.” separator (i.e. cart.sidebar), but in the checkout.xml layout file, the naming syntax is different…

<block type="checkout/cart_sidebar" name="cart_sidebar" template="checkout/cart/sidebar.phtml" before="-">

Question 2:
What happens if two sidebar blocks have the same before/after attribute—i.e. if both blocks are set to before="-”, then what other factors determine their order in the sidebar?

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top