2

In following path, app\design\frontend\MYTHEME\default\template\checkout\cart\totals.phtml file contains $this->renderTotals().

My question is that, which phtml file is called by renderTotals() method ?

I want to update Subtotal, Shipping & Handling (Flat Rate - Fixed), Grand Total style in http://localhost/MYTHEME/index.php/checkout/cart/

8

The easier way to find out what template is used is to enable the template path hints.
But here is the stacktrace you need to follow.

Mage_Checkout_Block_Cart_Totals::renderTotals calls renderTotal for each total.
This one calls _getTotalRenderer that works like this:

if there is a block with the name $code_total_renderer in the page ($code is the code of the total) then that block is used.
Most probably these blocks do not exist, but it's a good extension point because you can add any block you want.
If the block does not exist, it looks in the config for the node global/sales/quote/totals/{$code}/renderer and uses this one. The template should be defined in the block used.

you will find in config.xml of the Tax module (I have no idea why it's not in the sales module) this

     <sales>
        <quote>
            <totals>
                <tax_subtotal>
                    <class>tax/sales_total_quote_subtotal</class>
                    <after>freeshipping</after>
                    <before>tax,discount</before>
                </tax_subtotal>
                <tax_shipping>
                    <class>tax/sales_total_quote_shipping</class>
                    <after>shipping</after>
                    <before>tax,discount</before>
                </tax_shipping>
                <tax>
                    <class>tax/sales_total_quote_tax</class>
                    <after>subtotal,shipping</after>
                    <before>grand_total</before>
                    <renderer>tax/checkout_tax</renderer>
                    <admin_renderer>adminhtml/sales_order_create_totals_tax</admin_renderer>
                </tax>
                <subtotal>
                    <renderer>tax/checkout_subtotal</renderer>
                    <admin_renderer>adminhtml/sales_order_create_totals_subtotal</admin_renderer>
                </subtotal>
                <shipping>
                    <renderer>tax/checkout_shipping</renderer>
                    <admin_renderer>adminhtml/sales_order_create_totals_shipping</admin_renderer>
                </shipping>
                <discount>
                    <renderer>tax/checkout_discount</renderer>
                    <admin_renderer>adminhtml/sales_order_create_totals_discount</admin_renderer>
                </discount>
                <grand_total>
                    <renderer>tax/checkout_grandtotal</renderer>
                    <admin_renderer>adminhtml/sales_order_create_totals_grandtotal</admin_renderer>
                </grand_total>
            </totals>
            <nominal_totals>
                <nominal_tax_subtotal>
                    <class>tax/sales_total_quote_nominal_subtotal</class>
                    <sort_order>500</sort_order>
                </nominal_tax_subtotal>
                <nominal_tax>
                    <class>tax/sales_total_quote_nominal_tax</class>
                    <sort_order>750</sort_order>
                </nominal_tax>
            </nominal_totals>
        </quote>
    </sales>

This means that for example for subtotal the block tax/checkout_subtotal is used. If you look inside the block you will see the template tax/checkout/subtotal.phtml.
You can take the same steps for all the other totals you need, but first give the template path hints a try. It may save you the trouble of digging through the xmls.

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.