Magento Forum

Checkout Cart controller getBlock(’checkout.cart’) is false, why? 
 
Michael70
Jr. Member
 
Total Posts:  10
Joined:  2010-06-17
 

Hi,

in Mage_Checkout_CartController Class $this->getLayout()->getBlock(’’checkout.cart’’) returns false;why?

this works:
$g = $this->getLayout()->getBlock(’cart_sidebar’);
echo $g->toHtml();

I get the sidebar, but why I dont get the whole checkout cart?

Thanks, Michael

 
Magento Community Magento Community
Magento Community
Magento Community
 
magestore
Mentor
 
Avatar
Total Posts:  1015
Joined:  2009-08-07
Viet Nam
 

Hello,

I think block cart_sidebar has been declared in default, so you can call

$this->getLayout()->getBlock(’cart_sidebar’)
any where.
Block checkout.cart has been only declared in action checkout_cart_index, so that you only call
$this->getLayout()->getBlock('checkout.cart')
in action checkout_cart_index. If you call in out of action checkout_cart_index, it is return false.
 
Magento Community Magento Community
Magento Community
Magento Community
 
mcalvo
Jr. Member
 
Total Posts:  18
Joined:  2012-02-02
 

How would you do to execute $this->getLayout()->getBlock(\’checkout.cart\’) outside indexController ?

for example in a custom action placed in CartController.php

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