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?
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();?>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.