Post by slycrespo » Sat Dec 12, 2020 6:30 pm

Hello!
I have currently just one product in my store. The product is in one parrent and in on subcategory. So it should show number 1 in parrent and number 1 in subcategory. But its showing number 2 in parrent and number 1 in subcategory. I think this is not logical...

Image

Please help!

New member

Posts

Joined
Tue Aug 28, 2012 7:41 am

Post by slycrespo » Mon Dec 14, 2020 8:48 pm

Help...

New member

Posts

Joined
Tue Aug 28, 2012 7:41 am

Post by by mona » Mon Dec 14, 2020 9:08 pm

No one can help you with such little information.
It is accepted to always post your OC version as well as themes and extensions and a web address is useful on many occasions.

However, even if you post this I suspect the answer will be the same
Double check that you have not inadvertently added a product to a sub category.
Contact your theme developer or the developer of the extension.

I have not noticed or ever been advised by a client that this is happening.
That does not always mean that it is not Opencart related, but it would appear NOT to be Opencart related.

DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.


Spinning Social : Links : Menus : Payments : Socials : Ads : Screen Backgrounds : Galleries : Headers : Banners : Promos


Active Member

Posts

Joined
Mon Jun 10, 2019 9:31 am

Post by pprmkr » Mon Dec 14, 2020 10:02 pm

slycrespo wrote:
Sat Dec 12, 2020 6:30 pm
The product is in one parrent and in on subcategory.
- products in category : 1
- products in sub-category : 1

-> total in category ( in category itself and in all sub-categories ) : 2
-> total in sub-category : 1
It's logical !

See code in module/category.php:

Code: Select all

		$filter_data = array('filter_category_id' => $child['category_id'], 'filter_sub_category' => true);

		$children_data[] = array(
			'category_id' => $child['category_id'],
			'name' => $child['name'] . ($this->config->get('config_product_count') ? ' (' . $this->model_catalog_product->getTotalProducts($filter_data) . ')' : ''),

User avatar
Active Member

Posts

Joined
Sat Jan 08, 2011 11:05 pm
Location - Netherlands

Post by slycrespo » Mon Dec 14, 2020 11:02 pm

So I have to change my code to this code to make it work properly?

New member

Posts

Joined
Tue Aug 28, 2012 7:41 am

Post by by mona » Mon Dec 14, 2020 11:44 pm

@pprmkr you are quite right - I have never noticed in all these years ! Learn something new everyday. Thank you

DISCLAIMER:
You should not modify core files .. if you would like to donate a cup of coffee I will write it in a modification for you.


Spinning Social : Links : Menus : Payments : Socials : Ads : Screen Backgrounds : Galleries : Headers : Banners : Promos


Active Member

Posts

Joined
Mon Jun 10, 2019 9:31 am

Post by slycrespo » Mon Dec 14, 2020 11:55 pm

@pprmkr, please explain that code you posted..

New member

Posts

Joined
Tue Aug 28, 2012 7:41 am

Post by pprmkr » Tue Dec 15, 2020 2:06 am

Follow the code in controller/module/category.php and loaded models ...
Explanation for used code on https://www.php.net/

User avatar
Active Member

Posts

Joined
Sat Jan 08, 2011 11:05 pm
Location - Netherlands

Post by slycrespo » Tue Dec 15, 2020 3:25 pm

I would be verry happy if someone would tell me exactly how this is done.

New member

Posts

Joined
Tue Aug 28, 2012 7:41 am
Who is online

Users browsing this forum: No registered users and 29 guests