Page 1 of 1

Turn off Opencart Cache in v3

Posted: Fri Aug 04, 2017 3:39 am
by tomroguk
Hi all,
Thought I would share a top tip for developers/theme editors if you weren't aware already. You can turn off Opencart cache.

When in the dashboard after logging in, hit the gear icon top right of the page and turn both cache's off.

Took a while for me to find this so hopefully it helps someone.
I found this article helpful: https://webocreation.com/blog/opencart- ... loper-tips

Re: Turn off Opencart Cache in v3

Posted: Fri Aug 04, 2017 5:18 am
by JNeuhoff
Thanks, useful to know.

Re: Turn off Opencart Cache in v3

Posted: Sat Aug 05, 2017 3:50 am
by sputnik-1
Thanks tomroguk

That's just what I was looking to do.

Re: Turn off Opencart Cache in v3

Posted: Fri Feb 22, 2019 10:14 am
by webbernaut
Doesn't seem to work for me. Turned them off and template is still caching. Only way I can see new changes is go through their editor. Which as a developer is total waste of time.

Re: Turn off Opencart Cache in v3

Posted: Wed Feb 27, 2019 4:50 pm
by letxobnav
I just call this function in startup.php controller ( only when I am developing).
It clears the caches.

Code: Select all

/* reset_cache() deletes theme cache only */
/* reset_cache('all') deletes theme and file caches */
function reset_cache ($scope = 'theme') {
	// delete theme cache files
	$directories = glob(DIR_CACHE . '*', GLOB_ONLYDIR);
	if ($directories) {
		foreach ($directories as $directory) {
			$files = glob($directory . '/*');
			foreach ($files as $file) {
				if (is_file($file)) unlink($file);
			}
			if (is_dir($directory)) rmdir($directory);
		}
	}
	// delete normal cache files (categories, filters, etc
	if ($scope == 'all') {
		$files = glob(DIR_CACHE . '*.*');
		foreach ($files as $file) {
			if (is_file($file)) unlink($file);
		}		
	}
}

Re: Turn off Opencart Cache in v3

Posted: Wed Feb 27, 2019 8:54 pm
by straightlight
Take note from the above code suggestion that is only clears the theme part but not the sass part of the cache as compared to the admin dashboard.

Re: Turn off Opencart Cache in v3

Posted: Wed Feb 27, 2019 10:41 pm
by letxobnav
True but I have only seen SASS working to create bootstrap css files in admin, not seen any sass cache files on the catalog side being created.
Then again I am a novice on SASS.

In any event, the dashboard cache control panel does not have a button to clear the filters, catalog, language, currency, etc. cache files.

Re: Turn off Opencart Cache in v3

Posted: Wed Feb 27, 2019 11:33 pm
by straightlight
In any event, the dashboard cache control panel does not have a button to clear the filters, catalog, language, currency, etc. cache files.
Hopefully not. Otherwise, it would be unthinkable on the mount of extensions unrelated to those events that would be affected.

Re: Turn off Opencart Cache in v3

Posted: Thu Feb 28, 2019 1:20 am
by letxobnav
love to read your elaboration on this.