<?xml version="1.0" encoding="utf-8"?>
<modification>
 <name><![CDATA[So ThemeConfig]]></name>
 <code>ocmod-soconfig</code>
 <version><![CDATA[3.0.0]]></version>
 <author><![CDATA[OpenCartWorks]]></author>
 <link>http://www.opencartworks.com</link>
 
<!--========Catalog/controller/common=============-->
 <file path="catalog/controller/common/language.php">
 <operation>
 <search ><![CDATA[$data['languages'] = array();]]></search>
 <add position="after"><![CDATA[
 if (isset($this->request->get['lang']) && $this->request->get['lang'] == 'ar-ar') {
 $this->session->data['language'] = $this->request->get['lang'];
 $this->response->redirect($this->url->link('common/home'));
 }
 ]]></add>
 </operation>
 </file>
 
 <file path="catalog/controller/common/cart.php">
 <operation >
 <search ><![CDATA[public function index()]]></search>
 <add position="after" offset="2"><![CDATA[
 /*======Show Themeconfig=======*/
 $this->load->language('extension/soconfig/cart');
 $data['objlang'] = $this->language;
 ]]></add>
 </operation>
 </file>
 <file path="catalog/controller/common/{header,footer}*.php">
 <operation >
 <search ><![CDATA[public function index()]]></search>
 <add position="after"><![CDATA[
 /*======Show Themeconfig=======*/
 $data['soconfig'] = $this->soconfig;
 $this->load->language('extension/soconfig/compare');
 $data['objlang'] = $this->language;
 $data['theme_directory'] = $this->config->get('theme_default_directory');
 $data['url_layoutbox'] = isset($this->request->get['layoutbox']) ? $this->request->get['layoutbox'] : '' ;
 $data['url_pattern'] = isset($this->request->get['pattern']) ? $this->request->get['pattern'] : '' ;
 $data['account_fb'] = isset($this->request->get['account_fb']) ? $this->request->get['account_fb'] : '' ;
 $data['compare'] = $this->url->link('product/compare', '', true);
 // add position
 $data['content_menu1'] = $this->load->controller('extension/soconfig/content_menu1');
 $data['content_menu2'] = $this->load->controller('extension/soconfig/content_menu2');
 $data['header_block'] = $this->load->controller('extension/soconfig/header_block');
 $data['search_block'] = $this->load->controller('extension/soconfig/search_block');
 
 $data['footer_block1'] = $this->load->controller('extension/soconfig/footer_block1');
 $data['footer_block2'] = $this->load->controller('extension/soconfig/footer_block2');
 $data['footer_block3'] = $this->load->controller('extension/soconfig/footer_block3');
 // For page specific css
 if (isset($this->request->get['route'])) {
 if (isset($this->request->get['product_id'])) {
 $class = '-' . $this->request->get['product_id'];
 } elseif (isset($this->request->get['path'])) {
 $class = '-' . $this->request->get['path'];
 } elseif (isset($this->request->get['manufacturer_id'])) {
 $class = '-' . $this->request->get['manufacturer_id'];
 } elseif (isset($this->request->get['information_id'])) {
 $class = '-' . $this->request->get['information_id'];
 } else {
 $class = '';
 }

 $data['class'] = str_replace('/', '-', $this->request->get['route']) . $class;
 } else {
 $data['class'] = 'common-home';
 }
 
 //Decodes HTML Entities
 $data['selector_body'] = html_entity_decode($data['soconfig']->get_settings('selector_body'), ENT_QUOTES, 'UTF-8');
 $data['selector_menu'] = html_entity_decode($data['soconfig']->get_settings('selector_menu'), ENT_QUOTES, 'UTF-8');
 $data['selector_heading'] = html_entity_decode($data['soconfig']->get_settings('selector_heading'), ENT_QUOTES, 'UTF-8');

 ]]></add>
 </operation>
 </file>
 <file path="catalog/controller/common/home.php">
 <operation >
 <search ><![CDATA[$data['header'] = $this->load->controller('common/header');]]></search>
 <add position="before"><![CDATA[
 $this->load->language('extension/soconfig/soconfig');
 $data['objlang'] = $this->language;
 ]]></add>
 </operation>
 
 </file>
 <file path="catalog/controller/common/home.php">
 <operation >
 <search ><![CDATA[public function index()]]></search>
 <add position="after"><![CDATA[
 $data['content_home'] = $this->load->controller('extension/soconfig/content_home');
 ]]></add>
 </operation>
 </file>
<!-- ==========catalog/controller/product=========-->
 <file path="catalog/controller/product/{search,special,manufacturer,category}*.php">
 <operation>
 <search ><![CDATA[public function index()]]></search>
 <add position="after"><![CDATA[
 /*=======Show Themeconfig=======*/
 $this->load->model('extension/soconfig/general');
 $this->load->language('extension/soconfig/soconfig');
 $data['objlang'] = $this->language;
 $data['soconfig'] = $this->soconfig;
 $data['theme_directory'] = $this->config->get('theme_default_directory');
 $data['our_url'] = $this->registry->get('url');
 ]]></add>
 </operation>
 
 <operation>
 <search ><![CDATA[$data['products'][] = array(]]></search>
 <add position="before"><![CDATA[
 if ((float)$result['special']) $discount = '-'.round((($result['price'] - $result['special'])/$result['price'])*100, 0).'%';
 else $discount = false;
 $images_2nd = $this->model_catalog_product->getProductImages($result['product_id']);
 if(isset($images_2nd[0]['image']) && !empty($images_2nd[0]['image'])) $images_2nd = $images_2nd[0]['image'];
 else $images_2nd = false;

 /*======Show Cookies List view=====*/
 if(isset($_COOKIE["listingType"]) && $_COOKIE["listingType"]){$data['listingType'] = $_COOKIE["listingType"]; }
 else{$data['listingType'] = $data['soconfig']->get_settings('product_catalog_mode') ? 'list' : 'grid';}


 
 /*======Check New Label=======*/
 $day_range = 30;
 $days = $data['soconfig']->get_settings('days');
 (empty($days)) ? $day = $day_range : $day = $days;
 $day_number_to_range = date( "Y-m-d",strtotime("-$day day") );
 if ($result['date_available'] >= $day_number_to_range) $data['day_number_boolean'] = true;
 else $data['day_number_boolean'] = false;
 ]]></add>
 </operation>
 <operation>
 <search><![CDATA[$data['products'][] = array]]></search>
 <add position="after" trim="true" offset="2"><![CDATA[
 'special_end_date' => $this->model_extension_soconfig_general->getDateEnd($result['product_id']),
 'href_quickview' => htmlspecialchars_decode($this->url->link('extension/soconfig/quickview&product_id='.$result['product_id'] )),
 'date_available' => $data['day_number_boolean'],
 'thumb2' => $this->model_tool_image->resize($images_2nd, $this->config->get('theme_' . $this->config->get('config_theme') . '_image_product_width'), $this->config->get('theme_' .$this->config->get('config_theme') . '_image_product_height')),
 'discount' => $discount,]]></add>
 </operation> 
 </file>
 <file path="catalog/controller/product/category.php">
 <operation >
 <search ><![CDATA[$data['categories'][] ]]></search>
 <add position="before"><![CDATA[
 if ($result['image']) $image = $this->model_tool_image->resize($result['image'], $this->config->get('theme_' .$this->config->get('config_theme') . '_image_category_width'), $this->config->get('theme_' .$this->config->get('config_theme') . '_image_category_height'));
 else $image = $this->model_tool_image->resize('placeholder.png', $this->config->get('theme_' .$this->config->get('config_theme') . '_image_category_width'),$this->config->get( 'theme_' .$this->config->get('config_theme') . '_image_category_height'));
 ]]>
 </add>
 </operation>
 <operation>
 <search ><![CDATA[$data['categories'][]]]></search>
 <add position="after"><![CDATA[ 'thumb' => $image,]]></add>
 </operation>
 </file>
 <file path="catalog/controller/product/manufacturer.php">
 <operation>
 <search ><![CDATA[public function info()]]></search>
 <add position="after"><![CDATA[
 /*=======Show Themeconfig=======*/
 $this->load->model('extension/soconfig/general');
 $this->load->language('extension/soconfig/soconfig');
 $data['objlang'] = $this->language;
 $data['soconfig'] = $this->soconfig;
 $data['theme_directory'] = $this->config->get('theme_default_directory');
 $data['our_url'] = $this->registry->get('url');
 ]]></add>
 </operation>
 </file>
 <file path="catalog/controller/product/product.php">
 <operation>
 <search ><![CDATA[public function index()]]></search>
 <add position="after"><![CDATA[
 /*=======Show Themeconfig=======*/
 $this->load->model('extension/soconfig/general');
 $this->load->language('extension/soconfig/soconfig');
 $data['objlang'] = $this->language;
 $data['soconfig'] = $this->soconfig;
 $data['theme_directory'] = $this->config->get('theme_default_directory');
 $data['our_url'] = $this->registry->get('url');
 $direction = $this->language->get('direction');
 $data['direction'] = $this->language->get('direction') == 'rtl' ? 'yes' : 'no' ;
 
 ]]></add>
 </operation>
 <operation error="skip">
 <search ><![CDATA[$this->document->addScript('catalog/view/javascript/jquery/magnific/jquery.magnific-popup.min.js');]]></search>
 <add position="replace"><![CDATA[
 $this->document->addScript('catalog/view/javascript/soconfig/js/jquery.elevateZoom-3.0.8.min.js');
 $this->document->addScript('catalog/view/javascript/soconfig/js/lightslider.js');
 ]]></add>
 </operation>
 <operation error="skip">
 <search ><![CDATA[$this->document->addStyle('catalog/view/javascript/jquery/magnific/magnific-popup.css');]]></search>
 <add position="replace"><![CDATA[$this->document->addStyle('catalog/view/javascript/soconfig/css/lightslider.css');]]></add>
 </operation>
 <operation>
 <search ><![CDATA[$data['options'] = array();]]></search>
 <add position="before"><![CDATA[
 if ((float)$product_info['special']) $data['discount'] = '-'.round((($product_info['price'] - $product_info['special'])/$product_info['price'])*100, 0).'%';
 else $data['discount'] = false;
 
 /*======Check New Label=======*/
 $day_range = 30;
 $days = $data['soconfig']->get_settings('days');
 (empty($days)) ? $day = $day_range : $day = $days;
 $day_number_to_range = date( "Y-m-d",strtotime("-$day day") );
 if ($product_info['date_available'] >= $day_number_to_range) $data['day_number_boolean'] = true;
 else $data['day_number_boolean'] = false;

 /*====== insert image to the beginning of array=======*/
 
 $firstimg = array('popup' => $data['popup'],'thumb' => $data['thumb']);
 array_unshift($data['images'], $firstimg);
 
 ]]></add>
 </operation>
 <operation>
 <search ><![CDATA[$data['products'][] = array(]]></search>
 <add position="before"><![CDATA[
 if ((float)$result['special']) $discount = '-'.round((($result['price'] - $result['special'])/$result['price'])*100, 0).'%';
 else $discount = false;

 /*======Check New Label=======*/
 $day_range = 30;
 $days = $data['soconfig']->get_settings('days');
 (empty($days)) ? $day = $day_range : $day = $days;
 $day_number_to_range = date( "Y-m-d",strtotime("-$day day") );
 if ($result['date_available'] >= $day_number_to_range) $data['day_number_boolean'] = true;
 else $data['day_number_boolean'] = false;
 ]]></add>
 </operation>
 <operation>
 <search><![CDATA[$data['products'][] = array]]></search>
 <add position="after" trim="true" offset="2"><![CDATA[
 'special_end_date' => $this->model_extension_soconfig_general->getDateEnd($product_info['product_id']),
 'date_available' => $data['day_number_boolean'],
 'discount' => $discount,]]></add>
 </operation> 
 </file>

<!-- =======system/engine/router===============-->
 <file path="system/engine/router.php">
 <operation>
 <search ><![CDATA[while ($action instanceof Action)]]></search>
 <add position="before"><![CDATA[
 require_once(dirname(DIR_APPLICATION).'/admin/view/template/extension/soconfig/class/soconfig.php');
 $soconfig = new Soconfig($this->registry);
 $this->registry->set('soconfig', $soconfig);
 ]]></add>
 </operation>
 </file>
<!-- ======= Show admin/controller==========-->
 <file path="admin/controller/design/layout.php">
 <operation >
 <search ><![CDATA[public function index()]]></search>
 <add position="before" offset="3"><![CDATA[require_once (DIR_APPLICATION.'view/template/extension/soconfig/class/so_field.php');]]></add>
 </operation>
 <operation >
 <search ><![CDATA[design/layout_form]]></search>
 <add position="before"><![CDATA[
 // Add Field Position
 $fields = new So_Fields($data);
 $data['fields'] = $fields;
 ]]></add>
 </operation>
 <operation >
 <search ><![CDATA[design/layout_form]]></search>
 <add position="replace"><![CDATA[extension/soconfig/layout_form]]></add>
 </operation>
 </file>
 
 
<!-- ======= Show Menu Opencart For Navigation==========-->
 <file path="admin/controller/common/column_left.php">
 <operation>
 <search><![CDATA[$design = array();]]></search>
 <add position="before"><![CDATA[
 $magentech = array();
 if ($this->user->hasPermission('access', 'extension/module/soconfig')) { 
 $magentech[] = array(
 'name' => 'So Themes Config',
 'href' => $this->url->link('extension/module/soconfig', 'user_token=' . $this->session->data['user_token'], true),
 'children' => array()
 );
 }
 if ($this->user->hasPermission('access', 'extension/module/somobile')) { 
 $magentech[] = array(
 'name' => 'So Mobile',
 'href' => $this->url->link('extension/module/somobile', 'user_token=' . $this->session->data['user_token'], true),
 'children' => array()
 );
 }
 if ($this->user->hasPermission('access', 'extension/module/so_page_builder')) { 
 $magentech[] = array(
 'name' => 'So Page Builder',
 'href' => $this->url->link('extension/module/so_page_builder', 'user_token=' . $this->session->data['user_token'], true),
 'children' => array()
 );
 }
 if ($this->user->hasPermission('access', 'extension/module/so_megamenu')) { 
 $magentech[] = array(
 'name' => 'So Mega Menu',
 'href' => $this->url->link('extension/module/so_megamenu', 'user_token=' . $this->session->data['user_token'], true),
 'children' => array()
 );
 }
 if ($this->user->hasPermission('access', 'extension/module/so_searchpro')) { 
 $magentech[] = array(
 'name' => 'So Search Pro',
 'href' => $this->url->link('extension/module/so_searchpro', 'user_token=' . $this->session->data['user_token'], true),
 'children' => array()
 );
 }
 if ($this->user->hasPermission('access', 'extension/module/so_html_content')) { 
 $magentech[] = array(
 'name' => 'So Html Content',
 'href' => $this->url->link('extension/module/so_html_content', 'user_token=' . $this->session->data['user_token'], true),
 'children' => array()
 );
 }
 if ($this->user->hasPermission('access', 'extension/module/so_home_slider')) { 
 $magentech[] = array(
 'name' => 'So Home Slider',
 'href' => $this->url->link('extension/module/so_home_slider', 'user_token=' . $this->session->data['user_token'], true),
 'children' => array()
 );
 }
 /*if ($this->user->hasPermission('access', 'extension/module/so_filter_shop_by')) { 
 $magentech[] = array(
 'name' => 'So Filter Shop By',
 'href' => $this->url->link('extension/module/so_filter_shop_by', 'user_token=' . $this->session->data['user_token'], true),
 'children' => array()
 );
 }*/
 if ($this->user->hasPermission('access', 'extension/module/so_newletter_custom_popup')) { 
 $magentech[] = array(
 'name' => 'So Newletter',
 'href' => $this->url->link('extension/module/so_newletter_custom_popup', 'user_token=' . $this->session->data['user_token'], true),
 'children' => array()
 );
 }
 if ($this->user->hasPermission('access', 'extension/module/so_deals')) { 
 $magentech[] = array(
 'name' => 'So Deals',
 'href' => $this->url->link('extension/module/so_deals', 'user_token=' . $this->session->data['user_token'], true),
 'children' => array()
 );
 }
 if ($this->user->hasPermission('access', 'extension/module/so_extra_slider')) { 
 $magentech[] = array(
 'name' => 'So Extra Slider',
 'href' => $this->url->link('extension/module/so_extra_slider', 'user_token=' . $this->session->data['user_token'], true),
 'children' => array()
 );
 }
 if ($this->user->hasPermission('access', 'extension/module/so_sociallogin')) { 
 $magentech[] = array(
 'name' => 'So Social Login',
 'href' => $this->url->link('extension/module/so_sociallogin', 'user_token=' . $this->session->data['user_token'], true),
 'children' => array()
 );
 }
 if ($this->user->hasPermission('access', 'extension/module/so_listing_tabs')) { 
 $magentech[] = array(
 'name' => 'So Listing Tabs',
 'href' => $this->url->link('extension/module/so_listing_tabs', 'user_token=' . $this->session->data['user_token'], true),
 'children' => array()
 );
 }
 if ($this->user->hasPermission('access', 'extension/module/so_popular_tags')) { 
 $magentech[] = array(
 'name' => 'So Popular Tags',
 'href' => $this->url->link('extension/module/so_popular_tags', 'user_token=' . $this->session->data['user_token'], true),
 'children' => array()
 );
 }
 if ($this->user->hasPermission('access', 'extension/module/so_super_category')) { 
 $magentech[] = array(
 'name' => 'So Super Category',
 'href' => $this->url->link('extension/module/so_super_category', 'user_token=' . $this->session->data['user_token'], true),
 'children' => array()
 );
 }
 if ($this->user->hasPermission('access', 'extension/module/so_quickview')) { 
 $magentech[] = array(
 'name' => 'So Quickview',
 'href' => $this->url->link('extension/module/so_quickview', 'user_token=' . $this->session->data['user_token'], true),
 'children' => array()
 );
 }
 if ($this->user->hasPermission('access', 'extension/module/so_onepagecheckout')) { 
 $magentech[] = array(
 'name' => 'So Onepage Checkout',
 'href' => $this->url->link('extension/module/so_onepagecheckout', 'user_token=' . $this->session->data['user_token'], true),
 'children' => array()
 );
 }
 
 if ($this->user->hasPermission('access', 'extension/module/so_countdown')) { 
 $magentech[] = array(
 'name' => 'So Countdown Popup',
 'href' => $this->url->link('extension/module/so_countdown', 'user_token=' . $this->session->data['user_token'], true),
 'children' => array()
 );
 }
 if ($this->user->hasPermission('access', 'extension/module/so_latest_blog')) { 
 $magentech[] = array(
 'name' => 'So Latest Blog',
 'href' => $this->url->link('extension/module/so_latest_blog', 'user_token=' . $this->session->data['user_token'], true),
 'children' => array()
 );
 }
 if ($magentech) { 
 $data['menus'][] = array(
 'id' => 'menu-magentech',
 'icon' => 'fa-cubes icon-so', 
 'name' => 'OpenCartWorks',
 'href' => '',
 'children' => $magentech
 ); 
 }
 
 ]]></add>
 
 </operation>
 </file>
</modification> 