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
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Expert Member

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan

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

My Github OC Site: https://github.com/IP-CAM
5'200 + FREE OC Extensions, on the World's largest private Github OC Repository Archive Site.


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
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Expert Member

Posts

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

Users browsing this forum: No registered users and 90 guests