How do I check the $ logged variable in a column_right.tpl pattern in Opencart?

  • The question needs to be rephrased. "in the column_right template" is a meaningless clarification, but it would be useful to specify the type of the variable (boolean?), although I suspect that you and a more general construction will do. And what's the template in opencart? - AK
  • There is no template engine, as such, just php. - Andrew Hobbit

1 answer 1

In the controller catalog/controller/common/column_right.php add:

 $this->data['logged'] = $this->customer->isLogged(); 

In the catalog/view/theme/default/template/common/column_right.tpl :

 <?php if ($logged) { ?> Что будет для покупателей. <?php } else { ?> Что будет для гостей. <?php } ?>