First Block:


function name : getLocationAttributes()

Second Block:


How to get the first block function values ?

1 Answer 1


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
    Commented May 3, 2021 at 11:55
  • attribute.php paste.ofcode.org/ZXffpxtY5wHDjNkn6SaciZ
    – zus
    Commented May 3, 2021 at 11:58
  • 1
    remove echo from line no.21 and use print_r() to print the value of attributes.
    – Mital Shah
    Commented May 3, 2021 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
    Commented May 4, 2021 at 3:46
  • FYI I am trying to pass the value third-party module block to the custom module block.
    – zus
    Commented May 4, 2021 at 3:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.