1

how- to pass dynamic variable-from a parent block to childchild block. Is there a method like this? getChildChild(), so that I can setData .

$this->getChildChild('container2')->setData('pro_id',$var);
echo $this->getChildChildHtml('container2', '', false, true) ;

1 Answer 1

2

Absolutely you can do this by loading the block and then calling either assign or setData on it.

In PHP

$this->getLayout()->getBlock('block_name')->setData('user', Mage::getModel('mymodule/user')->load($this->getUserId())); 

Or in XML

<block type="mymodule/user" name="block_name">
  <action method="setUserId"><user_id>string_goes_here</user_id></action>
</block>

More reading:

https://magento.stackexchange.com/a/933/336

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.