Magento - 如何在/ checkout / cart / page添加自定义块?

时间:2016-07-11 09:46:06

标签: magento

我正在开发自定义扩展程序,我想在/ checkout / cart / page中添加其他块。

看看: enter image description here

这是我的配置:

<?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> 

如何在该块下添加自定义块? 你能帮帮我吗?

提前致谢!

1 个答案:

答案 0 :(得分:1)

例如,如果要在场外添加静态块,则购物车总数为:

在您checkout_cart_index中的cart_totals阻止后,在theme/layout/checkout.xml句柄处添加以下代码

<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>

在关闭

标签后,在你的cart.phtml文件中调用此块
"<div class="cart-totals">"

像:

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

在您的情况下,您可以为您的块创建一个phtml文件,并且可以如上所示显示。

相关问题