O
O
Otrivin2017-03-31 09:29:57
CMS
Otrivin, 2017-03-31 09:29:57

OpenCart 2. How to check if we are on the product page?

Hello!
There is a store on OpenCart 2.0.1.1, it is necessary to set a check in the header.tpl whether we are on the product page or some other.

<?php
  if (<проверка, товар ли мы показываем ини нет>){
    оператор;
  }else{
    оператор 2;
  };
?>

How can such a check be carried out?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
imdeveloper, 2017-03-31
@link_web

/catalog/controller/common/header.php
Add something to the header controller And in the header template, after clearing the cache, you can already get the current route in the $data['route'] variable and write conditions for it $data['route'] = $this->request->get['route'];

M
maxic, 2017-04-08
@maxic

Check for get parameter product_id
if (isset($this->request->get['product_id']))

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question