Caches category data for Opencart 3.0 to make it faster. Opencart installs with alot of categories are really slow. http://forum.opencart.com/viewtopic.php?f=161&t=126241
<modification> | |
<id>Cache category data to speed up page load for store with many categories and sub categories.</id> | |
<version>1.0.1</version> | |
<vqmver>2.3.2</vqmver> | |
<author>Weismann Web - www.weismannweb.com</author> | |
<file name="catalog/controller/extension/module/category.php"> | |
<operation> | |
<search position="after"><![CDATA[ | |
foreach ($categories as $category) { | |
]]></search> | |
<add><![CDATA[ | |
$category_data = $this->cache->get('vqmod_category_data_controller_module_category_'.$data['category_id'].'_'.$this->config->get('config_store_id')); | |
if ($category_data) { | |
$data['categories'] = $category_data; | |
break; | |
} | |
]]></add> | |
</operation> | |
<operation> | |
<search position="replace"><![CDATA[ | |
return $this->load->view('extension/module/category', $data); | |
]]></search> | |
<add><![CDATA[ | |
if (empty($category_data)) { | |
$this->cache->set('vqmod_category_data_controller_module_category_'.$data['category_id'].'_'.$this->config->get('config_store_id'), $data['categories']); | |
} | |
return $this->load->view('extension/module/category', $data); | |
]]></add> | |
</operation> | |
</file> | |
<file name="catalog/controller/common/menu.php"> | |
<operation> | |
<search position="after"><![CDATA[ | |
foreach ($categories as $category) { | |
]]></search> | |
<add><![CDATA[ | |
$category_data = $this->cache->get('vqmod_category_data_controller_common_header'.$this->config->get('config_store_id')); | |
if ($category_data) { | |
$data['categories'] = $category_data; | |
break; | |
} | |
]]></add> | |
</operation> | |
<operation> | |
<search position="replace"><![CDATA[ | |
return $this->load->view('common/menu', $data); | |
]]></search> | |
<add><![CDATA[ | |
if (empty($category_data)) { | |
$this->cache->set('vqmod_category_data_controller_common_header'.$this->config->get('config_store_id'), $data['categories']); | |
} | |
return $this->load->view('common/menu', $data); | |
]]></add> | |
</operation> | |
</file> | |
</modification> |
This comment has been minimized.
This comment has been minimized.
Is there any similar exists for OC 1.5? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This comment has been minimized.
Well, I created this OcMod out of it, and had it tested by Austrian OC-Pro OSWorX,
but since a modern OcMod consists out of more than just a simple file, it would not make
much sense, to only publish the XML File here.
Thank you very much for this fine Job, I am using your 1.5.x Version for a long time already!
Best regards,
Ernie - IP_CAM
download cache_categories_Oc;Mod for OC v.3.0.2.x