Page 1 of 1

how to use GET php request in Opencart using php code

Posted: Tue Sep 24, 2019 8:36 pm
by ovidiublaga88
Hello,

I am in public_html/catalog/view/theme/OPC070174-8/template/product/product.twig. I try to edit the product.twig file and in the URL I have https://exampletest.ro/index.php?route= ... duct_id=55. I want to use a command that if (GET['product_id'] == 55) { "do something" }. How can i do this? please help.

Many thanks

Re: how to use GET php request in Opencart using php code

Posted: Wed Sep 25, 2019 1:25 am
by developer@avi
You need set product is in data in product controller like
$data['product_id']=$this->request>get['product_id'];

Then use {% if product_id==55 %}

On template

Re: how to use GET php request in Opencart using php code

Posted: Wed Sep 25, 2019 1:53 pm
by ovidiublaga88
developer@avi wrote:
Wed Sep 25, 2019 1:25 am
You need set product is in data in product controller like
$data['product_id']=$this->request>get['product_id'];

Then use {% if product_id==55 %}

On template
Thank you. So I use {% if product_id==55 % echo '<a href="www.google.com">google</a>'} ?

I use ECHO then?

Re: how to use GET php request in Opencart using php code

Posted: Wed Sep 25, 2019 4:07 pm
by ovidiublaga88
Thanks a lot. It worked