|
Hi there!
I\’m on to create an advanced review module. But I\’m facing with a getChild()->setData() parent to child variable passing issue.
I\’m using this code to pass a variable to another block:
$this->getChild(\'ratereview\')->setData(\'review\',1); ?> echo $this->getChildHtml(\'ratereview\',false);
this is the block code:
<block type=\"review/product_view_list\" name=\"product.info.product_additional_data\" as=\"product_additional_data\" template=\"review/product/view/list.phtml\"> <block type=\"tlreview/ratereview\" name=\"ratereview\" as=\"ratereview\"/ > </block>
and the child block:
class TLSoft_RateReview_Block_Ratereview extends Mage_Core_Block_Template { protected $_review; public function __construct() { parent::__construct(); $this->_review=$this->getData($review); $this->setTemplate(\'tlsoft/review/product/view/list/ratereview.phtml\'); }
public function getReview() { return $this->_review; } }
And when I\’m wanted to use this variable in the related .phtml file, it\’s not getting trough!
$_review=$this->getReview(); print_r($_review);
My only idea is because setTemplate calling in constructor, but it\’s just a hard guessing.
|