2

I have below code in phtml 1:

<?php $itemid = $item->getItemId() ?>
<a href="<?php echo $this->getUrl('history/customer/detail', 
            ['item_id' =>$itemid]); ?>">Product Detail
</a>

How can I get variable $itemid with using function $_GET in phtml 2.

Can anyone show me?

Thanks.

6

You can achieve this

$this->getRequest()->getParams(); 

will get you the all parameters

If you want to get specific param

$this->getRequest()->getParam('something');

In your case, It should be like this

$this->getRequest()->getParam('item_id');

I hope this will help

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.