1

i wrote a custom module, which includes a phtml placed at

\app\design\frontend\mytheme\default\template\checkout\cartrelated\cartrelated.phtml

i added a line

    <block type="cartrelated/cartrelated" name="cartrelated.cartrelated" 
template="checkout/cartrelated/cartrelated.phtml"></block>

in

\app\design\frontend\mytheme\default\layout\checkout.xml

the phtml not displaying, anyone know what is the problem?

config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Rayman_Cartrelated>
            <version>0.1.0</version>    <!-- Version number of your module -->
        </Rayman_Cartrelated>
    </modules>
    <global>
        <blocks>
          <cartrelated>
            <class>Rayman_Cartrelated_Block</class>
          </cartrelated>
        </blocks>
        <models>
          <cartrelated>
            <class>Rayman_Cartrelated_Model</class>
          </cartrelated>
        </models>
    </global>
</config>

the cartrelated.phtml just contains echo 'abctest'

here is the content section of checkout.xml

        <reference name="content">
        <block type="checkout/cart" name="checkout.cart">
            <action method="setCartTemplate"><value>checkout/cart.phtml</value></action>
            <action method="setEmptyTemplate"><value>checkout/cart/noItems.phtml</value></action>
            <action method="chooseTemplate"/>
            <action method="addItemRender"><type>simple</type><block>checkout/cart_item_renderer</block><template>checkout/cart/item/default.phtml</template></action>
            <action method="addItemRender"><type>grouped</type><block>checkout/cart_item_renderer_grouped</block><template>checkout/cart/item/default.phtml</template></action>
            <action method="addItemRender"><type>configurable</type><block>checkout/cart_item_renderer_configurable</block><template>checkout/cart/item/default.phtml</template></action>

            <block type="core/text_list" name="checkout.cart.empty.widget" as="checkout_cart_empty_widget" translate="label">
                <label>Empty Shopping Cart Content Before</label>
            </block>

            <block type="core/text_list" name="checkout.cart.top_methods" as="top_methods" translate="label">
                <label>Payment Methods Before Checkout Button</label>
                <block type="checkout/onepage_link" name="checkout.cart.methods.onepage.top" template="checkout/onepage/link.phtml" after="-" />
            </block>

            <block type="page/html_wrapper" name="checkout.cart.form.before" as="form_before" translate="label">
                <label>Shopping Cart Items Before</label>
            </block>

            <block type="core/text_list" name="checkout.cart.methods" as="methods" translate="label">
                <label>Payment Methods After Checkout Button</label>
                <block type="checkout/onepage_link" name="checkout.cart.methods.onepage.bottom" template="checkout/onepage/link.phtml"/>
                <block type="checkout/multishipping_link" name="checkout.cart.methods.multishipping" template="checkout/multishipping/link.phtml"/>
            </block>

            <!--<block type="checkout/cart_coupon" name="checkout.cart.coupon" as="coupon" template="checkout/cart/coupon.phtml"/>-->
            <block type="cartrelated/cartrelated" name="cartrelated_cartrelated" as="cartrelated" template="checkout/cartrelated.phtml"/>

            <block type="core/text_list" name="checkout.cart.extra" translate="label">
                <label>Checkout Forms Extra</label>
            </block>

            <block type="checkout/cart_shipping" name="checkout.cart.shipping" as="shipping" template="checkout/cart/shipping.phtml"/>

            <block type="core/text_list" name="checkout.cart.widget" as="checkout_cart_widget" translate="label">
                <label>Shopping Cart Items After</label>
            </block>
            <block type="checkout/cart_crosssell" name="checkout.cart.crosssell" as="crosssell" template="checkout/cart/crosssell.phtml"/>


            <block type="checkout/cart_totals" name="checkout.cart.totals" as="totals" template="checkout/cart/totals.phtml"/>
        </block>
    </reference>
    <block type="core/text_list" name="additional.product.info" translate="label">
        <label>Additional Product Info</label>
    </block>
</checkout_cart_index>
9
  • Can you add your config.xml Commented Feb 25, 2016 at 3:53
  • Can you refresh your cache and also disable compilation Commented Feb 25, 2016 at 4:02
  • @Rohit already do that so many times
    – hkguile
    Commented Feb 25, 2016 at 4:03
  • Can you add in which handle you have added your block? Commented Feb 25, 2016 at 4:04
  • Could you add the content of checkout.xml? Commented Feb 25, 2016 at 4:14

1 Answer 1

0
<reference name="content">
        <block type="checkout/cart" name="checkout.cart">
            <action method="setCartTemplate"><value>checkout/cart.phtml</value></action>
            <action method="setEmptyTemplate"><value>checkout/cart/noItems.phtml</value></action>
            <action method="chooseTemplate"/>
            <action method="addItemRender"><type>simple</type><block>checkout/cart_item_renderer</block><template>checkout/cart/item/default.phtml</template></action>
            <action method="addItemRender"><type>grouped</type><block>checkout/cart_item_renderer_grouped</block><template>checkout/cart/item/default.phtml</template></action>
            <action method="addItemRender"><type>configurable</type><block>checkout/cart_item_renderer_configurable</block><template>checkout/cart/item/default.phtml</template></action>

            <block type="core/text_list" name="checkout.cart.empty.widget" as="checkout_cart_empty_widget" translate="label">
                <label>Empty Shopping Cart Content Before</label>
            </block>

            <block type="core/text_list" name="checkout.cart.top_methods" as="top_methods" translate="label">
                <label>Payment Methods Before Checkout Button</label>
                <block type="checkout/onepage_link" name="checkout.cart.methods.onepage.top" template="checkout/onepage/link.phtml" after="-" />
            </block>

            <block type="page/html_wrapper" name="checkout.cart.form.before" as="form_before" translate="label">
                <label>Shopping Cart Items Before</label>
            </block>

            <block type="core/text_list" name="checkout.cart.methods" as="methods" translate="label">
                <label>Payment Methods After Checkout Button</label>
                <block type="checkout/onepage_link" name="checkout.cart.methods.onepage.bottom" template="checkout/onepage/link.phtml"/>
                <block type="checkout/multishipping_link" name="checkout.cart.methods.multishipping" template="checkout/multishipping/link.phtml"/>
            </block>

            <!--<block type="checkout/cart_coupon" name="checkout.cart.coupon" as="coupon" template="checkout/cart/coupon.phtml"/>-->
            <block type="cartrelated/cartrelated" name="cartrelated_cartrelated" as="cartrelated" template="checkout/cartrelated.phtml"/>

            <block type="core/text_list" name="checkout.cart.extra" translate="label">
                <label>Checkout Forms Extra</label>
            </block>

            <block type="checkout/cart_shipping" name="checkout.cart.shipping" as="shipping" template="checkout/cart/shipping.phtml"/>

            <block type="core/text_list" name="checkout.cart.widget" as="checkout_cart_widget" translate="label">
                <label>Shopping Cart Items After</label>
            </block>
            <block type="checkout/cart_crosssell" name="checkout.cart.crosssell" as="crosssell" template="checkout/cart/crosssell.phtml"/>


            <block type="checkout/cart_totals" name="checkout.cart.totals" as="totals" template="checkout/cart/totals.phtml"/>
        </block>
    //add your bloc here 


 <block type="cartrelated/cartrelated" name="cartrelated.cartrelated"  after="-"
template="checkout/cartrelated/cartrelated.phtml"></block>
        </reference>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.