Post by xinxilas » Tue Mar 27, 2018 11:38 am

I have a lot of Categories, so it slowed down my site.

So i read here to disable categories count , it woked, but i like categories count , is there any way to count categories with an trigger and saves each categories count?

Thank you, Renato!

New member

Posts

Joined
Mon Apr 27, 2015 7:46 am

Post by IP_CAM » Tue Mar 27, 2018 12:34 pm

Well, some Mod's exist for this, at least for OC 1.5.x Versions. But I just compared a v.3.0.2.x
D:\... \OC_3.0.2.0\catalog\model\catalog\product.php File with my Version File,
and I found exactly the same Routine, as it exists in my v.1.5.6.x Version File:
OC Version v.3.0.2.x:

Code: Select all

		$query = $this->db->query($sql);

		return $query->row['total'];
	}
compared to:
DEFAULT OC v.1.5.6.5_rc File Content:

Code: Select all

		$query = $this->db->query($sql);

	return $query->row['total'];
}
In my OC v.1.5.6.5_rc, I implemented the NEW CACHE Code like shown below,
but with OC v.3.x, I don't believe, that this md5 and possibly $this-> still
works, but it should be a clacks for a Coder, to make this work in OC 2 + 3.x
Versions as well.

It's a highly efficient way, to speed up a system, in the most simple way. Another
Fix add's all Cat's and their 'Values' into one single File, then also placed in the
Cache Folder, but this way of doing it takes TWO steps, to get the RESULT, compared
with this very simple 1-step Flatfile-data way of doing it, so, one saves another
microsecond, and so keeps the prozessor a little cooler as well... :laugh:
( but don't worry, that's just small minded Swiss perfectionist thinking... ::) )

But by use of such a Modification, there is no more difference in Pageload speed,
regardless of, if Category Counting is on or off. And I like to 'keep' it on too!
---
MODIFIED OC Version 1.5.6.x :

Code: Select all

// JTI MOD  Category Product Numbers Cache
	//	$query = $this->db->query($sql);
	//  return $query->row['total'];

	$cacheid='product.gettotalproducts.'.md5($sql).(int)$customer_group_id;
	$total=$this->cache->get($cacheid);
	if ($total === null ) {
	$query = $this->db->query($sql);
		$total = $query->row['total'];
		$this->cache->set($cacheid,$total);
   }
	return $total;
}
// END JTI MOD Category Product Numbers Cache
I just hope, that someone will be willing, to make it work for you, and
probably a few others...
Good Luck ! ;)
Ernie
---
Source:
http://octurbo.com/caching-opencarts-category-counts/
---
The other 1.5.6.x Count Caching Solution from genious Weismann Web:
https://gist.github.com/weismannweb/a16 ... 89ca1d1209
---
Image

Attachments

opencart_cache_category_products.jpg

opencart_cache_category_products.jpg (119.71 KiB) Viewed 470 times

Last edited by IP_CAM on Wed Mar 28, 2018 1:37 am, edited 1 time in total.

For Sale: Top URL's, including OpenCart V-Pro installed, like seen here:
http://www.bigmax.ch - http://www.ipcam.li - http://www.opencart.li
For Information + URL's offered, please contact me at: jti@jacob.ch
I am NOT available for Custom Support in existing OC Installations!
My Github Repositories: https://github.com/IP-CAM
Image


User avatar
Guru Member

Posts

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

Post by xinxilas » Tue Mar 27, 2018 8:42 pm

big thanks, ill give a try!

New member

Posts

Joined
Mon Apr 27, 2015 7:46 am
Who is online

Users browsing this forum: rod4OpenCart and 17 guests