Post by letxobnav » Sat Mar 16, 2019 12:30 pm

Not sure if this was addressed before...

in 3.0.2.0 it is still the practice for product searches to:

Code: Select all

			$product_total = $this->model_catalog_product->getTotalProducts($filter_data);
			$results = $this->model_catalog_product->getProducts($filter_data);
This means even if the $product_total equals zero we do the second query anyway.

I kindly suggest:

Code: Select all

			$product_total = $this->model_catalog_product->getTotalProducts($filter_data);
			if ($product_total > 0) {
				$results = $this->model_catalog_product->getProducts($filter_data);
			} else {
				$results = false;
			}

Crystal Light Centrum Taiwan


Active Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm

Post by IP_CAM » Sat Mar 16, 2019 12:49 pm

Well, a much more comfortable way, to avoid unnecessary queries,
would be, not to use any, if not required, i.E., by use of the famous
Cache Category Counting Extension: ;)
viewtopic.php?f=190&t=210525&p=749342#p749234
Ernie

For Sale: Turnkey URLs with Opencart installed
My latest Opencart LIGHT Testsite: http://www.bigmax.ch/
Attacker IP Blocks are denied from further access to my Sites!
Just contact me for more Information at: jti@jacob.ch
860+ FREE OC Extension-Repositories - from OC v.1.5.x up
on the largest Opencart-Mod Github Site: https://github.com/IP-CAM
Image


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by letxobnav » Sat Mar 16, 2019 1:15 pm

true, but I am always careful with caching as my filters are very dynamic, not showing when empty for instance, same for filter groups.
Not against queries, just the obvious unnecessary ones.

I think I have that DB cache extension but it seems it gives me error 500's over time and they disappear when I delete the cache file. Have not traced the cause yet though.

will check the other.

Crystal Light Centrum Taiwan


Active Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Who is online

Users browsing this forum: No registered users and 5 guests