Venelin
Venelin

Reputation: 3308

Magento - How to add custom block at the /checkout/cart/ page?

I am working on a custom extension and i want to add additional block to the /checkout/cart/ page.

Take a look: enter image description here

Here is my config:

<?xml version="1.0"?>
<config>
  <modules>
    <VivasIndustries_ExpressDelivery>
      <version>1.0.0</version>
    </VivasIndustries_ExpressDelivery>
  </modules>
  <global>
    <models>
        <expressdelivery>
            <class>VivasIndustries_ExpressDelivery_Model</class>
            <resourceModel>vivasindustries_expressdelivery_resource</resourceModel>
        </expressdelivery>
        <vivasindustries_expressdelivery_resource>
        <class>VivasIndustries_ExpressDelivery_Model_Resource</class>
        <entities>
            <expressdelivery>
            <table>VivasIndustries_ExpressDelivery</table>
            </expressdelivery>
        </entities>
        </vivasindustries_expressdelivery_resource>
    </models>
    <resources>
        <expressdelivery_setup>
            <setup>
                <module>VivasIndustries_ExpressDelivery</module>
            </setup>
            <connection>
                 <use>core_setup</use>
             </connection>
        </expressdelivery_setup>
        <expressdelivery_read>
            <connection>
                <use>core_read</use>
            </connection>
        </expressdelivery_read>
        <expressdelivery_write>
            <connection>
                <use>core_write</use>
            </connection>
        </expressdelivery_write>
    </resources>    
    <helpers>
        <expressdelivery>
            <class>VivasIndustries_ExpressDelivery_Helper</class>
        </expressdelivery>
    </helpers>
    <blocks>
        <expressdelivery>
             <class>VivasIndustries_ExpressDelivery_Block</class>
        </expressdelivery>
    </blocks>
  </global>
  <adminhtml>
    <acl>
        <resources>
            <all>
                <title>Allow Everything</title>
            </all>
            <admin>
                <children>
                    <system>
                        <children>
                            <config>
                                <children>
                                    <expressdeliveryadmin>
                                        <title>Vivas - All</title>
                                    </expressdeliveryadmin>
                                </children>
                            </config>
                        </children>
                    </system>
                </children>
            </admin>
        </resources>
    </acl>
    <layout>
        <updates>
            <expressdelivery>
                <file>expressdelivery.xml</file>
            </expressdelivery>
        </updates>
    </layout>   
    </adminhtml>
    <admin>
        <routers>
            <adminhtml>
                <args>
                    <modules>
                        <VivasIndustries_ExpressDelivery before="Mage_Adminhtml">VivasIndustries_ExpressDelivery_Adminhtml</VivasIndustries_ExpressDelivery>
                    </modules>
                </args>
            </adminhtml>
        </routers>
    </admin>
</config> 

How can i add a custom block bellow that block? Can you please help me out?

Thanks in advance!

Upvotes: 0

Views: 1178

Answers (1)

Suman Singh
Suman Singh

Reputation: 1377

For example If you want to add a static block outsite the cart total:

Add below code at checkout_cart_index handle after the cart_totals block in your theme/layout/checkout.xml like

<block type="checkout/cart_totals" name="checkout.cart.totals" as="totals" template="checkout/cart/totals.phtml"/>
<block type="cms/block" name="customblock" after="totals" >
    <action method="setBlockId"><block_id>myblock</block_id></action>
</block>

after that call this block in you cart.phtml file after closing tag of

"<div class="cart-totals">"

like:

<?php echo $this->getChildHtml('customblock') ?>

In your case you can create a phtml file for your block and can show as above.

Upvotes: 1

Related Questions