Jump to content
appleuastore

[Решено] Кол-во товара в категории

Recommended Posts

Подскажите как вывести количество товара на страницу категорий? Вставляя   <?php echo $text_reward; ?> <?php echo $reward; ?> выдает ошибку, я так понял что нужно еще куда-то что-то дописать но что не знаю(

Share this post


Link to post
Share on other sites

в контроллере

$data['count_product'] = $this->model_catalog_product->getTotalProducts(array('filter_category_id' => $category_id));

в шаблоне

<?php echo $count_product; ?>

 

Share this post


Link to post
Share on other sites
В 06.01.2018 в 19:11, fanatic сказал:

в контроллере


$data['count_product'] = $this->model_catalog_product->getTotalProducts(array('filter_category_id' => $category_id));

в шаблоне


<?php echo $count_product; ?>

 

А куда в контроллере это вписывать?

 

Share this post


Link to post
Share on other sites
13 минут назад, appleuastore сказал:

А куда в контроллере это вписывать?

 

перед $this->response->setOutput($this->load->view('product/category', $data));

Share this post


Link to post
Share on other sites

Появилось везде число 198, но кол-во товара задано явно другое...

Share this post


Link to post
Share on other sites
10 часов назад, appleuastore сказал:

но кол-во товара задано явно другое

наверно я не правильно понял.

мой пример,  выводит количество товаров в текущей категории.

вам нужно на странице категории вывести количество у каждого товара?

Share this post


Link to post
Share on other sites

в контроллере

$data['products'][] = array(
        'product_id'  => $result['product_id'],
        'thumb'       => $image,
        'name'        => $result['name'].'hello',
        'description' => utf8_substr(strip_tags(html_entity_decode($result['description'], ENT_QUOTES, 'UTF-8')), 0, $this->config->get($this->config->get('config_theme') . '_product_description_length')) . '..',
        'price'       => $price,
        'special'     => $special,
        'tax'         => $tax,
        'quantity'    => $result['quantity'],//количество
        'minimum'     => ($result['minimum'] > 0) ? $result['minimum'] : 1,
        'rating'      => $rating,
        'href'        => $this->url->link('product/product', 'path=' . $this->request->get['path'] . '&product_id=' . $result['product_id'] . $url)
);

в шаблоне

<?php echo $product['quantity']; ?>

 

  • +1 1

Share this post


Link to post
Share on other sites
1 час назад, fanatic сказал:

в контроллере


$data['products'][] = array(
        'product_id'  => $result['product_id'],
        'thumb'       => $image,
        'name'        => $result['name'].'hello',
        'description' => utf8_substr(strip_tags(html_entity_decode($result['description'], ENT_QUOTES, 'UTF-8')), 0, $this->config->get($this->config->get('config_theme') . '_product_description_length')) . '..',
        'price'       => $price,
        'special'     => $special,
        'tax'         => $tax,
        'quantity'    => $result['quantity'],//количество
        'minimum'     => ($result['minimum'] > 0) ? $result['minimum'] : 1,
        'rating'      => $rating,
        'href'        => $this->url->link('product/product', 'path=' . $this->request->get['path'] . '&product_id=' . $result['product_id'] . $url)
);

в шаблоне


<?php echo $product['quantity']; ?>

 

О, спасибо!

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
You are posting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

×

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.