Reputation: 208
This code is write in market.phtml
<?php echo $this->getLayout()->createBlock('core/template')->setData('vendorId',$vendor->getCustomerId())->setTemplate('marketplace/vendors/badge.phtml')->toHtml();?>
In Badge.php
echo $this->vendorId;
But my output is null. Is this correct way to pass data to block?
Upvotes: 2
Views: 5329
Reputation: 14746
You need to change your variable like this and check it
<?php echo $this->getLayout()->createBlock('core/template')->setVendorId($vendor->getCustomerId())->setTemplate('marketplace/vendors/badge.phtml')->toHtml();?>
Now you can access this vendor ID variable in badge.phtml file like this :
<?php echo $this->getVendorId();?>
Upvotes: 7