How to make so that in the catalog where goods belonging to this catalog are displayed (not the product page, product cards) the manufacturers of goods are displayed between the name and description of the goods?

marked the place where I would like to present the manufacturer

on the product page, for example, the manufacturer

on the product page, for example, the manufacturer

  • If you are given an exhaustive answer, mark it as correct (a daw opposite the selected answer). - Nicolas Chabanovsky

2 answers 2

In the catalog/controller/product/category.php file, find the timeline

 $data['products'][] = array( 

then add to array

 'rating' => $result['rating'], 'manufacturer' => $result['manufacturer'], // <= это нужно добавить 

Initially, in the ModelCatalogProduct class (model) ModelCatalogProduct static getProducts() method does not receive data for the manufacturer from the database. Need to fix it.

Edit the getProducts() method in the catalog/model/catalog/product.php getProducts()

in SELECT query add

 m.name as manufacturer 

and additionally in the request to register the connection with the manufacturer

 LEFT JOIN " . DB_PREFIX . "manufacturer m ON p.manufacturer_id = m.manufacturer_id 

Then in the template category.tpl display the manufacturer (inside the foreach iterator)

 <?php echo $product['manufacturer']; ?> 
  • Honestly, I'm not a programmer. If you can, please step by step. This line is $ this-> data ['products'] [] = array (I didn’t find it at all. Honestly and $ this-> data will not find this part. If I can send a file. - Hovik
  • $this->data corrected and replaced by $data . Here it is: github.com/opencart/opencart/blob/master/upload/catalog/… - Invision
  • In my opinion, the description does not need additional clarification and contains information with sequential actions that must be performed. If you have difficulties, hire a specialist. - Invision

Opencart 3. Dobovlyaem manufacturer's product with an active link

Output manufacturer. File - \ catalog \ controller \ product \ category.php , array - $ data ['products'] [] = array (here ...); add code below

 'manufacturer' => $result['manufacturer'], 'manufacturers' => $this->url->link('product/manufacturer/info', 'manufacturer_id=' . $result['manufacturer_id']), 

enter image description here

Link to the manufacturer. file - product \ category.twig add

 {% if product.manufacturer %} {{ text_manufacturer }} <a href="{{ product.manufacturers }}">{{ product.manufacturer }}</a> {% endif %} 

enter image description here