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

Montana19

Newbie
  
  • Posts

    4
  • Joined

  • Last visited

Montana19's Achievements

Newbie

Newbie (1/14)

  • First Post
  • Conversation Starter
  • Week One Done
  • One Month Later
  • One Year In

Recent Badges

0

Reputation

  1. foreach ($categories as $category) { //Будем вычислять кол-во товаров в категориях только если это кол-во надо показывать if ($show_product_count) { $total = $this->model_catalog_product->getTotalProducts(array('filter_category_id' => $category['category_id'])); } $children_data = array(); $children = $this->model_catalog_category->getCategories($category['category_id']); foreach ($children as $child) { //Будем вычислять кол-во товаров в категориях только если это кол-во надо показывать if ($show_product_count) { $data = array( 'filter_category_id' => $child['category_id'], 'filter_sub_category' => true ); $product_total = $this->model_catalog_product->getTotalProducts($data); $total += $product_total; } $children_data[] = array( 'category_id' => $child['category_id'], 'name' => $child['name'] . ($show_product_count ? ' (' . $product_total . ')' : ''), 'href' => $this->url->link('product/category', 'path=' . $category['category_id'] . '_' . $child['category_id']) ); } $this->data['categories'][] = array( 'category_id' => $category['category_id'], 'name' => $category['name'] . ($show_product_count ? ' (' . $total . ')' : ''), 'children' => $children_data, 'href' => $this->url->link('product/category', 'path=' . $category['category_id']) ); }
  2. Возможно нубский вопрос, но уж простите недалёкого. Особо не вникал в код. В общем начал заполнять понемногу базу. Но в заголовке категорий количество товаров превышает реальное количество ровно в два раза. Где это исправить?
Guest
×
  • 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.