M
M
mr_firuzinho2017-08-23 15:30:00
opencart
mr_firuzinho, 2017-08-23 15:30:00

How to get product id in Opencart 2.x?

Hello, how can I get, for example, in category.tpl in a certain place the id of the product.
There are several products in a row, so you need to add a class for each product.
How can I implement it?
Thank you.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2017-08-25
@mr_firuzinho

Go to the controller /catalog/controller/product file category.php , look for the code in it: See if it is in the array If yes, fine, if not, then add it. Next, go to catalog/view/theme/*/template/product (where instead of an asterisk, the name of your theme) to the product.tpl file, after the construction, insert the output of your product ID through
<?php echo $product['product_id']; ?>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question