Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Where is the content of: <?php echo $this->getChildHtml(’totals’); ?>
 
fluxxixx
Jr. Member
 
Total Posts:  17
Joined:  2010-12-25
 

Hi Magento-users,

Does anyone know where the content can be found of php code below?

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

Thanks,

Another magento-user smile

 
Magento Community Magento Community
Magento Community
Magento Community
 
raulsanchez
Sr. Member
 
Avatar
Total Posts:  83
Joined:  2011-02-22
 
fluxxixx - 15 July 2011 10:12 AM

Hi Magento-users,

Does anyone know where the content can be found of php code below?

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

Thanks,

Another magento-user smile

Here you’ll find your answer
http://www.magentocommerce.com/knowledge-base/entry/magento-for-dev-part-4-magento-layouts-blocks-and-templates

Basically, you must look at the XML layout associated file, it will tell you both the template you are including with the $this->getChidlHtml(); & the block associated to it

For example, if you are browsing the cart
app/design/frontend/base/default/template/checkout/cart.phtml

At the end of the file we find…

<div class="totals">
            
<?php echo $this->getChildHtml('totals'); ?>
        
...
        </
div>

The layout associated file…
app/design/frontend/base/default/layout/checkout.xml

For this example we are browsing the cart, so we look for the <checkout_cart_index> tag
Checkout -> CartController -> IndexAction

<checkout_cart_index translate="label">
        <
label>Shopping Cart</label>
        ...
                <
block type="checkout/cart_totals" name="checkout.cart.totals" as="totals" template="checkout/cart/totals.phtml"/>
            </
block>
        </
reference>
    </
checkout_cart_index>

It means that $this->getChildHtml(’totals’) will include code from checkout/cart/totals.phtml Template, which is associated to the checkout/cart_totals Block. In a clean installation you’ll find this files at
app/design/frontend/base/default/template/checkout/cart/totals.phtml
app/code/core/Mage/Checkout/Block/Cart/Totals.php

Hope it helps
Best regards

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top