-
-
Save IP-CAM/410aaa249b9e82d52608e6159ea21eaa to your computer and use it in GitHub Desktop.
Cache Category Data VqMod for Opencart v.3.x to make it faster. http://forum.opencart.com/viewtopic.php?f=161&t=126241
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment