<modification>
	<id>SEO Mega KIT - Facebook Open Graph/Twitter cart</id>
	<version>1.5.x</version>
	<vqmver>2.X</vqmver>
	<author>marsilea15@gmail.com</author>

	<!-- /////////////////////// PRODUCT /////////////////////// -->

	<file name="catalog/language/*/product/product.php">
		<operation>
			<search position="after"><![CDATA[<?php]]></search>
			<add><![CDATA[
				$_['smp_text_price'] = 'Price';
				$_['smp_text_currency'] = 'Currency';
			]]></add>
		</operation>
	</file>
	
	<file name="catalog/controller/product/product.php">
		<operation>
			<search position="before"><![CDATA[$this->load->controller('common/header');]]></search>
			<add><![CDATA[
				if( $this->config->get( 'smp_facebook_open_graph' ) ) {	
					$this->document
						->addMeta( 'og:type', 'og:product', 'property' )
						->addMeta( 'og:title', $product_info['name'], 'property' )
						->addMeta( 'og:url', $this->url->link( 'product/product', 'product_id=' . $product_info['product_id'], 'SSL' ), 'property' )
						->addMeta( 'product:price:amount', $product_info['special'] ? $product_info['special'] : $product_info['price'], 'property' )
						->addMeta( 'product:price:currency', $this->config->get( 'config_currency' ), 'property' )
						->addMeta( 'og:image', $this->model_tool_image->resize($product_info['image'], $this->config->get('config_image_popup_width'), $this->config->get('config_image_popup_height')), 'property' )
						->addMeta( 'og:image:width', $this->config->get('config_image_popup_width'), 'property' )
						->addMeta( 'og:image:height', $this->config->get('config_image_popup_height'), 'property' )
						->addMeta( 'og:description', $product_info['meta_description'], 'property' );
				}
				
				if( $this->config->get( 'smp_twitter_cart' ) ) {
					$this->document
						->addMeta( 'twitter:card', 'product' )
						->addMeta( 'twitter:site', '' )
						->addMeta( 'twitter:title', $product_info['name'] )
						->addMeta( 'twitter:url', $this->url->link( 'product/product', 'product_id=' . $product_info['product_id'], 'SSL' ) )
						->addMeta( 'twitter:data1', $product_info['special'] ? $product_info['special'] : $product_info['price'] )
						->addMeta( 'twitter:label1', $this->language->get( 'smp_text_price' ) )
						->addMeta( 'twitter:data2', $this->config->get( 'config_currency' ) )
						->addMeta( 'twitter:label2', $this->language->get( 'smp_text_currency' ) )
						->addMeta( 'twitter:image:src', $this->model_tool_image->resize($product_info['image'], $this->config->get('config_image_popup_width'), $this->config->get('config_image_popup_height')) )
						->addMeta( 'twitter:image:width', $this->config->get('config_image_popup_width') )
						->addMeta( 'twitter:image:height', $this->config->get('config_image_popup_height') )
						->addMeta( 'twitter:description', $product_info['meta_description'] )
						->addMeta( 'twitter:site', $this->config->get( 'smp_twitter_site' ) )
						->addMeta( 'twitter:creator', $this->config->get( 'smp_twitter_creator' ) );
				}
				
				if( $this->config->get( 'smp_googleplus_metadata' ) ) {			
					$this->document
						->addMeta( 'name', $product_info['name'], 'itemprop' ) 
						->addMeta( 'description', $product_info['meta_description'], 'itemprop' ) 
						->addMeta( 'image', $this->model_tool_image->resize($product_info['image'], $this->config->get('config_image_popup_width'), $this->config->get('config_image_popup_height')), 'itemprop' ) 
						->addMeta( 'price', $product_info['special'] ? $product_info['special'] : $product_info['price'], 'itemprop' ) 
						->addMeta( 'priceCurrency', $this->config->get( 'config_currency' ), 'itemprop' );
				}
			]]></add>
		</operation>
	</file>

	<!-- /////////////////////// CATEGORY /////////////////////// -->

	<file name="catalog/controller/product/category.php">
		<operation>
			<search position="before"><![CDATA[if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/product/category.tpl')) {]]></search>
			<add><![CDATA[
				if( $this->config->get( 'smp_facebook_open_graph' ) ) {
					$this->document
						->addMeta( 'og:type', 'og:website', 'property' )
						->addMeta( 'og:title', $category_info['name'], 'property' )
						->addMeta( 'og:url', $this->url->link('product/category', 'path=' . $this->request->get['path']), 'property' )
						->addMeta( 'og:image', $this->model_tool_image->resize($category_info['image'], $this->config->get('config_image_category_width'), $this->config->get('config_image_category_height')), 'property' )
						->addMeta( 'og:description', $category_info['meta_description'], 'property' );
				}
				
				if( $this->config->get( 'smp_twitter_cart' ) ) {
					$this->document
						->addMeta( 'twitter:card', 'category' )
						->addMeta( 'twitter:title', $category_info['name'] )
						->addMeta( 'twitter:url', $this->url->link('product/category', 'path=' . $this->request->get['path']) )
						->addMeta( 'twitter:image:src', $this->model_tool_image->resize($category_info['image'], $this->config->get('config_image_category_width'), $this->config->get('config_image_category_height')) )
						->addMeta( 'twitter:image:width', $this->config->get('config_image_category_width') )
						->addMeta( 'twitter:image:height', $this->config->get('config_image_category_height') )
						->addMeta( 'twitter:description', $category_info['meta_description'] )
						->addMeta( 'twitter:site', $this->config->get( 'smp_twitter_site' ) )
						->addMeta( 'twitter:creator', $this->config->get( 'smp_twitter_creator' ) );
				}
			]]></add>
		</operation>
	</file>

</modification>