<?xml version="1.0" encoding="utf-8"?>
<modification>
 <name><![CDATA[So Mobile - Opencart 3.x]]></name>
 <code>so-mobile</code>
 <version><![CDATA[1.1.0]]></version>
 <author><![CDATA[OpenCartWorks]]></author>
 <link>http://www.opencartworks.com/</link>
 
 <!--========Catalog/controller/common=============-->
 <file path="catalog/controller/common/home.php">
 <operation >
 <search ><![CDATA[$this->response->setOutput($this->load->view('common/home', $data));]]></search>
 <add position="replace"><![CDATA[
 $soconfig = $this->soconfig;
 $platforms_mobile = $soconfig->get_settings('platforms_mobile');
 if($this->session->data['device']=='mobile' && $platforms_mobile) $this->response->redirect($this->url->link('extension/mobile/home'));
 else $this->response->setOutput($this->load->view('common/home', $data));
 ]]></add>
 </operation>
 </file>
 
 <file path="catalog/controller/common/header.php">
 <operation >
 <search ><![CDATA[return $this->load->view('common/header', $data)]]></search>
 <add position="before"><![CDATA[
 $this->load->language('extension/soconfig/somobile');
 $data['objlang'] = $this->language;
 $data['lang_id'] = $this->config->get('config_language_id');
 $data['menu_search'] = $this->url->link('product/search', '', true);
 $data['mobile'] = $this->soconfig;
 $http = $_SERVER["HTTPS"] ? 'https://' : 'http://';
 $data['actual_link'] = $http."$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
 $data['text_items'] = sprintf($this->language->get('text_itemcount'), $this->cart->countProducts() + (isset($this->session->data['vouchers']) ? count($this->session->data['vouchers']) : 0));
 if($this->session->data['device']=='mobile'){
 $data['home'] = $this->url->link('extension/mobile/home');
 }else{
 $data['home'] = $this->url->link('common/home');
 }
 
 ]]></add>
 </operation>
 </file>
 
 <file path="catalog/controller/common/footer.php">
 <operation>
 <search ><![CDATA[return $this->load->view('common/footer', $data); ]]></search>
 <add position="before"><![CDATA[
 // Menu Mobile
 $this->load->model('catalog/category');
 $this->load->model('catalog/product');
 $this->load->language('extension/soconfig/somobile');
 $data['objlang'] = $this->language;
 $data['categories'] = array();
 $data['mobile'] = $this->soconfig;
 $data['lang_id'] = $this->config->get('config_language_id');
 $data['text_account'] = $this->language->get('text_account');
 $data['text_register'] = $this->language->get('text_register');
 $data['text_login'] = $this->language->get('text_login');
 
 $categories = $this->model_catalog_category->getCategories(0);
 
 
 foreach ($categories as $category) {
 if ($category['top']) {
 // Level 2
 $children_data = array();

 $children = $this->model_catalog_category->getCategories($category['category_id']);

 foreach ($children as $child) {
 $filter_data = array(
 'filter_category_id' => $child['category_id'],
 'filter_sub_category' => true
 );

 $children_data[] = array(
 'name' => $child['name'] . ($this->config->get('config_product_count') ? ' (' . $this->model_catalog_product->getTotalProducts($filter_data) . ')' : ''),
 'href' => $this->url->link('product/category', 'path=' . $category['category_id'] . '_' . $child['category_id'])
 );
 }

 // Level 1
 $data['categories'][] = array(
 'name' => $category['name'],
 'children' => $children_data,
 'column' => $category['column'] ? $category['column'] : 1,
 'href' => $this->url->link('product/category', 'path=' . $category['category_id'])
 );
 }
 }

 $data['language'] = $this->load->controller('common/language');
 $data['currency'] = $this->load->controller('common/currency');
 $data['search'] = $this->load->controller('common/search');
 $data['cart'] = $this->load->controller('common/cart');
 $data['wishlist'] = $this->url->link('account/wishlist', '', true);
 $data['compare'] = $this->url->link('product/compare', '', 'SSL');
 $data['text_compare'] = sprintf($this->language->get('text_compare'),(isset($this->session->data['compare']) ? count($this->session->data['compare']) : 0));
 $data['logged'] = $this->customer->isLogged();
 $data['account'] = $this->url->link('account/account', '', true);
 $data['register'] = $this->url->link('account/register', '', true);
 $data['login'] = $this->url->link('account/login', '', true);
 //Decodes HTML Entities
 $data['customfooter_text'] = html_entity_decode($data['soconfig']->get_settings('customfooter_text'), ENT_QUOTES, 'UTF-8');
 
 ]]></add>
 </operation>
 
 </file>
 <!--End Catalog/controller/common-->
 
 <!--Catalog/controller/product-->
 <file path="catalog/controller/product/category.php">
 <operation>
 <search ><![CDATA[$data['heading_title'] = $category_info['name']]]></search>
 <add position="before"><![CDATA[$data['mobile'] =$this->soconfig;]]></add>
 </operation>
 </file>
 <file path="catalog/controller/product/{search,special,manufacturer}*.php">
 <operation>
 <search ><![CDATA[$this->load->model('tool/image')]]></search>
 <add position="after"><![CDATA[$data['mobile'] = $this->soconfig;]]></add>
 </operation> 
 
 </file>
 
 <!--End Catalog/controller/product-->
 
</modification> 