Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[Решено] Получить и вывести product_id для карточек товаров в footer.tpl


Recommended Posts

Нужно вывести product_id товара в карточках товара в коде ремаркетинга. Так как код находится в footer.tpl , то при выводе $product_id выводится ошибка Undefined variable in ... footer.tpl

Как получить и вывести product_id?

Link to comment
Share on other sites


Так же само как и в контроллере товара:

if (isset($this->request->get['product_id'])) {
			$product_id = (int)$this->request->get['product_id'];
}

 

Link to comment
Share on other sites


 

<?php
if (isset($this->request->get['product_id'])) {
$product_id = (int)$this->request->get['product_id'];
}
echo $product_id; // Undefined variable: product_id in /...../footer.tpl
?>

Выводит "Undefined variable ...

Link to comment
Share on other sites


А где Вы его вставляеете?

Такой код в footer.tpl не пройдет ))

Сначала нужно сделать в footer.php

if (isset($this->request->get['product_id'])) {
$data['product_id'] = (int)$this->request->get['product_id'];
}

А потом в footer.tpl 

<?php if isset ($product_id) {
echo $product_id?>
  • +1 1
Link to comment
Share on other sites


27 минут назад, vtkach сказал:

А где Вы его вставляеете?

Такой код в footer.tpl не пройдет ))

Сначала нужно сделать в footer.php

if (isset($this->request->get['product_id'])) {
$data['product_id'] = (int)$this->request->get['product_id'];
}

А потом в footer.tpl 

<?php if isset ($product_id) {
echo $product_id?>

 

спасибо!

Link to comment
Share on other sites


Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

On our site, cookies are used and personal data is processed to improve the user interface. To find out what and what personal data we are processing, please go to the link. If you click "I agree," it means that you understand and accept all the conditions specified in this Privacy Notice.