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

To manage the order of the side blocks
 
Black Cat
Mentor
 
Avatar
Total Posts:  3481
Joined:  2008-02-14
Assemini / Cagliari (Italy)
 

I was looking through some with a magento when I have had the necessity to bring a block before another. The problem is that in the xml I have not found anything that was useful, as in the template.
Besides as the order of the blocks it can be managed when magento have a “standard” block and personalized blocks?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Black Cat
Mentor
 
Avatar
Total Posts:  3481
Joined:  2008-02-14
Assemini / Cagliari (Italy)
 

thanks!!!

PS: the icon http://www.magentocommerce.com/img/Guru_img.gif for the my rank (this forum) do not exist!!

 
Magento Community Magento Community
Magento Community
Magento Community
 
beau
Member
 
Avatar
Total Posts:  50
Joined:  2008-02-03
 
ohminu - 26 April 2008 05:54 PM

Black Cat-

You can use the ‘before’ and ‘after’ attribute in the block tag to position the blocks.
1. before="-" positions the block before all other blocks
2. after="-" positions the block after all other block
3. before="some_block" positions this block before another block with name="some_block"
4. after="some_block" position this block after another block with name="some_block"

For example <block name="this_block" before="that_block"/>

Where is the list of blocks? I want to put newsletter after callouts, but “callout” doesn’t work.

 
Magento Community Magento Community
Magento Community
Magento Community
 
lemax
Guru
 
Total Posts:  318
Joined:  2008-04-03
Nantes, France
 

Did you find the list of block names ?
Thanks
Max

 
Magento Community Magento Community
Magento Community
Magento Community
 
bradsugar
Jr. Member
 
Total Posts:  28
Joined:  2008-08-16
 

Yeah, I am looking for the list of blocks too…

 
Magento Community Magento Community
Magento Community
Magento Community
 
DevCore
Jr. Member
 
Total Posts:  4
Joined:  2008-07-28
 

CMS > Manage Pages > Home Page > Custom Design

 
Magento Community Magento Community
Magento Community
Magento Community
 
zuno
Jr. Member
 
Avatar
Total Posts:  30
Joined:  2008-10-08
Redondo Beach, CA
 

What if I want to arrange something like the product product.info.simple block?

I wan to add it above the product description. The thing is that is this block is dependent upon product type so it’s called a bit differently in the XML layout file. I tried the before and after attributes and it didn’t seem to work.

Thanks!

 
Magento Community Magento Community
Magento Community
Magento Community
 
zuno
Jr. Member
 
Avatar
Total Posts:  30
Joined:  2008-10-08
Redondo Beach, CA
 

I answered my own question.

This block is controlled in the template file. For anyone interested it’s “$this->getChildHtml(’product_type_data’)”

 
Magento Community Magento Community
Magento Community
Magento Community
 
GlobalAMP
Jr. Member
 
Total Posts:  7
Joined:  2009-09-24
 
ohminu - 26 April 2008 05:54 PM

Black Cat-

You can use the ‘before’ and ‘after’ attribute in the block tag to position the blocks.
1. before="-" positions the block before all other blocks
2. after="-" positions the block after all other block
3. before="some_block" positions this block before another block with name="some_block"
4. after="some_block" position this block after another block with name="some_block"

For example <block name="this_block" before="that_block"/>

any reason “1. before="-" positions the block before all other blocks” wouldn’t work?  i can’t seem to get VerNav above the layered nav. :(

 
Magento Community Magento Community
Magento Community
Magento Community
 
tastymouse
Member
 
Total Posts:  43
Joined:  2010-04-28
Amsterdam, The Netherlands
 
GlobalAMP - 08 October 2009 09:37 AM

ohminu - 26 April 2008 05:54 PM
Black Cat-

You can use the ‘before’ and ‘after’ attribute in the block tag to position the blocks.
1. before="-" positions the block before all other blocks
2. after="-" positions the block after all other block
3. before="some_block" positions this block before another block with name="some_block"
4. after="some_block" position this block after another block with name="some_block"

For example <block name="this_block" before="that_block"/>

any reason “1. before="-" positions the block before all other blocks” wouldn’t work?  i can’t seem to get VerNav above the layered nav. :(

For me this doesn’t work either. Can’t put anything above cart_sidebar. Has this changed in 1.4?

Edit: it appears that the cart has a before="-" in checkout.xml

 
Magento Community Magento Community
Magento Community
Magento Community
 
kajal
Member
 
Total Posts:  60
Joined:  2010-06-27
 

(1)
copy the <reference name="left"> code from your theme -> layout -> checkout.xml

<reference name="left">
<block type="checkout/cart_sidebar" name="cart_sidebar" template="checkout/cart/sidebar.phtml" before="-">
<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"/>
</block>
</reference>

and rename it like
<reference name="header">
<block type="checkout/cart_sidebar" name="cart_sidebar" template="checkout/cart/mini.cart.top.phtml">
</block>
</reference>
place it at above the <reference name="left"> code block

(2)
now copy template -> cart -> checkout -> sidebar.php and save it in the same folder as mini.cart.top.phtml.

Thats it.

For more explanation here is my code for checkout.xml

<default>

<!-- Mage_Checkout -->
<reference name="top.links">
<block type="checkout/links" name="checkout_cart_link">
<action method="addCartLink"></action>
<action method="addCheckoutLink"></action>
</block>
</reference>
<reference name="header">
<block type="checkout/cart_sidebar" name="cart_sidebar" template="checkout/cart/mini.cart.top.phtml">
</block>
</reference>
<reference name="left">
<block type="checkout/cart_sidebar" name="cart_sidebar" template="checkout/cart/sidebar.phtml" before="-">
<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"/>
</block>
</reference>
</default>

and my mini.cart.top.phtml is as

<?php $_cartQty = $this->getSummaryCount() ?>
<div class="items">
<div class="fleft">
<span>
<?php if ($_cartQty!=""): ?>
<?php if ($_cartQty==1): ?>
<?php echo $this->__('No of Items: <a href="%s">1 </a>', $this->getUrl('checkout/cart')) ?>
<?php else: ?>
<?php echo $this->__('No of Items: <a href="%s">%s </a>', $this->getUrl('checkout/cart'), $_cartQty) ?>
<?php endif ?>
<?php else :?>
<?php echo $this->__('No of Items: 0');?>
<?php endif;?>
</span></div>
<div class="fright">
<div class="pad-r">Total: <span class="label"><?php echo Mage::helper('checkout')->formatPrice($this->getSubtotal()) ?>
<?php if ($_subtotalInclTax = $this->getSubtotalInclTax()): ?>
<br />(<?php echo Mage::helper('checkout')->formatPrice($_subtotalInclTax) ?> <?php echo Mage::helper('tax')->getIncExcText(true) ?>)
<?php endif; ?></div>
</div>
</div>

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