catalog/model/catalog/product.php - getTotalProducts
some modify to use function for active category only (catalog/controller/module/category.php):
Code: Select all
Line 31: $categories = $this->model_catalog_category->getCategories(0);
Line 32:
Line 33: foreach ($categories as $category) {
Line 34: $children_data = array();
Line 35: $children = $this->model_catalog_category->getCategories($category['category_id']);
Line 36: foreach ($children as $child) {
Line 37: $data = array(
Line 38: 'filter_category_id' => $child['category_id'],
Line 39: 'filter_sub_category' => true
Line 40: );
Line 41:
Line 42: if($child['parent_id'] == $this->data['category_id']){
Line 43: $product_total = $this->model_catalog_product->getTotalProducts($data);
Line 44: $children_data[] = array(
Line 45: 'category_id' => $child['category_id'],
Line 46: 'name' => $child['name'] . ' (' . $product_total . ')',
Line 47: 'href' => $this->url->link('product/category', 'path=' . $category['category_id'] . '_' . $child['category_id'])
Line 48: );
Line 49: }else{
Line 50: $children_data[] = array(
Line 51: 'category_id' => $child['category_id'],
Line 52: 'name' => $child['name'],
Line 53: 'href' => $this->url->link('product/category', 'path=' . $category['category_id'] . '_' . $child['category_id'])
Line 54: );
Line 55: }
Line 56: }
If I change $product_total = $this->model_catalog_product->getTotalProducts($data); to $product_total=1; (in original category.php - Line 44 & Line 58) then site work perfect.
shop url: http://okompiuteriai.lt/