<?xml version="1.0" encoding="utf-8"?> 
<modification> 
 <name><![CDATA[So Google Amp (Accelerated Mobile Pages)]]></name> 
 <code>ocmod-googleamp</code> 
 <version><![CDATA[1.0.0]]></version> 
 <author><![CDATA[OpencartWorks]]></author> 
 <link>http://www.opencartWorks.com</link> 
  
<!--========Catalog/language/product=============--> 
<file path="catalog/language/*/product/product.php">
  <operation> 
	<search ><![CDATA[// Entry]]></search>
	<add position="after"><![CDATA[
	$_['text_comment']     	= ' Comment';
]]></add>
 </operation>
 
</file>  
<!--========Catalog/controller/product=============--> 
<file path="catalog/controller/product/product.php">
  <operation> 
	
	<search ><![CDATA[$this->document->addLink($this->url->link('product/product', 'product_id=' . $this->request->get['product_id']), 'canonical');]]></search>
	<add position="after"><![CDATA[
	if($this->config->get('so_google_amp_status')){
	  $this->document->addLink($this->url->link('extension/amp/product', 'product_id=' . $this->request->get['product_id']), 'amphtml');
	  if (isset($this->request->get['addcart'])) {
		  $this->cart->add($this->request->get['product_id']);
		  $this->response->redirect($this->url->link('checkout/cart'));
	  }
	}
]]></add>
 </operation>
</file> 

<file path="catalog/controller/product/category.php">
  <operation> 
	<search ><![CDATA[$data['pagination'] = $pagination->render();]]></search>
	<add position="after"><![CDATA[
	if($this->config->get('so_google_amp_status')){
	  $this->document->addLink($this->url->link('extension/amp/category', 'path=' . $category_info['category_id']), 'amphtml');
	  if (isset($this->request->get['addcart'])) {
		  $this->cart->add($this->request->get['product_id']);
		  $this->response->redirect($this->url->link('checkout/cart'));
	  }
	}
]]></add>
 </operation>
</file> 

<file path="catalog/controller/startup/seo_url.php">
	<operation>
		<search><![CDATA[if ($url[0] == 'product_id') {]]></search>
		<add position="before"><![CDATA[
		if ($url[0] == 'product_id' && strpos($this->request->get['_route_'], "amp/") !== FALSE) {
			$this->request->get['aproduct_id'] = $url[1];
		}
		if ($url[0] == 'category_id' && strpos($this->request->get['_route_'], "amp/") !== FALSE) {
			if (!isset($this->request->get['apath'])) {
				$this->request->get['apath'] = $url[1];
			} else {
				$this->request->get['apath'] .= '_' . $url[1];
			}
		}
		]]></add>
	</operation>
	<operation>
		<search><![CDATA[foreach ($parts as $part) {]]></search>
		<add position="after"><![CDATA[if ( $part == 'amp') {
				continue;
			} else
		]]></add>
	</operation>
	<operation error="log">
		<search><![CDATA[
			if (!isset($this->request->get['route'])) {
		]]></search>
		<add position="after"><![CDATA[
			if (isset($this->request->get['aproduct_id']) ) {
				$this->request->get['route'] = 'extension/amp/product';
			} elseif (isset($this->request->get['apath']) ) {
				$this->request->get['route'] = 'extension/amp/category';

		]]></add>
	</operation>
	<operation error="log">
		<search><![CDATA[
			if (isset($this->request->get['product_id'])) {
		]]></search>
		<add position="replace"><![CDATA[
			} elseif (isset($this->request->get['product_id']) ) {
		]]></add>
	</operation>
	<operation error="log">
		<search><![CDATA[
			($data['route'] == 'information/information' && $key == 'information_id')
		]]></search>
		<add position="replace"><![CDATA[
			($data['route'] == 'information/information' && $key == 'information_id') || ($data['route'] == 'extension/amp/product')
		]]></add>
	</operation>
	<operation>
		<search><![CDATA[
			$url .= '/' . $query->row['keyword'];
		]]></search>
		<add position="replace" index="1"><![CDATA[
			if ($data['route'] == 'extension/amp/product') {
				$url .=  '/amp/' . $query->row['keyword'] .'';
			}else if ($data['route'] == 'extension/amp/category') {
				$url .=  '/amp/' . $query->row['keyword'] .'';
			}else {
				$url .= '/' . $query->row['keyword'];
			}
		
		]]></add>
	</operation>
</file> 

</modification> 