2
2
20strannik082020-12-02 13:32:18
opencart
20strannik08, 2020-12-02 13:32:18

How to display the store id in the list of products and categories of the admin panel in opencart?

Worth Octstore 2.3.

In the admin panel, in the list of products and categories, I try to display the id of the store to which it (the element) is assigned opposite each element. In site.ru/admin/view/template/catalog/product_list.tpl I tried to output <?php echo $product['store_id']; ?> But it doesn't work...

In site.ru/admin/model/catalog/product.php there is a mention of $store_id, as I understand it, the request is already being made about the necessary information in the database in the product_to_store field.

However, in the site.ru/ controller admin/controller/catalog/product.php only occurs in one place

$this->load->model('setting/store');

    $data['stores'] = $this->model_setting_store->getStores();

    if (isset($this->request->post['product_store'])) {
      $data['product_store'] = $this->request->post['product_store'];
    } elseif (isset($this->request->get['product_id'])) {
      $data['product_store'] = $this->model_catalog_product->getProductStores($this->request->get['product_id']);
    } else {
      $data['product_store'] = array(0);
    }


Plz tell me, what variable here will display the id of the store to which each specific product is linked in the list of products? Or is there something else that needs to be added for a successful conclusion? Similarly with the list of categories you are interested in ...

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Nikolaev, 2020-12-04
@megrel90

Find string Add to array
$data['products'][] = array(

'store_id'   => $this->model_catalog_product->getProductStores($result['product_id']),

And then already output in the template of the list of goods.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question