<?xml version="1.0" encoding="UTF-8"?>
<modification>

	<name>Complete SEO Basel Theme Blog</name>
    <version>1.2.5</version>
    <author>GeekoDev</author>
	<code>seo_package_basel_theme_blog</code>
	<link>https://geekodev.com/</link>
	
	<file path="catalog/controller/startup/seo_url.php">
		<operation error="skip">
			<search><![CDATA[
			if ($query->row['query'] && $url[0]
			]]></search>
			<add position="before"><![CDATA[
			if ($url[0] == 'blog_id') {$this->request->get['blog_id'] = $url[1]; }
			if ($url[0] == 'blog_category_id') {
			if (!isset($this->request->get['blogpath'])) {
			$this->request->get['blogpath'] = $url[1];
				} else {
			$this->request->get['blogpath'] .= '_' . $url[1];
			}}
			]]></add>
		</operation>
		<operation error="skip">
			<search><![CDATA[
			!= 'category_id' && $url[0]
			]]></search>
			<add position="replace"><![CDATA[
			!= 'category_id' && $url[0] != 'blog_category_id' && $url[0] != 'blog_id' && $url[0] 
			]]></add>
		</operation>
		<operation error="skip">
			<search><![CDATA[
			$this->request->get['route'] = 'product/product';
			]]></search>
			<add position="after"><![CDATA[
			} elseif (isset($this->request->get['blog_id'])) {
			$this->request->get['route'] = 'extension/blog/blog';
			} elseif ($this->request->get['_route_'] ==  'extension_blog_home') { 
			$this->request->get['route'] = 'extension/blog/home';
			]]></add>
		</operation>
		<operation error="skip">
			<search><![CDATA[
			$this->request->get['route'] = 'product/category';
			]]></search>
			<add position="after"><![CDATA[
			} elseif (isset($this->request->get['blogpath'])) {
			$this->request->get['route'] = 'extension/blog/category';
			]]></add>
		</operation>
		<operation error="skip">
			<search><![CDATA[
			($data['route'] == 'information/information' && $key == 'information_id'))
			]]></search>
			<add position="replace"><![CDATA[
			($data['route'] == 'information/information' && $key == 'information_id') || ($data['route'] == 'extension/blog/blog' && $key == 'blog_id'))
			]]></add>
		</operation>
		<operation error="skip">
			<search><![CDATA[
			} elseif ($key == 'path') {
			]]></search>
			<add position="before"><![CDATA[
			} elseif ($key == 'blogpath') {
			$blog_categories = explode('_', $value);
			foreach ($blog_categories as $category) {
			$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "seo_url WHERE `query` = 'blog_category_id=" . (int)$category . "'");
			if ($query->num_rows) {
			$url .= '/' . $query->row['keyword'];
			} else {
			$url = '';
			break;
			}}
			unset($data[$key]);
			} elseif (isset($data['route']) && $data['route'] ==   'extension/blog/home') {
			$blog_home = $this->db->query("SELECT * FROM " . DB_PREFIX . "seo_url WHERE `query` = 'extension/blog/home'");
			if ($blog_home->num_rows) {
			$url .= '/' . $blog_home->row['keyword'];
			} else {
			$url = '';
			}
			]]></add>
		</operation>
	</file>
</modification>