Try the Demo

Magento Forum

   
XML/Block Configuration
 
NickL
Sr. Member
 
Avatar
Total Posts:  188
Joined:  2007-08-31
 

Has anyone been successful in moving around blocks in the Layout XML’s?

I’ve managed to understand how to move them from column to column, via specifying “left” or “right” in the reference tag.  But I can’t understand how to change the ORDER in which they appear.  I noticed that the “before="-" tag has something to do it with, but whats the proper syntax for that?

For example:

<block type="catalog/layer_view" name="catalog.rightnav" before="-">

But what does before="-" mean?  And how do you set the order in which the blocks appear?

Anyone tackled this yet?  Magento Team?

 Signature 

nickL ~ i build stuff
Twitter me: twitter.com/ibuildstuff
My Blog: ibuildstuff.wordpress.com

 
Magento Community Magento Community
Magento Community
Magento Community
 
NickL
Sr. Member
 
Avatar
Total Posts:  188
Joined:  2007-08-31
 

Update… (Someone tell me if this is wrong or not though) :

What I wanted was to have the blocks in the left column show in this order “CART” / “COMPARE” / “LAYERED NAV”

Default, the Cart block is in a separate XML file, so I moved it into the InitLayout.xml file for Categories.  The file now reads as follows:

InitLayout.xml

<reference name="right">
        <
block type="catalog/product_compare_sidebar" name="catalog.compare.sidebar">
            <
action method="setTemplate"><template>catalog/product/compare/sidebar.phtml</template></action>
        </
block>
        
         <
block type="checkout/cart_sidebar" name="cart_sidebar" before="-">
            <
action method="setTemplate"><template>checkout/cart/sidebar.phtml</template></action>
        </
block>
    </
reference>

This solved the problem.. but I’m not quite sure its how it was supposed to be done. And I’m still not sure what before="-" means.  Can anyone elaborate?

 Signature 

nickL ~ i build stuff
Twitter me: twitter.com/ibuildstuff
My Blog: ibuildstuff.wordpress.com

 
Magento Community Magento Community
Magento Community
Magento Community
 
NickL
Sr. Member
 
Avatar
Total Posts:  188
Joined:  2007-08-31
 

I Retract my statement… The above isn’t correct.  I received :

exception ‘Exception’ with message ‘Can not retrieve current category object’

After my edits. I’m assuming that since I moved blocks between XML files it’s throwing a error trying to access them?

Don’t know tho. Someone explain on this if you can.

 Signature 

nickL ~ i build stuff
Twitter me: twitter.com/ibuildstuff
My Blog: ibuildstuff.wordpress.com

 
Magento Community Magento Community
Magento Community
Magento Community
 
Scott
Guru
 
Avatar
Total Posts:  333
Joined:  2007-08-31
Northwest Ohio
 

before="-" means before any of the previously mentioned modules in the xml file. So that means it will be first, unless a module after it is said to be before the module that is before="-"

Make any sense?

 Signature 

Need a Magento designer? I specialize in helping developers and shop owners create Magento themes designed with aesthetic bliss, crisp refreshing style, and usability-focused design. Check out Tealo, the first public Magento theme!

Your Magento Partner for Stunning Creative Work!

 
Magento Community Magento Community
Magento Community
Magento Community
 
NickL
Sr. Member
 
Avatar
Total Posts:  188
Joined:  2007-08-31
 

Yeah it does make sense… I managed to get it working by setting the module I wanted first (cart) as “before="-", like you mentioned.  The others I specified their order by how they display in the XML file.  Seems to be ok now.  This is actually… fun. -=)

 Signature 

nickL ~ i build stuff
Twitter me: twitter.com/ibuildstuff
My Blog: ibuildstuff.wordpress.com

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