<?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.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['lang_id'] = $this->config->get('config_language_id'); 
		 $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');
		
		// For page specific css
		if (isset($this->request->get['route'])) $data['class'] = str_replace('/', '-', $this->request->get['route']);
		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');
		$data['mselector_body'] = html_entity_decode($data['soconfig']->get_settings('mselector_body'), ENT_QUOTES, 'UTF-8');
         $data['mselector_menu'] = html_entity_decode($data['soconfig']->get_settings('mselector_menu'), ENT_QUOTES, 'UTF-8');
         $data['mselector_heading'] = html_entity_decode($data['soconfig']->get_settings('mselector_heading'), ENT_QUOTES, 'UTF-8');
		
		 if (!defined ('OWL_CAROUSEL')){ 
		 $this->document->addStyle('catalog/view/javascript/soconfig/css/owl.carousel.css'); 
		 $this->document->addScript('catalog/view/javascript/soconfig/js/owl.carousel.js'); 
		 define( 'OWL_CAROUSEL', 1 ); 
		 } 
		]]></add>
		</operation>
	</file>
	
	<file path="catalog/controller/common/footer.php">
		<operation >
			<search ><![CDATA[public function index()]]></search>
			<add position="after"><![CDATA[
		/*======Show Themeconfig=======*/
		$data['soconfig'] = $this->soconfig;
		$this->load->language('extension/soconfig/soconfig');
		$data['objlang'] = $this->language;
		$data['lang_id'] = $this->config->get('config_language_id');
		$data['theme_directory'] = $this->config->get('theme_default_directory');
		$data['account_fb'] = isset($this->request->get['account_fb']) ? $this->request->get['account_fb'] : '' ;
		$data['compare'] = $this->url->link('product/compare', '', true);
		$data['footer_block'] = $this->load->controller('extension/soconfig/footer_block');
		// add position
		if( $this->soconfig->get_settings('typefooter') == 1) $data['footer_block1'] = $this->load->controller('extension/soconfig/footer_block1');
		else if( $this->soconfig->get_settings('typefooter') == 2) $data['footer_block2'] = $this->load->controller('extension/soconfig/footer_block2');
	    else if( $this->soconfig->get_settings('typefooter') == 3)  $data['footer_block3'] = $this->load->controller('extension/soconfig/footer_block3');
	    else if( $this->soconfig->get_settings('typefooter') == 4)  $data['footer_block4'] = $this->load->controller('extension/soconfig/footer_block4');
	    else if( $this->soconfig->get_settings('typefooter') == 5)  $data['footer_block5'] = $this->load->controller('extension/soconfig/footer_block5');
	    else if( $this->soconfig->get_settings('typefooter') == 6)  $data['footer_block6'] = $this->load->controller('extension/soconfig/footer_block6');
	    else if( $this->soconfig->get_settings('typefooter') == 7)  $data['footer_block7'] = $this->load->controller('extension/soconfig/footer_block7');
	    else if( $this->soconfig->get_settings('typefooter') == 8)  $data['footer_block8'] = $this->load->controller('extension/soconfig/footer_block8');
		]]></add>
		</operation>
	</file>
	<file path="catalog/controller/common/maintenance.php">
		<operation >
			<search ><![CDATA[public function index()]]></search>
			<add position="after"><![CDATA[
				/*======Show Themeconfig=======*/
				$this->load->language('extension/soconfig/soconfig');
				$data['objlang'] = $this->language;
				$data['soconfig'] = $this->soconfig;
				if ($this->request->server['HTTPS']) $server = $this->config->get('config_ssl');
				else $server = $this->config->get('config_url');
				$data['config_logo'] = $server.'image/'.$this->config->get('config_logo');
				$data['comingsoon_content'] = html_entity_decode($data['soconfig']->get_settings('comingsoon_content'), ENT_QUOTES, 'UTF-8');	
                $data['content_comingsoon'] = $this->load->controller('extension/soconfig/content_soon');
			]]></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');
		/*=======url query parameters=======*/ 
		 $data['url_sidebarsticky'] = isset($this->request->get['sidebarsticky']) ? $this->request->get['sidebarsticky'] : '' ; 
		 $data['url_cartinfo'] = isset($this->request->get['cartinfo']) ? $this->request->get['cartinfo'] : '' ; 
		 $data['url_thumbgallery'] = isset($this->request->get['thumbgallery']) ? $this->request->get['thumbgallery'] : '' ; 
		 $data['url_listview'] = isset($this->request->get['listview']) ? $this->request->get['listview'] : '' ; 
		 $data['url_asidePosition'] = isset($this->request->get['asidePosition']) ? $this->request->get['asidePosition'] : '' ; 
		 $data['url_asideType'] = isset($this->request->get['asideType']) ? $this->request->get['asideType'] : '' ; 
		 $data['url_layoutbox'] = isset($this->request->get['layoutbox']) ? $this->request->get['layoutbox'] : '' ; 
		]]></add>
		</operation>
		
		<operation> 
		 <search ><![CDATA[$data['products'][] = array(]]></search> 
		 <add position="before"><![CDATA[ 
		 /*======Image Galleries=======*/ 
		 $data['image_galleries'] = array(); 
		 $image_galleries = $this->model_catalog_product->getProductImages($result['product_id']); 
		 foreach ($image_galleries as $image_gallery) { 
		 $data['image_galleries'][] = array( 
		 'cart' => $this->model_tool_image->resize($image_gallery['image'], $this->config->get('theme_' . $this->config->get('config_theme') . '_image_cart_width'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_cart_width')), 
		 'thumb' => $this->model_tool_image->resize($image_gallery['image'], $this->config->get('theme_' . $this->config->get('config_theme') . '_image_product_width'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_product_height')) 
		 ); 
		 } 
		 $data['first_gallery'] = array( 
		 'cart' => $this->model_tool_image->resize($result['image'], $this->config->get('theme_' . $this->config->get('config_theme') . '_image_cart_width'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_cart_width')), 
		 'thumb' => $this->model_tool_image->resize($result['image'], $this->config->get('theme_' . $this->config->get('config_theme') . '_image_product_width'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_product_height')) 
		 ); 
		 /*======Check New Label=======*/ 
		 if ((float)$result['special']) $discount = '-'.round((($result['price'] - $result['special'])/$result['price'])*100, 0).'%'; 
		 else $discount = false; 
		 
		 $sold = 0; 
		 if($this->model_extension_soconfig_general->getUnitsSold($result['product_id'])){ 
		 $sold = $this->model_extension_soconfig_general->getUnitsSold($result['product_id']); 
		 } 
		 
		 $data['orders'] = sprintf($this->language->get('text_product_orders'),$sold); 
		 $data['reviews'] = sprintf($this->language->get('text_reviews'), (int)$result['reviews']); 
		 ]]></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']), 
		 'image_galleries' => $data['image_galleries'], 
		 'first_gallery' => $data['first_gallery'], 
		 'discount' => $discount, 
		 'stock_status' => $result['stock_status'], 
		 'orders' => $data['orders'], 
		 'reviews' => $data['reviews'], 
		 'href_quickview' => htmlspecialchars_decode($this->url->link('extension/soconfig/quickview&product_id='.$result['product_id'] )), 
		 'quantity' => $result['quantity'],]]></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->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' ;
          	 /*=======url query parameters=======*/ 
			 $data['url_sidebarsticky'] = isset($this->request->get['sidebarsticky']) ? $this->request->get['sidebarsticky'] : '' ; 
			 $data['url_productGallery'] = isset($this->request->get['productGallery']) ? $this->request->get['productGallery'] : '' ; 
			 $data['url_asidePosition'] = isset($this->request->get['asidePosition']) ? $this->request->get['asidePosition'] : '' ; 
			 $data['url_asideType'] = isset($this->request->get['asideType']) ? $this->request->get['asideType'] : '' ; 
    		]]></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/jquery.sticky-kit.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['description'] = html_entity_decode($product_info['description'], ENT_QUOTES, 'UTF-8');]]></search>
			<add position="after"><![CDATA[
        		//custom code
				$this->load->model('extension/soconfig/general');
	        	$data['special_end_date'] = $this->model_extension_soconfig_general->getDateEnd($product_id);
				$limit = 250;
				$full_description =  html_entity_decode($product_info['description'], ENT_QUOTES, 'UTF-8');
				$product_description_short = (strlen($full_description) > $limit ? utf8_substr($full_description, 0, $limit) . '...' : $full_description);
				$data['description_short'] = strip_tags($product_description_short);
				//SEO Rich Snippets 

if ($this->customer->isLogged() || !$this->config->get('config_customer_price')) {
$data['price_value']=$this->tax->calculate($product_info['price'], $product_info['tax_class_id'], $this->config->get('config_tax'));
} else {
$data['price_value']=0;
}

if ((float)$product_info['special']) {
	$data['special_value'] = $this->tax->calculate($product_info['special'], $product_info['tax_class_id'], $this->config->get('config_tax'));
} else {
	$data['special_value'] = false;
}
$data['currency']=$this->session->data['currency'];
$data['count_reviews']=(int)$product_info['reviews'];
    			]]></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=======*/ 
		 $sold = 0; 
		 if($this->model_extension_soconfig_general->getUnitsSold($product_info['product_id'])){ 
		 $sold = $this->model_extension_soconfig_general->getUnitsSold($product_info['product_id']); 
		 } 

		 $data['orders'] = sprintf($this->language->get('text_product_orders'),$sold); 
		 /*====== 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; 
		 ]]></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']), 
		 'discount' => $discount,]]></add> 
		 </operation> 
		  <operation> 
		 <search><![CDATA[$data['images'] = array()]]></search> 
		 <add position="before" trim="true" ><![CDATA[ 
		  if ($product_info['image']) {
			$data['popup'] = $this->model_tool_image->resize($product_info['image'], $this->config->get('theme_' . $this->config->get('config_theme') . '_image_popup_width'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_popup_height'));
		} else {
			$data['popup'] = $this->model_tool_image->resize('placeholder.png', $this->config->get('theme_' . $this->config->get('config_theme') . '_image_popup_width'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_popup_height'));
		}

		if ($product_info['image']) {
			$data['thumb'] = $this->model_tool_image->resize($product_info['image'], $this->config->get('theme_' . $this->config->get('config_theme') . '_image_thumb_width'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_thumb_height'));
		} else {
			$data['thumb'] = $this->model_tool_image->resize('placeholder.png', $this->config->get('theme_' . $this->config->get('config_theme') . '_image_thumb_width'), $this->config->get('theme_' . $this->config->get('config_theme') . '_image_thumb_height'));
		}]]>
		</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[// Modules layout]]></search> 
 <add position="before"><![CDATA[ 
 /*===== Load CSS & JS ========== */ 
 if(!defined('DIR_SOCONFIG')) define('DIR_SOCONFIG','view/template/extension/soconfig/'); 
 $this->document->addScript(DIR_SOCONFIG.'asset/plugin/select2/js/select2.min.js'); 
 $this->document->addStyle(DIR_SOCONFIG.'asset/plugin/select2/css/select2.min.css'); 
 $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> 

</modification>                                                                                                                      