cancel
Showing results for 
Search instead for 
Did you mean: 

How to pass the value from Module A phtml file to Module B php file

How to pass the value from Module A phtml file to Module B php file

I want to share one field from Module A to Module B,

I am trying, (Module B)

    $storeid = 'https://mybusiness.googleapis.com/v4/accounts/123456789/locations?filter=storeCode="<?php
            echo $this->getLayout()->createBlock("Zero\Storelocator\Block\Neareststore")->setTemplate("Zero_Storelocator::google_reviews.phtml")->toHtml();
            ?>"';

    $url = 'https://mybusiness.googleapis.com/v4/accounts/'.$accountId.'/locations/'.$storeid.'/reviews';

Logic: I want to get location id based on the store code, store code i am getting from Module A pass to Module B in URL 1 and get location ID using API and pass that location Id to second url

The first step, How to pass my Module A phtml file value to Module B php file,

Any best practice pls suggest?

1 REPLY 1

Re: How to pass the value from Module A phtml file to Module B php file

Hi @Aveeva ,

 

Can you try below mentioned way to send data to block file from phtml file

You can also pass variables or parameters while calling the block from phtml file

 
1
{{block class="Chapagain\HelloWorld\Block\HelloWorld" name="your_block_name" title="My Title" count="10" }}

 

And in the block file you can get the values like 

$title = $this->getData('title');
$count = $this->getData('count');
 
 
Hope this helps you!
Problem Solved! Click Kudos & Accept as Solution!