1

I am trying to override cart.phtml from checkout\cart.phtml using local.xml

<layout version="0.1.0">
    <checkout_cart_index translate="label">
        <reference name="checkout.cart">
            <action method="setTemplate"><template>test/cart.phtml</template></action>
        </reference>
    </checkout_cart_index>
</layout> 

override works fine but when i try to empty cart it always call my cart.phtml instead of checkout\cart\noItems.phtml.

when my cart is empty then it looks like

enter image description here

Any help will be appreciated

Thank you

1

You can use the methods setCartTemplate and setEmptyTemplate to override only the cart when it has items, or its empty:

<layout version="0.1.0">
    <checkout_cart_index translate="label">
        <reference name="checkout.cart">
            <action method="setCartTemplate">
                <value>test/cart.phtml</value>
            </action>
            <action method="setEmptyTemplate">             
                <value>test/cartNoItems.phtml</value>
            </action>
        </reference>
    </checkout_cart_index>
</layout>
4
<layout version="0.1.0">
    <checkout_cart_index translate="label">
        <reference name="checkout.cart">
          <action method="setCartTemplate"><value>test/cart.phtml</value></action>
          <action method="setEmptyTemplate"><value>test/cartNoItems.phtml</value></action>
          <action method="chooseTemplate"/> <== ADD THIS
        </reference>
    </checkout_cart_index>
</layout>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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