<modification>
	<id><![CDATA[cosyone theme]]></id>
	<version><![CDATA[1.0]]></version>
	<vqmver><![CDATA[2.X]]></vqmver>
	<author><![CDATA[Karl Pers - Openthemer.com]]></author>
	<file name="catalog/controller/common/home.php">
		<operation>
			<search position="before"><![CDATA[
			$data['column_left'] = $this->load->controller('common/column_left');
			]]></search>
			<add><![CDATA[
			$data['home_top_top'] = $this->load->controller('common/home_top_top');
			$data['home_top_left'] = $this->load->controller('common/home_top_left');
			$data['home_top_center'] = $this->load->controller('common/home_top_center');
			$data['home_top_right'] = $this->load->controller('common/home_top_right');
			$data['content_bottom_half'] = $this->load->controller('common/content_bottom_half');
			// Cosyone ends
		]]></add>
		</operation>
		</file>
		<file name="catalog/controller/common/header.php">
		<operation>
			<search position="before"><![CDATA[$this->load->language('common/header');]]></search>
			<add><![CDATA[		// cosyone custom code start
		$this->load->language('common/cosyone');
		$data['cosyone_text_mobile_menu'] = $this->language->get('cosyone_text_mobile_menu');
		// Cosyone ends
		]]></add>
		</operation>
		<operation>
			<search position="after"><![CDATA[
			$data['title'] = $this->document->getTitle();
			]]></search>
			<add><![CDATA[
			if ($this->config->get('cosyone_use_custom_font')) {
			$this->document->addStyle('//fonts.googleapis.com/css?family=' . $this->config->get('cosyone_font1_import'));
			$this->document->addStyle('//fonts.googleapis.com/css?family=' . $this->config->get('cosyone_font2_import'));
			} else {
			$this->document->addStyle('//fonts.googleapis.com/css?family=Roboto:300,400,500,600');
			$this->document->addStyle('//fonts.googleapis.com/css?family=Roboto+Slab:300,400,600,700');
			}
			$data['cosyone_styles'] = $this->load->controller('common/cosyone_styles');
			$data['cosyone_cookie'] = $this->load->controller('common/cosyone_cookie');	
			$data['header_login'] = $this->load->controller('common/header_login');
			$data['header_wishlist_compare'] = $this->load->controller('common/header_wishlist_compare');
			$data['cosyone_default_product_style'] = $this->config->get('cosyone_default_product_style');
			$data['cosyone_use_custom'] = $this->config->get('cosyone_use_custom');
			$data['cosyone_container_layout'] = $this->config->get('cosyone_container_layout');
			$data['cosyone_use_breadcrumb'] = $this->config->get('cosyone_use_breadcrumb');
			$data['cosyone_menu_sticky'] = $this->config->get('cosyone_menu_sticky');
			$data['cosyone_menu_border'] = $this->config->get('cosyone_menu_border');
			$data['cosyone_header_style'] = $this->config->get('cosyone_header_style');
			$data['cosyone_header_search'] = $this->config->get('cosyone_header_search');
			$data['cosyone_menu_mega_second_thumb'] = $this->config->get('cosyone_menu_mega_second_thumb');
			$data['cosyone_menu_block_width'] = $this->config->get('cosyone_menu_block_width');
			$data['cosyone_custom_menu_block'] = $this->config->get('cosyone_custom_menu_block');
			$data['cosyone_custom_menu_url1'] = $this->config->get('cosyone_custom_menu_url1');
			$data['cosyone_custom_menu_url2'] = $this->config->get('cosyone_custom_menu_url2');
			$cosyone_top_promo = $this->config->get('cosyone_top_promo_message');
			if(empty($cosyone_top_promo[$this->language->get('code')])) {
				$data['cosyone_top_promo_message'] = false;
			} else if (isset($cosyone_top_promo[$this->language->get('code')])) {
				$data['cosyone_top_promo_message'] = html_entity_decode($cosyone_top_promo[$this->language->get('code')], ENT_QUOTES, 'UTF-8');
			}
			$cosyone_menu_block_title = $this->config->get('cosyone_custom_menu_block_title');
			if(empty($cosyone_menu_block_title[$this->language->get('code')])) {
				$data['cosyone_custom_menu_block_title'] = false;
			} else if (isset($cosyone_menu_block_title[$this->language->get('code')])) {
				$data['cosyone_custom_menu_block_title'] = html_entity_decode($cosyone_menu_block_title[$this->language->get('code')], ENT_QUOTES, 'UTF-8');
			}
			$cosyone_menu_custom_block = $this->config->get('cosyone_menu_custom_block_content');
			if(empty($cosyone_menu_custom_block[$this->language->get('code')])) {
				$data['cosyone_menu_custom_block_content'] = false;
			} else if (isset($cosyone_menu_custom_block[$this->language->get('code')])) {
				$data['cosyone_menu_custom_block_content'] = html_entity_decode($cosyone_menu_custom_block[$this->language->get('code')], ENT_QUOTES, 'UTF-8');
			}
			$cosyone_menu_custom_link1 = $this->config->get('cosyone_custom_menu_title1');
			if(empty($cosyone_menu_custom_link1[$this->language->get('code')])) {
				$data['cosyone_custom_menu_title1'] = false;
			} else if (isset($cosyone_menu_custom_link1[$this->language->get('code')])) {
				$data['cosyone_custom_menu_title1'] = html_entity_decode($cosyone_menu_custom_link1[$this->language->get('code')], ENT_QUOTES, 'UTF-8');
			}
			$cosyone_menu_custom_link2 = $this->config->get('cosyone_custom_menu_title2');
			if(empty($cosyone_menu_custom_link2[$this->language->get('code')])) {
				$data['cosyone_custom_menu_title2'] = false;
			} else if (isset($cosyone_menu_custom_link2[$this->language->get('code')])) {
				$data['cosyone_custom_menu_title2'] = html_entity_decode($cosyone_menu_custom_link2[$this->language->get('code')], ENT_QUOTES, 'UTF-8');
			}
			$data['cosyone_show_home_icon'] = $this->config->get('cosyone_show_home_icon');
			$data['cosyone_max_width'] = $this->config->get('cosyone_max_width');
			$data['cosyone_use_responsive'] = $this->config->get('cosyone_use_responsive');
			$data['cosyone_header_cart'] = $this->config->get('cosyone_header_cart');
			// Cosyone ends
		]]></add>
		</operation>
		
		<operation>
			<search position="replace" offset="29"><![CDATA[$categories = $this->model_catalog_category->getCategories(0);]]></search>
			<add><![CDATA[// Custom categories starts
		// Add current class for active categories
		if (isset($this->request->get['path'])) {
			$parts = explode('_', (string)$this->request->get['path']);
		} else {
			$parts = array();
		}
		
		if (isset($parts[0])) {
			$data['category_1_id'] = $parts[0];
		} else {
			$data['category_1_id'] = 0;
		}
					
		$categories_1 = $this->model_catalog_category->getCategories(0);
		$this->load->model('tool/image');
		foreach ($categories_1 as $category_1) {
		if ($category_1['top']) {
			$level_2_data = array();
			$categories_2 = $this->model_catalog_category->getCategories($category_1['category_id']);
			foreach ($categories_2 as $category_2) {
				$level_3_data = array();

				// Third level
				$categories_3 = $this->model_catalog_category->getCategories($category_2['category_id']);

				foreach ($categories_3 as $category_3) {
					
					$total = $this->model_catalog_product->getTotalProducts(array('filter_category_id'  => $category_3['category_id']));

					$level_3_data[] = array(
					'name' => $category_3['name'] .($this->config->get('config_product_count') ?  ' (' . $total . ')' : ''),
					'href' => $this->url->link('product/category', 'path=' . $category_1['category_id'] . '_' . $category_2['category_id'] . '_' . $category_3['category_id'])
					);
				 } 
				
				// Second level
				$categories_2 = $this->model_catalog_category->getCategories(0);
				
				$total = $this->model_catalog_product->getTotalProducts(array('filter_category_id'  => $category_2['category_id'], 'filter_sub_category' => true));
				
        		if ($category_2['image']) {
				$category_2_image = $this->model_tool_image->resize($category_2['image'], $this->config->get('cosyone_menu_mega_second_image_w'), $this->config->get('cosyone_menu_mega_second_image_h'));
				} else {
				$category_2_image = '';
				}
				$level_2_data[] = array(
					'name'    	=> $category_2['name']  .($this->config->get('config_product_count') ?  '<span>' . ' (' . $total . ')' . '</span>' : ''),
					'thumb' 	=> $category_2_image,
					'children'	=> $level_3_data,
					'href'    	=> $this->url->link('product/category', 'path=' . $category_1['category_id'] . '_' . $category_2['category_id'])
				);					
		}
			
				// First level
			$data['categories'][] = array(
				'category_1_id' => $category_1['category_id'],
				'column'   => $category_1['column'] ? $category_1['column'] : 1,
				'name'     => $category_1['name'],
				'children' => $level_2_data,
				'href'     => $this->url->link('product/category', 'path=' . $category_1['category_id'])
			);
		}
	}
	// Custom categories ends
	]]></add>
		</operation>
	</file>
	<file name="catalog/controller/product/product.php">
	<operation>
			<search position="after"><![CDATA[$this->load->model('tool/image');]]></search>
			<add><![CDATA[
			if (file_exists('catalog/view/theme/cosyone/js/countdown/jquery.countdown_' . $this->language->get('code') . '.js')) {
			$this->document->addScript('catalog/view/theme/cosyone/js/countdown/jquery.countdown_' . $this->language->get('code') . '.js');
			} else {
			$this->document->addScript('catalog/view/theme/cosyone/js/countdown/jquery.countdown_en.js');
			}
			$data['direction'] = $this->language->get('direction');
			]]></add>
		</operation>
		<operation error="skip">
			<search position="replace"><![CDATA[
			$this->document->addScript('catalog/view/javascript/jquery/magnific/jquery.magnific-popup.min.js');
			]]></search>
			<add></add>
		</operation>
		<operation error="skip">
			<search position="replace"><![CDATA[
			$this->document->addStyle('catalog/view/javascript/jquery/magnific/magnific-popup.css');
			]]></search>
			<add></add>
		</operation>
		<operation>
			<search position="after"><![CDATA[
			$data['special'] = $this->currency->format($this->tax->calculate($product_info['special'], $product_info['tax_class_id'], $this->config->get('config_tax')));
			]]></search>
			<add><![CDATA[
			  $data['sales_percantage_main'] = round((($product_info['price'] - $product_info['special']) / $product_info['price'] * 100));
			  // Cosyone ends
			   ]]></add>
		</operation>		
		<operation>
			<search position="before"><![CDATA[$data['products'][] = array(]]></search>
			<add><![CDATA[
			  if ((float)$result['special']) {
				$sales_percantage = ((($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax')))-($this->tax->calculate($result['special'], $result['tax_class_id'], $this->config->get('config_tax'))))/(($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax')))/100));
				} else {
				$sales_percantage = false;
				}
				// Cosyone ends
			   ]]></add>
		</operation>
		<operation>
			<search position="before"><![CDATA[
			$discounts = $this->model_catalog_product->getProductDiscounts($this->request->get['product_id']);
			]]></search>
			<add><![CDATA[
			// Cosyone start
			$data['cosyone_product_zoom'] = $this->config->get('cosyone_product_zoom');
				$data['cosyone_product_share'] = $this->config->get('cosyone_product_share');
				$data['cosyone_percentage_sale_badge'] = $this->config->get('cosyone_percentage_sale_badge');
				$data['cosyone_product_yousave'] = $this->config->get('cosyone_product_yousave');
				$cosyone_quicklook = $this->config->get('cosyone_text_ql');
				if(empty($cosyone_quicklook[$this->language->get('code')])) {
					$data['cosyone_text_ql'] = false;
				} else if (isset($cosyone_quicklook[$this->language->get('code')])) {
					$data['cosyone_text_ql'] = html_entity_decode($cosyone_quicklook[$this->language->get('code')], ENT_QUOTES, 'UTF-8');
				}
				$data['cosyone_product_countdown'] = $this->config->get('cosyone_product_countdown');
				$data['cosyone_product_hurry'] = $this->config->get('cosyone_product_hurry');
				$data['cosyone_image_options'] = $this->config->get('cosyone_image_options');
				$data['cosyone_grid_related'] = $this->config->get('cosyone_grid_related');
				$data['cosyone_brand'] = $this->config->get('cosyone_brand');
			if ((float)$product_info['special']) {
    		$special_info = $this->model_catalog_product->getSpecialPriceEnd($product_id);
        	$data['special_date_end'] = strtotime($special_info['date_end']) - time();
			$data['yousave'] = $this->currency->format(($this->tax->calculate($product_info['price'], $product_info['tax_class_id'], $this->config->get('config_tax')))-($this->tax->calculate($product_info['special'], $product_info['tax_class_id'], $this->config->get('config_tax'))));
			
    		} else {
        	$data['special_date_end'] = false;
    		}
			$this->load->language('common/cosyone');
			$data['text_special_price'] = $this->language->get('text_special_price');
			$data['text_old_price'] = $this->language->get('text_old_price');
			$data['text_you_save'] = $this->language->get('text_you_save');
			$data['text_expire'] = $this->language->get('text_expire');
			$data['text_items_sold'] = sprintf($this->language->get('text_items_sold'), $this->model_catalog_product->getItemsSold($product_id));
			$data['data_qty'] = $product_info['quantity'];
			$data['text_stock_quantity'] = sprintf($this->language->get('text_stock_quantity'), $product_info['quantity']);
			$data['count_reviews'] = $product_info['reviews'];
			$data['thumb_width'] = $this->config->get('config_image_thumb_width');
			$data['additional_width'] = $this->config->get('config_image_additional_width');
			$data['additional_height'] = $this->config->get('config_image_additional_height');
			$data['currency_code'] = $this->currency->getCode();
			$data['lang'] = $this->language->get('code');
			
			// Cosyone end
			   ]]></add>
		</operation>
		<operation>
			<search position="after"><![CDATA['special'     => $special,]]></search>
			<add><![CDATA[
			 'sales_percantage' => number_format($sales_percantage, 0, ',', '.'),
			 'brand_name' 	 => $result['manufacturer'],
			// Cosyone ends
			   ]]></add>
		</operation>
		<operation>
			<search position="before"><![CDATA[$data['images'] = array();]]></search>
			<add><![CDATA[// Start cloud zoom
if ($product_info['image']) {
$data['small'] = $this->model_tool_image->resize($product_info['image'], $this->config->get('config_image_additional_width'), $this->config->get('config_image_additional_height'));
} else {
$data['small'] = '';
}
// Cosyone ends
]]></add>
		</operation>
		<operation>
			<search position="replace"><![CDATA['thumb' => $this->model_tool_image->resize($result['image'], $this->config->get('config_image_additional_width'), $this->config->get('config_image_additional_height'))]]></search>
			<add><![CDATA[// Cloud zoom thumb start
'small' => $this->model_tool_image->resize($result['image'], $this->config->get('config_image_additional_width'), $this->config->get('config_image_additional_height')),
//Cloud zoom thumb ends
// New thumb function
'thumb' => $this->model_tool_image->resize($result['image'], $this->config->get('config_image_thumb_width'), $this->config->get('config_image_thumb_height'))
// Cosyone ends
]]></add>
		</operation>
	</file>
	<file name="catalog/language/*/common/cart.php" error="skip">
		<operation>
			<search position="before"><![CDATA[
			$_['text_recurring']
			]]></search>
			<add>
	$_['text_items'] = '&lt;i class=&quot;fa fa-shopping-cart&quot;&gt;&lt;/i&gt;&lt;span class=&quot;count&quot;&gt;%s&lt;/span&gt; &lt;span class=&quot;total contrast_font mobile_hide&quot;&gt;%s&lt;/span&gt;';
			</add>
		</operation>
	</file>
	<file name="catalog/language/*/checkout/cart.php" error="skip">
		<operation>
			<search position="before"><![CDATA[
			$_['error_stock']
			]]></search>
			<add>
	$_['text_items'] = '&lt;i class=&quot;fa fa-shopping-cart&quot;&gt;&lt;/i&gt;&lt;span class=&quot;count&quot;&gt;%s&lt;/span&gt; &lt;span class=&quot;total contrast_font mobile_hide&quot;&gt;%s&lt;/span&gt;';
			</add>
		</operation>
	</file>
	<file name="catalog/language/*/account/wishlist.php" error="skip">
		<operation>
			<search position="before"><![CDATA[
			$_['text_empty']
			]]></search>
			<add>
	$_['text_header_wishlist'] = '&lt;i class=&quot;fa fa-heart&quot;&gt;&lt;/i&gt;&lt;span class=&quot;count&quot;&gt;%s&lt;/span&gt;';
			</add>
		</operation>
	</file>
	<file name="catalog/language/*/product/compare.php" error="skip">
		<operation>
			<search position="before"><![CDATA[
			$_['text_empty']
			]]></search>
			<add>
	$_['text_header_compare'] = '&lt;i class=&quot;fa fa-arrow-right&quot;&gt;&lt;/i&gt;&lt;i class=&quot;fa fa-arrow-left&quot;&gt;&lt;/i&gt;&lt;span class=&quot;count&quot;&gt;%s&lt;/span&gt;';
			</add>
		</operation>
	</file>
	<file name="catalog/controller/account/wishlist.php" error="log">
		<operation>
			<search position="after"><![CDATA[
			$json['total'] = sprintf($this->language->get('text_wishlist'), (isset($this->session->data['wishlist']) ? count($this->session->data['wishlist']) : 0));
			]]></search>
			<add>
	$json['wishlist_total'] = sprintf($this->language->get('text_header_wishlist'), (isset($this->session->data['wishlist']) ? count($this->session->data['wishlist']) : 0));
			</add>
		</operation>
	</file>
	<file name="catalog/controller/product/compare.php" error="log">
		<operation>
			<search position="after"><![CDATA[
			$json['total'] = sprintf($this->language->get('text_compare'), (isset($this->session->data['compare']) ? count($this->session->data['compare']) : 0));
			]]></search>
			<add>
	$json['compare_total'] = sprintf($this->language->get('text_header_compare'), (isset($this->session->data['compare']) ? count($this->session->data['compare']) : 0));
			</add>
		</operation>
	</file>
	<file name="catalog/controller/common/footer.php" error="log">
		<operation error="log">
			<search position="after"><![CDATA[
			$this->load->model('catalog/information');
			]]></search>
			<add>
			$data['live_search'] = $this->load->controller('module/d_ajax_search');
			$data['footer_modules'] = $this->load->controller('common/footer_modules');
			$cosyone_footer_block_title = $this->config->get('cosyone_footer_custom_block_title');
			if(empty($cosyone_footer_block_title[$this->language->get('code')])) {
				$data['cosyone_footer_custom_block_title'] = false;
			} else if (isset($cosyone_footer_block_title[$this->language->get('code')])) {
				$data['cosyone_footer_custom_block_title'] = html_entity_decode($cosyone_footer_block_title[$this->language->get('code')], ENT_QUOTES, 'UTF-8');
			}
			$data['cosyone_footer_payment_icon'] = $this->config->get('cosyone_footer_payment_icon');
			$data['cosyone_use_retina'] = $this->config->get('cosyone_use_retina');
			$cosyone_footer_block = $this->config->get('cosyone_footer_custom_block');
			if(empty($cosyone_footer_block[$this->language->get('code')])) {
				$data['cosyone_footer_custom_block'] = false;
			} else if (isset($cosyone_footer_block[$this->language->get('code')])) {
				$data['cosyone_footer_custom_block'] = html_entity_decode($cosyone_footer_block[$this->language->get('code')], ENT_QUOTES, 'UTF-8');
			}
			</add>
		</operation>
	</file>
	<file name="catalog/controller/product/category.php" error="log">
		<operation error="log">
			<search position="before"><![CDATA[
			$data['breadcrumbs'] = array();
			]]></search>
			<add>
			if (file_exists('catalog/view/theme/cosyone/js/countdown/jquery.countdown_' . $this->language->get('code') . '.js')) {
			$this->document->addScript('catalog/view/theme/cosyone/js/countdown/jquery.countdown_' . $this->language->get('code') . '.js');
			} else {
			$this->document->addScript('catalog/view/theme/cosyone/js/countdown/jquery.countdown_en.js');
			}
			$this->load->language('common/cosyone');
			$data['text_category_expire'] = $this->language->get('text_category_expire');
			$data['cosyone_category_thumb'] = $this->config->get('cosyone_category_thumb');
			$data['cosyone_grid_category'] = $this->config->get('cosyone_grid_category');
			$data['cosyone_category_refine'] = $this->config->get('cosyone_category_refine');
			$data['cosyone_category_per_row'] = $this->config->get('cosyone_category_per_row');
			$data['cosyone_rollover_effect'] = $this->config->get('cosyone_rollover_effect');
			$data['cosyone_percentage_sale_badge'] = $this->config->get('cosyone_percentage_sale_badge');
			$cosyone_quicklook = $this->config->get('cosyone_text_ql');
			if(empty($cosyone_quicklook[$this->language->get('code')])) {
				$data['cosyone_text_ql'] = false;
			} else if (isset($cosyone_quicklook[$this->language->get('code')])) {
				$data['cosyone_text_ql'] = html_entity_decode($cosyone_quicklook[$this->language->get('code')], ENT_QUOTES, 'UTF-8');
			}
			$data['cosyone_brand'] = $this->config->get('cosyone_brand');
			$data['cosyone_product_countdown'] = $this->config->get('cosyone_product_countdown');
			$data['cosyone_product_hurry'] = $this->config->get('cosyone_product_hurry');
			$data['cosyone_default_view'] = $this->config->get('cosyone_default_view');
			</add>
		</operation>
		<operation>
			<search position="before"><![CDATA[$data['products'][] = array(]]></search>
			<add><![CDATA[
			// Cosyone custom code starts	
			  if ((float)$result['special']) {
				$sales_percantage = ((($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax')))-($this->tax->calculate($result['special'], $result['tax_class_id'], $this->config->get('config_tax'))))/(($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax')))/100));
				} else {
				$sales_percantage = false;
				}
				if ((float)$result['special']) {
    			$special_info = $this->model_catalog_product->getSpecialPriceEnd($result['product_id']);
        		$special_date_end = strtotime($special_info['date_end']) - time();
    			} else {
        		$special_date_end = false;
    			}
				$images = $this->model_catalog_product->getProductImages($result['product_id']);
            	if(isset($images[0]['image']) && !empty($images[0]['image'])){
                 $images =$images[0]['image'];
               } else {
				$images = false;
				}
				// cosyone end
			   ]]></add>
		</operation>
		<operation>
			<search position="after"><![CDATA['special'     => $special,]]></search>
			<add><![CDATA[
			// Cosyone custom code starts	
			  'sales_percantage' => number_format($sales_percantage, 0, ',', '.'),
			  'special_date_end' => $special_date_end,
			  'stock_quantity' => sprintf($this->language->get('text_category_stock_quantity'), (int)$result['quantity']),
			  'brand_name'		=> $result['manufacturer'],
			  'thumb_hover'  => $this->model_tool_image->resize($images, $this->config->get('config_image_product_width'), $this->config->get('config_image_product_height')),
			  // Cosyone custom code ends
			   ]]></add>
		</operation>
		<operation error="log">
			<search position="before"><![CDATA[
			$data['categories'][] = array(
			]]></search>
			<add>
	$image = $this->model_tool_image->resize($result['image'], $this->config->get('cosyone_refine_image_w'), $this->config->get('cosyone_refine_image_h'));
			</add>
		</operation>
		<operation error="log">
			<search position="after"><![CDATA[
			$data['categories'][] = array(
			]]></search>
			<add>
	'thumb' => $image,
			</add>
		</operation>
	</file>
	<file name="catalog/controller/product/manufacturer.php">
		<operation>
			<search position="after"><![CDATA[$this->load->model('tool/image');]]></search>
			<add><![CDATA[
			if (file_exists('catalog/view/theme/cosyone/js/countdown/jquery.countdown_' . $this->language->get('code') . '.js')) {
			$this->document->addScript('catalog/view/theme/cosyone/js/countdown/jquery.countdown_' . $this->language->get('code') . '.js');
			} else {
			$this->document->addScript('catalog/view/theme/cosyone/js/countdown/jquery.countdown_en.js');
			}
			$data['direction'] = $this->language->get('direction');
			]]></add>
		</operation>
		<operation>
			<search position="before"><![CDATA[$data['products'][] = array(]]></search>
			<add><![CDATA[
			// Cosyone custom code starts
			  if ((float)$result['special']) {
				$sales_percantage = ((($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax')))-($this->tax->calculate($result['special'], $result['tax_class_id'], $this->config->get('config_tax'))))/(($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax')))/100));
				} else {
				$sales_percantage = false;
				}
			  if ((float)$result['special']) {
    			$special_info = $this->model_catalog_product->getSpecialPriceEnd($result['product_id']);
        		$special_date_end = strtotime($special_info['date_end']) - time();
    			} else {
        		$special_date_end = false;
    			}
				$images = $this->model_catalog_product->getProductImages($result['product_id']);
            	if(isset($images[0]['image']) && !empty($images[0]['image'])){
                 $images =$images[0]['image'];
               } else {
				$images = false;
				}
				$this->load->language('common/cosyone');
				$data['text_category_expire'] = $this->language->get('text_category_expire');
				$data['cosyone_category_per_row'] = $this->config->get('cosyone_category_per_row');
				$data['cosyone_rollover_effect'] = $this->config->get('cosyone_rollover_effect');
				$data['cosyone_percentage_sale_badge'] = $this->config->get('cosyone_percentage_sale_badge');
				$cosyone_quicklook = $this->config->get('cosyone_text_ql');
				if(empty($cosyone_quicklook[$this->language->get('code')])) {
					$data['cosyone_text_ql'] = false;
				} else if (isset($cosyone_quicklook[$this->language->get('code')])) {
					$data['cosyone_text_ql'] = html_entity_decode($cosyone_quicklook[$this->language->get('code')], ENT_QUOTES, 'UTF-8');
				}
				$data['cosyone_brand'] = $this->config->get('cosyone_brand');
				$data['cosyone_product_countdown'] = $this->config->get('cosyone_product_countdown');
				$data['cosyone_product_hurry'] = $this->config->get('cosyone_product_hurry');
				$data['cosyone_default_view'] = $this->config->get('cosyone_default_view');
				$data['cosyone_grid_category'] = $this->config->get('cosyone_grid_category');
				// Cosyone custom code ends
			   ]]></add>
		</operation>
		<operation>
			<search position="after"><![CDATA['special'     => $special,]]></search>
			<add><![CDATA[
			// Cosyone custom code starts	
			  'sales_percantage' => number_format($sales_percantage, 0, ',', '.'),
			  'special_date_end' => $special_date_end,
			  'stock_quantity' => sprintf($this->language->get('text_category_stock_quantity'), (int)$result['quantity']),
			  'brand_name'		=> $result['manufacturer'],
			  'thumb_hover'  => $this->model_tool_image->resize($images, $this->config->get('config_image_product_width'), $this->config->get('config_image_product_height')),
			  // Cosyone custom code ends
			   ]]></add>
		</operation>
	</file>
	<file name="catalog/controller/product/special.php">
		<operation>
			<search position="before"><![CDATA[$data['products'][] = array(]]></search>
			<add><![CDATA[
			// Cosyone custom code starts	
			  if ((float)$result['special']) {
				$sales_percantage = ((($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax')))-($this->tax->calculate($result['special'], $result['tax_class_id'], $this->config->get('config_tax'))))/(($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax')))/100));
				} else {
				$sales_percantage = false;
				}
			  if ((float)$result['special']) {
    			$special_info = $this->model_catalog_product->getSpecialPriceEnd($result['product_id']);
        		$special_date_end = strtotime($special_info['date_end']) - time();
    			} else {
        		$special_date_end = false;
    			}
				$images = $this->model_catalog_product->getProductImages($result['product_id']);
            	if(isset($images[0]['image']) && !empty($images[0]['image'])){
                 $images =$images[0]['image'];
               } else {
				$images = false;
				}
				$this->load->language('common/cosyone');
				$data['text_category_expire'] = $this->language->get('text_category_expire');
				$data['cosyone_category_per_row'] = $this->config->get('cosyone_category_per_row');
				$data['cosyone_rollover_effect'] = $this->config->get('cosyone_rollover_effect');
				$data['cosyone_percentage_sale_badge'] = $this->config->get('cosyone_percentage_sale_badge');
				$cosyone_quicklook = $this->config->get('cosyone_text_ql');
				if(empty($cosyone_quicklook[$this->language->get('code')])) {
					$data['cosyone_text_ql'] = false;
				} else if (isset($cosyone_quicklook[$this->language->get('code')])) {
					$data['cosyone_text_ql'] = html_entity_decode($cosyone_quicklook[$this->language->get('code')], ENT_QUOTES, 'UTF-8');
				}
				$data['cosyone_brand'] = $this->config->get('cosyone_brand');
				$data['cosyone_product_countdown'] = $this->config->get('cosyone_product_countdown');
				$data['cosyone_product_hurry'] = $this->config->get('cosyone_product_hurry');
				$data['cosyone_default_view'] = $this->config->get('cosyone_default_view');
				$data['cosyone_grid_category'] = $this->config->get('cosyone_grid_category');
				// Cosyone custom code ends
			   ]]></add>
		</operation>
		<operation>
			<search position="after"><![CDATA['special'     => $special,]]></search>
			<add><![CDATA[
			// Cosyone custom code starts	
			  'sales_percantage' => number_format($sales_percantage, 0, ',', '.'),
			  'special_date_end' => $special_date_end,
			  'stock_quantity' => sprintf($this->language->get('text_category_stock_quantity'), (int)$result['quantity']),
			  'brand_name'		=> $result['manufacturer'],
			  'thumb_hover'  => $this->model_tool_image->resize($images, $this->config->get('config_image_product_width'), $this->config->get('config_image_product_height')),
			  // Cosyone custom code ends
			   ]]></add>
		</operation>
		<operation>
			<search position="after"><![CDATA[$this->load->model('tool/image');]]></search>
			<add><![CDATA[
			if (file_exists('catalog/view/theme/cosyone/js/countdown/jquery.countdown_' . $this->language->get('code') . '.js')) {
			$this->document->addScript('catalog/view/theme/cosyone/js/countdown/jquery.countdown_' . $this->language->get('code') . '.js');
			} else {
			$this->document->addScript('catalog/view/theme/cosyone/js/countdown/jquery.countdown_en.js');
			}
			]]></add>
		</operation>
	</file>
	<file name="catalog/controller/information/contact.php">
		<operation>
			<search position="before"><![CDATA[
			$data['button_map'] = $this->language->get('button_map');
			]]></search>
			<add><![CDATA[
			$data['cosyone_google_map'] = $this->config->get('cosyone_google_map');
			]]></add>
		</operation>
	</file>
	<file name="catalog/controller/product/search.php">
		<operation>
			<search position="after"><![CDATA[$this->load->model('tool/image');]]></search>
			<add><![CDATA[
			if (file_exists('catalog/view/theme/cosyone/js/countdown/jquery.countdown_' . $this->language->get('code') . '.js')) {
			$this->document->addScript('catalog/view/theme/cosyone/js/countdown/jquery.countdown_' . $this->language->get('code') . '.js');
			} else {
			$this->document->addScript('catalog/view/theme/cosyone/js/countdown/jquery.countdown_en.js');
			}
			]]></add>
		</operation>
		<operation>
			<search position="before"><![CDATA[$data['products'][] = array(]]></search>
			<add><![CDATA[
			// Cosyone custom code starts	
			  if ((float)$result['special']) {
				$sales_percantage = ((($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax')))-($this->tax->calculate($result['special'], $result['tax_class_id'], $this->config->get('config_tax'))))/(($this->tax->calculate($result['price'], $result['tax_class_id'], $this->config->get('config_tax')))/100));
				} else {
				$sales_percantage = false;
				}
			  if ((float)$result['special']) {
    			$special_info = $this->model_catalog_product->getSpecialPriceEnd($result['product_id']);
        		$special_date_end = strtotime($special_info['date_end']) - time();
    			} else {
        		$special_date_end = false;
    			}
				$images = $this->model_catalog_product->getProductImages($result['product_id']);
            	if(isset($images[0]['image']) && !empty($images[0]['image'])){
                 $images =$images[0]['image'];
               } else {
				$images = false;
				}
				$this->load->language('common/cosyone');
				$data['text_category_expire'] = $this->language->get('text_category_expire');
				$data['cosyone_category_per_row'] = $this->config->get('cosyone_category_per_row');
				$data['cosyone_rollover_effect'] = $this->config->get('cosyone_rollover_effect');
				$data['cosyone_percentage_sale_badge'] = $this->config->get('cosyone_percentage_sale_badge');
				$cosyone_quicklook = $this->config->get('cosyone_text_ql');
				if(empty($cosyone_quicklook[$this->language->get('code')])) {
					$data['cosyone_text_ql'] = false;
				} else if (isset($cosyone_quicklook[$this->language->get('code')])) {
					$data['cosyone_text_ql'] = html_entity_decode($cosyone_quicklook[$this->language->get('code')], ENT_QUOTES, 'UTF-8');
				}
				$data['cosyone_brand'] = $this->config->get('cosyone_brand');
				$data['cosyone_product_countdown'] = $this->config->get('cosyone_product_countdown');
				$data['cosyone_product_hurry'] = $this->config->get('cosyone_product_hurry');
				$data['cosyone_default_view'] = $this->config->get('cosyone_default_view');
				$data['cosyone_grid_category'] = $this->config->get('cosyone_grid_category');
				// Cosyone custom code ends
			   ]]></add>
		</operation>
		<operation>
			<search position="after"><![CDATA['special'     => $special,]]></search>
			<add><![CDATA[
			// Cosyone custom code starts	
			  'sales_percantage' => number_format($sales_percantage, 0, ',', '.'),
			  'special_date_end' => $special_date_end,
			  'stock_quantity' => sprintf($this->language->get('text_category_stock_quantity'), (int)$result['quantity']),
			  'brand_name'		=> $result['manufacturer'],
			  'thumb_hover'  => $this->model_tool_image->resize($images, $this->config->get('config_image_product_width'), $this->config->get('config_image_product_height')),
			  // Cosyone custom code ends
			   ]]></add>
		</operation>
	</file>
	<file name="catalog/model/design/layout.php" error="log">
		<operation error="log">
			<search position="after"><![CDATA[
			class ModelDesignLayout extends Model {
			]]></search>
			<add>
		// Cosyone code start
public function getLayoutForAllPages() {
   $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "layout
      WHERE name like '%Footer%'
      LIMIT 1");
   if ($query->num_rows) {
      return $query->row['layout_id'];
   } else {
      return 0;
   }
}
// Cosyone code end
			</add>
		</operation>
	</file>
	<file name="catalog/model/catalog/product.php" error="log">
		<operation error="log">
			<search position="before"><![CDATA[
			public function getTotalProductSpecials() {
			]]></search>
			<add>
		// Cosyone start
	public function getSpecialPriceEnd($product_id) {
        $query = $this->db->query("SELECT date_end FROM " . DB_PREFIX . "product_special WHERE product_id = '" . (int)$product_id . "' AND customer_group_id = '" . $this->config->get('config_customer_group_id') . "' AND ((date_end = '0000-00-00 00:00:00' OR date_end > NOW())) ORDER BY priority ASC, price ASC LIMIT 1");
        
		if ($query->num_rows) {
            return array(
                'date_end'   => $query->row['date_end'],
            );
        } else {
            return false;
        }
    }
	public function getItemsSold($product_id) {
        $query = $this->db->query("SELECT COUNT(*) AS total FROM `" . DB_PREFIX . "order_product` op LEFT JOIN `" . DB_PREFIX . "order` o ON (op.order_id = o.order_id) WHERE o.order_status_id > '0' AND op.product_id = '" . (int)$product_id . "'");
        if ($query->row) {
            return $query->row['total'];
        } else {
            return false;
        }
    } 
			</add>
		</operation>
	</file>
	<file name="admin/controller/design/layout.php">
		<operation error="log">
			<search position="replace"><![CDATA[layout_form]]></search>
			<add>layout_form_cosyone</add>
		</operation>
	</file>
</modification>