Magento: Cant find template
I see a call
<?php echo $t开发者_C百科his->getChildHtml('coupon') ?>
in cart.phtml. I cannot find this file anywhere. I am new to Magento, Could you tell me a location where this file should ideally reside? Also, do these templates also load from Database and should I check there/
Kind regards Khuram
To find this you need to do a little bit of tracing :).
We need to look in a "layout.xml" file since this is where "ChildHtml" blocks are declared. Since this is the Cart,which is part of the Checkout module, we need to look in checkout.xml
.
You should find the line declaring the "coupon" block under the checkout_cart_index
section of this file. Here it is:
<block type="checkout/cart_coupon" name="checkout.cart.coupon" as="coupon" template="checkout/cart/coupon.phtml"/>
So, checkout/cart/coupon.phtml
is the template file you are looking for. You can see
it is assigned the name "coupon" with the as="coupon"
line.
This file will probably be in the folder /app/design/frontend/default/default/checkout/cart/coupon.phtml
and you should copy it your custom theme directory, which will automatically override the default and use your new coupon.phtml template file.
I hope this helps, and happy Magentoing
精彩评论