Post by billynoah » Sat Mar 08, 2014 3:09 am

This has come up a bunch of times and thought it worth mentioning. Line 120 (in OC 1.5.6) in the header loops through that product count function regardless of the system setting. To improve speed in cases where product count is turned off, I changed this:

Code: Select all

$product_total = $this->model_catalog_product->getTotalProducts($data);
to

Code: Select all

$product_total = $this->config->get('config_product_count') ? $this->model_catalog_product->getTotalProducts($data) : '';
On a site I was working on recently which has lots of categories this function ends up getting called hundreds of times to count through thousands of products unnecessarily. Now it doesn't and site is much faster.

Any thoughts?

If there are no objections I would propose some sort of implementation of the above in the next release.

Image


User avatar
Active Member

Posts

Joined
Tue Jan 15, 2013 12:46 pm

Post by butte » Thu Mar 20, 2014 5:26 pm

That seems a good approach. However, I wonder how many of us who are already given to silencing the product counts would be happy to see them outright gone (poof). They slow the Gewerken, they potentially cause or worsen database surges, and they satisfy idle curiosity about trivia. In a restaurant something along the lines of precounted
Breakfast (12)
Lunch (22)
Dinner (17)
Dessert (6)
Beverage (9)
would be an annoyance depriving me of something suitably useless to do while awaiting a waitress. On the other hand, product counts could be useful as an admin measure of balance among products. I wonder how many of us would like to see an admin query for a simple and quick (poke, zap) display of categories and product counts on one page once upon demand (solely). The latter would argue for removing from /catalog/ into /admin/, and from willy-nilly ongoing display to single-shot display solely upon admin demand, the product counts.

Guru Member

Posts

Joined
Wed Mar 20, 2013 6:58 am

Post by billynoah » Fri Mar 21, 2014 1:43 am

What I am proposing is that if they are turned off in the admin panel, and that no where in the header are they used then why make the query at all? It's pointless and a waste of server resources.

Any custom coding to display product counts on demand would be exactly that - custom. If you know enough to do so then you can easily call that function when you need it instead of having it called uselessly and counts just lingering in variables without a purpose.
Last edited by billynoah on Fri Mar 21, 2014 2:29 am, edited 1 time in total.

Image


User avatar
Active Member

Posts

Joined
Tue Jan 15, 2013 12:46 pm

Post by butte » Fri Mar 21, 2014 2:14 am

We're on the same page, preferably remove it from the storefront outright and not even turn it on and off in admin in the first place. What I posed is moreover inserting it, separately, in admin as a one-shot listing upon demand, for admin perusals (product balance is pragmatic) rather than for customer curiosities (frivolous). Many admins would bog down in databases and spreadsheets, where some of us would use those routinely. True, that admin insertion could be made individually, but if there's interest it could also be a core or vqmod .xml derivative (or spinoff) of the current wastefully ongoing displays.

Guru Member

Posts

Joined
Wed Mar 20, 2013 6:58 am
Who is online

Users browsing this forum: No registered users and 8 guests