First Block:


function name : getLocationAttributes()

Second Block:


How to get the first block function values ?


You can get this file in customerreview.php and call function from that file.

namespace Zero\Storelocator\Block;

class Customerreview extends \Magento\Framework\View\Element\Template
     public function __construct(
        \Zero\Storelocator\Block\view\Attributes $attributes,
        \Magento\Framework\View\Element\Template\Context $context,        
        array $data = []
     ) {
        $this->$attributes = $attributes;
        parent::__construct($context, $data);

    public function getCustomerReview(){    

       echo $this->$attributes->getLocationAttributes();
  • Hi, i am getting this error : Error: Object of class Zero\Storelocator\Block\View\Attributes could not be converted to string in C:\xampp\htdocs\m3\app\code\Zero\Storelocator\Block\Customerreview.php:21 Screenshot : snipboard.io/URcLt3.jpg – zus May 3 at 11:55
  • attribute.php paste.ofcode.org/ZXffpxtY5wHDjNkn6SaciZ – zus May 3 at 11:58
  • 1
    remove echo from line no.21 and use print_r() to print the value of attributes. – Mital Shah May 3 at 12:04
  • In attribute.php log return values, when i print values in Customerreview.php log not generated and return Error: Call to a member function getAttributes() on null, Can you pls help me on that, i posted new post : magento.stackexchange.com/q/336603/57334 – zus May 4 at 3:46
  • FYI I am trying to pass the value third-party module block to the custom module block. – zus May 4 at 3:55

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.