<?xml version="1.0" encoding="UTF-8"?>
<modification>
  <id>Complete SEO Package</id>
  <name>Complete SEO Package</name>
  <code>seo_package</code>
  <version>5.3.0</version>
  <vqmver>2.5.1</vqmver>
  <author><![CDATA[<b style="color:#83a411">Geeko<b style="color:#5f5f5f">Dev</b></b>]]></author>
  <link>https://geekodev.com</link>
  
  <file path="admin/controller/module/complete_seo.php">
    <operation>
      <search position="replace"><![CDATA[$modification_active = false;]]></search>
      <add position="replace"><![CDATA[$modification_active = true;]]></add>
    </operation>
  </file>
  
  <file path="catalog/controller/common/search.php" error="skip" v="2.2 - 3">
  
    <operation error="skip">
      <search position="before"><![CDATA[return $this->load->view('common/search]]></search>
      <add position="before"><![CDATA[
        if ($this->config->get('mlseo_fix_search')) {
          $data['csp_search_url'] = $this->url->link('product/search');
          $data['csp_search_url_param'] = $this->url->link('product/search', 'search=%search%');
          
          return $this->load->view('common/csp_search', $data);
        }
      ]]></add>
    </operation>
    
  </file><file path="catalog/controller/common/search.php" error="skip" v="2">
  
    <operation error="skip">
      <search position="before"><![CDATA[return $this->load->view($this->config->get('config_template') . '/template/common/search.tpl', $data);]]></search>
      <add position="before"><![CDATA[
        if ($this->config->get('mlseo_fix_search')) {
          $data['csp_search_url'] = $this->url->link('product/search');
          $data['csp_search_url_param'] = $this->url->link('product/search', 'search=%search%');
          
          if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/common/csp_search.tpl')) {
            return $this->load->view($this->config->get('config_template') . '/template/common/csp_search.tpl', $data);
          } else {
            return $this->load->view('default/template/common/csp_search.tpl', $data);
          }
        }
      ]]></add>
    </operation>
    
    <operation error="skip">
      <search position="before"><![CDATA[return $this->load->view('default/template/common/search.tpl', $data);]]></search>
      <add position="before"><![CDATA[
        if ($this->config->get('mlseo_fix_search')) {
          $data['csp_search_url'] = $this->url->link('product/search');
          $data['csp_search_url_param'] = $this->url->link('product/search', 'search=%search%');
          
          return $this->load->view('default/template/common/csp_search.tpl', $data);
        }
      ]]></add>
    </operation>
    
  </file>
  
  <file path="catalog/controller/product/search.php" error="skip" v="1 - 3">
  
    <operation error="skip">
      <search position="after"><![CDATA[public function index() {]]></search>
      <add position="after"><![CDATA[
        if (version_compare(VERSION, '2', '>=')) {
          $data['csp_search_url'] = $this->config->get('mlseo_fix_search') ? $this->url->link('product/search') : 'index.php?route=product/search';
        } else {
          $this->data['csp_search_url'] = $this->config->get('mlseo_fix_search') ? $this->url->link('product/search') : 'index.php?route=product/search';
        }
      ]]></add>
    </operation>
    
  </file>
  
  <file path="catalog/view/theme/*/template/product/search.twig" error="skip" v="3">
  
    <operation error="skip">
      <search position="replace"><![CDATA[url = 'index.php?route=product/search';]]></search>
      <add position="replace"><![CDATA[url = '{{csp_search_url}}';]]></add>
    </operation>
    
    <operation error="skip">
      <search position="replace"><![CDATA[url += '&search=' + encodeURIComponent(search);]]></search>
      <add position="replace"><![CDATA[
      if (url.indexOf('?') > -1) {
        url += '&search=' + encodeURIComponent(search);
      } else {
        url += '?search=' + encodeURIComponent(search);
      }
      ]]></add>
    </operation>
    
  </file><file path="catalog/view/theme/*/template/product/search.tpl" error="skip" v="2">
  
    <operation error="skip">
      <search position="replace"><![CDATA[url = 'index.php?route=product/search';]]></search>
      <add position="replace"><![CDATA[url = '<?php echo $csp_search_url; ?>';]]></add>
    </operation>
    
    <operation error="skip">
      <search position="replace"><![CDATA[url += '&search=' + encodeURIComponent(search);]]></search>
      <add position="replace"><![CDATA[
      if (url.indexOf('?') > -1) {
        url += '&search=' + encodeURIComponent(search);
      } else {
        url += '?search=' + encodeURIComponent(search);
        }
      ]]></add>
    </operation>
    
  </file>
  
  <file path="catalog/controller/checkout/cart.php" error="skip" v="2 - 3">
  
    <operation error="skip">
      <search position="after"><![CDATA[public function index() {]]></search>
      <add position="after"><![CDATA[
        if ($this->config->get('mlseo_fix_cart')) {
          $data['csp_cart_url'] = $this->url->link('checkout/cart');
        }
      ]]></add>
    </operation>
    
  </file>
  
  <file path="catalog/view/theme/*/template/checkout/cart.twig" error="skip" v="3">
  
    <operation error="skip">
      <search position="before"><![CDATA[{{ footer }} ]]></search>
      <add position="before"><![CDATA[
{% if csp_cart_url %}<script><!--
$('[onclick^="cart.remove"]').on('click', function(){var cspCartCheck = $('#cart ul:first').html();$(document).ajaxStop(function () {if(cspCartCheck !== $('#cart ul:first').html()){location = '{{csp_cart_url}}';}});});
--></script>{% endif %}
      ]]></add>
    </operation>
    
  </file><file path="catalog/view/theme/*/template/checkout/cart.tpl" error="skip" v="2">
  
    <operation error="skip">
      <search position="before"><![CDATA[<?php echo $footer; ?>]]></search>
      <add position="before"><![CDATA[
<?php if (!empty($csp_cart_url)) { ?><script><!--
$('[onclick^="cart.remove"]').on('click', function(){
  var cspCartCheck = $('#cart ul:first').html();
  $(document).ajaxStop(function () {
    if(cspCartCheck !== $('#cart ul:first').html()){
      location = '<?php echo $csp_cart_url; ?>';
    }
  });
});
--></script><?php } ?>
      ]]></add>
    </operation>
    
  </file>
  
  <file path="catalog/controller/startup/startup.php" error="skip" v="2.2">
  
    <operation>
      <search position="before"><![CDATA[$this->load->model('localisation/language');]]></search>
      <add position="before"><![CDATA[    // Seo Package
    if (class_exists('multilingual_seo')) {
      $multilingual = new multilingual_seo($this->registry); $multilingual->detect();
    } else {
      error_log('Class multilingual_seo not found');
    }
    ]]></add>
    </operation>
    
    <operation error="skip">
      <search position="after"><![CDATA[$this->config->set('config_url', HTTP_SERVER);]]></search>
      <add position="after"><![CDATA[      $this->config->set('config_ssl', HTTPS_SERVER);  // SSL fix for OC 2.2]]></add>
    </operation>
    
    <operation error="skip" i="set language if not exists">
      <search position="before"><![CDATA[if (!empty($this->request->server['HTTP_ACCEPT_LANGUAGE']) && !array_key_exists($code, $languages)) {]]></search>
      <add position="before"><![CDATA[
        if (!empty($code) && $this->config->get('mlseo_enabled') && $this->config->get('mlseo_flag_mode') == 'store') {
            $code = $this->config->get('config_language');
        }
    ]]></add>
    </operation>
    
  </file>
  
  <file path="system/startup.php">
  
    <operation>
      <search position="after"><![CDATA[DIR_SYSTEM . 'engine/registry.php]]></search>
      <add position="after"><![CDATA[
      require_once(DIR_SYSTEM . 'library/multilingual_seo.php');
      //require_once(DIR_SYSTEM . 'library/powercache.php');
      ]]></add>
    </operation>
    
  </file>
  
  <file path="catalog/controller/extension/feed/google_sitemap.php" error="skip">
  
    <operation error="skip">
      <search position="after"><![CDATA[public function index() {]]></search>
      <add position="after"><![CDATA[
      if ($this->config->get('advanced_sitemap_rewrite')) {
        return new Action('feed/advanced_sitemap');
      }
      ]]></add>
    </operation>
    
  </file>
  
  <file path="catalog/controller/feed/google_sitemap.php" error="skip">
  
    <operation error="skip">
      <search position="after"><![CDATA[public function index() {]]></search>
      <add position="after"><![CDATA[
      if ($this->config->get('advanced_sitemap_rewrite')) {
        return new Action('feed/advanced_sitemap');
      }
      ]]></add>
    </operation>
    
  </file>
  
  <!-- Path manager -->
  <file path="catalog/controller/*/seo_url.php" error="skip">
  
    <operation>
      <search position="after"><![CDATA[$categories = explode('_', $value);]]></search>
      <add position="after"><![CDATA[
        if ($this->config->get('mlseo_fpp_directcat')) {
          $categories = array(array_pop($categories));
        } else if (count($categories) < 2) {
          $this->load->model('tool/path_manager');
          $categories = $this->model_tool_path_manager->getFullCategoryPath(array_pop($categories));
          $categories = explode('_', $categories);
        }
        
        if (isset($data['route']) && $data['route'] == 'product/product' && $this->config->get('mlseo_fpp_mode') == '4') {
          $categories = (array) end($categories);
        }
      ]]></add>
    </operation>
    
    <operation>
      <search position="after"><![CDATA[$this->request->get['manufacturer_id'] = $url[1];]]></search>
      <add position="after"><![CDATA[
              if ($this->config->get('mlseo_fpp_brand_parent') && isset($this->request->get['route']) && $this->request->get['route'] == 'product/manufacturer') {
                unset($this->request->get['route']);
              }
      ]]></add>
    </operation>

    <operation>
      <!--search position="replace" index="0" regex="true"><![CDATA[~\$url \.??= '/' \. \$query->row\['keyword'\];~]]></search-->
      <search position="before" index="0"><![CDATA[$url .= '/' . $query->row['keyword'];]]></search>
      <add position="before" index="0"><![CDATA[
        if ($data['route'] == 'product/manufacturer/info' && $key == 'manufacturer_id' && $this->config->get('mlseo_fpp_brand_parent')) {
          $this->load->model('tool/path_manager');
          $url .= $this->model_tool_path_manager->getManufacturerKeyword();
        }
      ]]></add>
    </operation>
    
    <operation>
      <search position="replace" regex="true"><![CDATA[~parse_str\(\$(url_data|url_info)\['query'\], \$data\);~]]></search>
      <add position="replace"><![CDATA[    $0
      
        // Absolute url
        if ($this->config->get('mlseo_url_absolute')) {
          if ($route = strstr($link, '/index.php?route=')) {
             $route = str_replace(array('/index.php?route=', '&amp;'), array('', '&'), $route);
             $urlAbsolute = $this->db->query("SELECT redirect, language_id FROM " . DB_PREFIX . "url_absolute WHERE query = '" . $this->db->escape($route) . "' AND language_id = '" . (int) $this->config->get('config_language_id') . "'")->row;
             
             if (!empty($urlAbsolute['redirect'])) {
               $url = '/' . $urlAbsolute['redirect'];
               //$data = array();
               return ${'url_info'}['scheme'] . '://' . ${'url_info'}['host'] . (isset(${'url_info'}['port']) ? ':' . ${'url_info'}['port'] : '') . str_replace('/index.php', '', ${'url_info'}['path']) . $url;
             }
          }
        }
        
        if ($this->config->get('advanced_sitemap_rewrite') && isset($data['route']) && strpos($data['route'], 'feed/advanced_sitemap') !== false) {
          $advStmpType = substr(strrchr($data['route'], '/'), 1);
          $sitemapFolder = '';
          if (!in_array($advStmpType, array('xslindex', 'xsl', 'xsl_grid'))) {
            if(isset($data['lang'])){
              $lang = '/'.$data['lang'];
            } else {
              $lang = '';
            }
            
            if ($advStmpType == 'advanced_sitemap') {
              $url .= $sitemapFolder.'/sitemap';
            } else {
              //$url .= $sitemapFolder.'/sitemap-'.$advStmpType;
              $url .= $lang . $sitemapFolder.'/sitemap-'.$advStmpType;
            }
            
            if (isset($data['lang'])) {
              $url .= '-'.$data['lang'];
              unset($data['lang']);
            }
            
            if (isset($data['page'])) {
              $url .= '-'.$data['page'];
              unset($data['page']);
            }
            
            $url .= '.xml';
            unset(${'data'}['route']);
          }
          
          $seoPkgNoFlag = 1;
        }
      
        if (isset($data['route']) && $data['route'] == 'product/product') {
          if ($this->config->get('mlseo_fpp_bypasscat') && isset($data['path'])) {
            unset($data['path']);
          }
          
          if (isset($data['manufacturer_id']) && $this->config->get('mlseo_fpp_mode') != '3') {
            unset($data['manufacturer_id']);
          }
          
          if (!isset($data['path']) && !isset($data['manufacturer_id']) && isset($data['product_id'])) {
            $this->load->model('tool/path_manager');
            $data = (array) $this->model_tool_path_manager->getFullProductPath($data['product_id']) + $data;
          }
        }
        
        $gkd_is_category = (isset($data['route']) && $data['route'] == 'product/category') ? true : false;
        
        if (!$this->config->get('mlseo_multistore') && $this->config->get('config_store_id')) {
          $currentSubStore = $this->config->get('config_store_id');
          $this->config->set('config_store_id', 0);
        }
      ]]></add>
    </operation>
    
    <operation error="skip">
      <search position="before"><![CDATA[if ($url) {]]></search>
      <add position="before"><![CDATA[    if (!empty($currentSubStore)) {
      $this->config->set('config_store_id', $currentSubStore);
    }
      ]]></add>
    </operation>
    
  </file>
  
  <file path="catalog/controller/product/category.php">
  
    <operation>
      <search position="after"><![CDATA[public function index() {]]></search>
      <add position="after"><![CDATA[
        // path manager - preserve bc
        if (isset($this->request->get['path']) && $this->config->get('mlseo_fpp_directcat')) {
          $cat_id = strrchr('_'.$this->request->get['path'], '_');
          $cat_id = str_replace('_', '', $cat_id);
          $this->load->model('tool/path_manager');
          $this->request->get['path'] = $this->model_tool_path_manager->getFullCategoryPath($cat_id);
        }
      ]]></add>
    </operation>
    
  </file><file path="catalog/controller/product/category.php" v="3">
  
    <operation error="skip" v="3" i="canonical">
      <search position="replace"><![CDATA[$this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id']), 'canonical');]]></search>
      <add position="replace"><![CDATA[
        $this->load->model('tool/path_manager');
        if (empty($this->request->get['mfp_seo_alias'])) {
          $this->document->addLink($this->url->link('product/category', 'path=' . ($this->config->get('mlseo_fpp_cat_canonical') ? $this->model_tool_path_manager->getFullCategoryPath($category_info['category_id']) : $category_info['category_id'])), 'canonical');
        } else {
          $this->document->addLink( rtrim( $this->url->link('product/category', 'path=' . $category_info['category_id'], true), '/' ) . '/' . $this->request->get['mfp_seo_alias'], 'canonical');
        }
        ]]></add>
    </operation>
    
    <operation error="skip" v="3" i="canonical">
      <search position="replace"><![CDATA[$this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id'] . '&page='. $page), 'canonical');]]></search>
      <add position="replace"><![CDATA[$this->load->model('tool/path_manager'); $this->document->addLink($this->url->link('product/category', 'path=' . ($this->config->get('mlseo_fpp_cat_canonical') ? $this->model_tool_path_manager->getFullCategoryPath($category_info['category_id']) : $category_info['category_id']) . ($this->config->get('mlseo_pagination_canonical') ? '&page='. $page : '')), 'canonical');]]></add>
    </operation>
    
    <operation error="skip" v="3" i="prev">
      <search position="replace"><![CDATA[$this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id'] . (($page - 2) ? '&page='. ($page - 1) : '')), 'prev');]]></search>
      <add position="replace"><![CDATA[$this->load->model('tool/path_manager'); $this->document->addLink($this->url->link('product/category', 'path=' . ($this->config->get('mlseo_fpp_cat_canonical') ? $this->model_tool_path_manager->getFullCategoryPath($category_info['category_id']) : $category_info['category_id']) . (($page - 2) ? '&page='. ($page - 1) : '')), 'prev');]]></add>
    </operation>
    
    <operation error="skip" v="3" i="next">
      <search position="replace"><![CDATA[$this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id'] . '&page='. ($page + 1)), 'next');]]></search>
      <add position="replace"><![CDATA[$this->load->model('tool/path_manager'); $this->document->addLink($this->url->link('product/category', 'path=' . ($this->config->get('mlseo_fpp_cat_canonical') ? $this->model_tool_path_manager->getFullCategoryPath($category_info['category_id']) : $category_info['category_id']) . '&page='. ($page + 1)), 'next');]]></add>
    </operation>
    
  </file><file path="catalog/controller/product/category.php">
  
    <operation error="skip" v="2.2" i="canonical">
      <search position="replace"><![CDATA[$this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id'], true), 'canonical');]]></search>
      <add position="replace"><![CDATA[
        $this->load->model('tool/path_manager');
        if (empty($this->request->get['mfp_seo_alias'])) {
          $this->document->addLink($this->url->link('product/category', 'path=' . ($this->config->get('mlseo_fpp_cat_canonical') ? $this->model_tool_path_manager->getFullCategoryPath($category_info['category_id']) : $category_info['category_id']), true), 'canonical');
        } else {
          $this->document->addLink( rtrim( $this->url->link('product/category', 'path=' . $category_info['category_id'], true), '/' ) . '/' . $this->request->get['mfp_seo_alias'], 'canonical');
        }
        ]]></add>
    </operation>
    
  </file><file path="catalog/controller/product/category.php">
  
    <operation error="skip" v="2.x" i="canonical">
      <search position="before"><![CDATA[if ($page == 1) {]]></search>
      <add position="before"><![CDATA[
      if ($page > 1 AND $this->config->get('mlseo_pagination_canonical')) {
         $this->load->model('tool/path_manager'); $this->document->addLink($this->url->link('product/category', 'path=' . ($this->config->get('mlseo_fpp_cat_canonical') ? $this->model_tool_path_manager->getFullCategoryPath($category_info['category_id']) : $category_info['category_id']) . '&page='. $page, true), 'canonical');
      }
      ]]></add>
    </operation>
    
  </file><file path="catalog/controller/product/category.php">
  
    <operation error="skip" v="2.1" i="canonical">
      <search position="replace"><![CDATA[$this->document->addLink($this->url->link('product/category', 'path=' . $category_info['category_id'], 'SSL'), 'canonical');]]></search>
      <add position="replace"><![CDATA[
      $this->load->model('tool/path_manager');
      if (empty($this->request->get['mfp_seo_alias'])) {
        $this->document->addLink($this->url->link('product/category', 'path=' . ($this->config->get('mlseo_fpp_cat_canonical') ? $this->model_tool_path_manager->getFullCategoryPath($category_info['category_id']) : $category_info['category_id']), 'SSL'), 'canonical');
      } else {
        $this->document->addLink( rtrim( $this->url->link('product/category', 'path=' . $category_info['category_id'], true), '/' ) . '/' . $this->request->get['mfp_seo_alias'], 'canonical');
      }
      ]]></add>
    </operation>
    
  </file><file path="catalog/controller/product/category.php">
  
    <operation error="skip" v="2.0" i="canonical">
      <search position="replace"><![CDATA[$this->document->addLink($this->url->link('product/category', 'path=' . $this->request->get['path']), 'canonical');]]></search>
      <add position="replace"><![CDATA[
        $this->load->model('tool/path_manager');
        if (empty($this->request->get['mfp_seo_alias'])) {
          $this->document->addLink($this->url->link('product/category', 'path=' . ($this->config->get('mlseo_fpp_cat_canonical') ? $this->model_tool_path_manager->getFullCategoryPath($category_info['category_id']) : $category_info['category_id']), true), 'canonical');
        } else {
          $this->document->addLink( rtrim( $this->url->link('product/category', 'path=' . $category_info['category_id'], true), '/' ) . '/' . $this->request->get['mfp_seo_alias'], 'canonical');
        }
        ]]></add>
    </operation>
    
  </file>
  
  <!-- breadcrumbs -->
  
  <file path="catalog/controller/product/product.php">
  
    <operation>
      <search position="before" index="0"><![CDATA[if (isset($this->request->get['path'])) {]]></search>
      <add position="before" index="0"><![CDATA[
      // path manager
      if (isset($this->request->get['product_id']) && ((!isset($this->request->get['path']) && $this->config->get('mlseo_fpp_breadcrumbs') == '1') || ($this->config->get('mlseo_fpp_breadcrumbs') == '2')) && is_array($this->request->get)) {
        unset($this->request->get['path']);
        $this->load->model('tool/path_manager');
        $this->request->get = $this->model_tool_path_manager->getFullProductPath($this->request->get['product_id'], true) + $this->request->get;
      }
      ]]></add>
    </operation>
    
    <operation>
      <search position="after"><![CDATA[public function review() {]]></search>
      <add position="after"><![CDATA[
    // SEO Package - redirect non-ajax requests
    if($this->config->get('mlseo_redir_reviews') && !(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest')) {
      header('HTTP/1.1 301 Moved Permanently');
      header('CSP-Redir: review', false);
      header('Location: ' . $this->url->link('product/product', 'product_id=' . $this->request->get['product_id']));
    }
      ]]></add>
    </operation>
    
  </file><file path="catalog/controller/product/product.php">
  
    <operation error="skip" i="fix category breadcrumb in case of parameters in it">
      <search position="replace"><![CDATA['href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . $url)]]></search>
      <add position="replace"><![CDATA['href' => $this->url->link('product/category', 'path=' . $this->request->get['path'] . (!isset($this->request->get['manufacturer_id']) && !isset($this->request->get['search']) && !isset($this->request->get['tag']) ? $url : ''))]]></add>
    </operation>
    
  </file><file path="catalog/controller/product/product.php">
  
    <operation error="skip" i="seo headings">
      <search position="after"><![CDATA[$data['description'] = ]]></search>
      <add position="after"><![CDATA[
      $seoHeadings = $this->config->get('mlseo_headings');
      
      if ($this->config->get('mlseo_enabled')) {
        $extraTopDesc = $extraBottomDesc = '';
        
        foreach (array('h1', 'h2', 'h3') as $headingType) {
          if (!empty($seoHeadings['product'][$headingType]['pos']) && !empty($product_info['seo_'.$headingType]) && $seoHeadings['product'][$headingType]['pos'] == 'topdesc') {
            $extraTopDesc .= '<'.$headingType.' class="seo_'.$headingType.'"'.(!empty($seoHeadings['product'][$headingType]['css']) ? ' style="'.$seoHeadings['product'][$headingType]['css'].'"' : '').'>'.$product_info['seo_'.$headingType].'</'.$headingType.'>';
          }
          
          if (!empty($seoHeadings['product'][$headingType]['pos']) && !empty($product_info['seo_'.$headingType]) && $seoHeadings['product'][$headingType]['pos'] == 'botdesc') {
            $extraBottomDesc .= '<'.$headingType.' class="seo_'.$headingType.'"'.(!empty($seoHeadings['product'][$headingType]['css']) ? ' style="'.$seoHeadings['product'][$headingType]['css'].'"' : '').'>'.$product_info['seo_'.$headingType].'</'.$headingType.'>';
          }
        }
        
        if ($this->config->get('mlseo_autolink')) {
          $autolinks = $this->db->query("SELECT * FROM " . DB_PREFIX . "url_autolink WHERE language_id =  '". (int) $this->config->get('config_language_id') . "'")->rows;
          
          foreach ($autolinks as $autolink) {
            $data['description'] = preg_replace('/\b('.$autolink['query'].')\b/', '<a href="'.$autolink['redirect'].'">$1</a>', $data['description']);
          }
        }
        
        $data['description'] = $extraTopDesc . $data['description'] . $extraBottomDesc;
      }
      ]]></add>
    </operation>
    
  </file>

  <file path="catalog/controller/product/search.php">
  
    <operation>
      <search position="replace"><![CDATA[$this->url->link('product/product', 'product_id=' . $result['product_id'] . $url)]]></search>
      <add position="replace"><![CDATA[$this->config->get('mlseo_fpp_remove_search') ? $this->url->link('product/product', 'product_id=' . $result['product_id']) : $this->url->link('product/product', 'product_id=' . $result['product_id'] . $url)]]></add>
    </operation>
    
    <operation error="skip">
      <search position="replace"><![CDATA[$this->document->addLink($this->url->link('product/search', '']]></search>
      <add position="replace"><![CDATA[$this->document->addLink($this->url->link('product/search', (isset($this->request->get['tag']) ? 'tag='.$this->request->get['tag'] : '')]]></add>
    </operation>

  </file>  
  <!-- end path manager-->

  <file path="catalog/controller/common/footer.php">
    
    <operation>
      <search position="after"><![CDATA[function index() {]]></search>
      <add position="after"><![CDATA[
      $seo_meta = $this->config->get('mlseo_store');
    
      if (!empty($seo_meta[$this->config->get('config_store_id')]['gg_analytics']) && !empty($seo_meta[$this->config->get('config_store_id')]['gg_enhanced'])) {
        $this->document->addScript('catalog/view/javascript/gkdAnalytics.js', 'header');
      }
      ]]></add>
    </operation>
    
  </file>
  
  <file path="catalog/controller/common/header.php">
    
    <operation>
      <search position="after"><![CDATA[function index() {]]></search>
      <add position="after"><![CDATA[
      $this->load->model('tool/seo_package');
      $this->model_tool_seo_package->metaRobots();
      $this->model_tool_seo_package->checkCanonical();
      $this->model_tool_seo_package->hrefLang();
      $this->model_tool_seo_package->richSnippets();
      $this->model_tool_seo_package->ggAnalytics();
      
      if (version_compare(VERSION, '2', '>=')) {
        $data['mlseo_meta'] = $this->document->renderSeoMeta();
      } else {
        $this->data['mlseo_meta'] = $this->document->renderSeoMeta();
      }
      
      $seoTitlePrefix = $this->config->get('mlseo_title_prefix');
      $seoTitlePrefix = isset($seoTitlePrefix[$this->config->get('config_store_id').$this->config->get('config_language_id')]) ? $seoTitlePrefix[$this->config->get('config_store_id').$this->config->get('config_language_id')] : '';
      
      $seoTitleSuffix = $this->config->get('mlseo_title_suffix');
      $seoTitleSuffix = isset($seoTitleSuffix[$this->config->get('config_store_id').$this->config->get('config_language_id')]) ? $seoTitleSuffix[$this->config->get('config_store_id').$this->config->get('config_language_id')] : '';

      if (version_compare(VERSION, '2', '<')) {
        if ($this->config->get('mlseo_fix_search')) {
          $this->data['mlseo_fix_search'] = true;
          $this->data['csp_search_url'] = $this->url->link('product/search');
          $this->data['csp_search_url_param'] = $this->url->link('product/search', 'search=%search%');
        }
      }
      ]]></add>
    </operation>
    
    <operation error="skip">
      <search position="replace"><![CDATA[$data['title'] = $this->document->getTitle();]]></search>
      <add position="replace"><![CDATA[
        //$data['title'] = $this->document->getTitle();
        $data['title'] = (isset($seoTitlePrefix) ? $seoTitlePrefix : '') . $this->document->getTitle() . (isset($seoTitleSuffix) ? $seoTitleSuffix : '');
      ]]></add>
    </operation>
    
    <operation error="skip" v="1.5">
      <search position="replace"><![CDATA[$this->data['title'] = $this->document->getTitle();]]></search>
      <add position="replace"><![CDATA[
        //$this->data['title'] = $this->document->getTitle();
        $this->data['title'] = (isset($seoTitlePrefix) ? $seoTitlePrefix : '') . $this->document->getTitle() . (isset($seoTitleSuffix) ? $seoTitleSuffix : '');
      ]]></add>
    </operation>
    
    <operation error="skip" v="1.5">
      <search position="replace"><![CDATA[$this->data['name'] = $this->config->get('config_name');]]></search>
      <add position="replace"><![CDATA[
      //$this->data['name'] = $this->config->get('config_name');
      $this->data['name'] = (isset($seoTitlePrefix) ? $seoTitlePrefix : '') . $this->config->get('config_name') . (isset($seoTitleSuffix) ? $seoTitleSuffix : '');
      ]]></add>
    </operation>
    
    <operation error="skip" v="1.5">
      <search position="replace"><![CDATA[$this->data['action'] = $this->url->link('common/home');]]></search>
      <add position="replace"><![CDATA[if ($this->config->get('mlseo_enabled')) { $this->data['action'] = ''; }]]></add>
    </operation>

    <operation error="skip" v="1.5">
      <search position="replace" offset="6"><![CDATA[$this->session->data['language'] = $this->request->post['language_code'];]]></search>
      <add position="replace" offset="6"><![CDATA[
        if ($this->config->get('mlseo_enabled')) {
          $this->session->data['language'] = $this->request->post['language_code'];
          if(isset($route) && isset($url)){
            $this->redirect($this->url->link($route, $url));
          }
          else $this->redirect($this->url->link('common/home'));
        }
      ]]></add>
    </operation>
    
  </file>

  <file path="catalog/controller/common/language.php" error="skip" v="2.0">
    
    <operation>
      <search position="replace"><![CDATA[$this->response->redirect($this->request->post['redirect']);]]></search>
      <add position="replace"><![CDATA[
      if (!empty($this->request->post["code"])) {
        $this->load->model('localisation/language');
        $languagesByCode = $this->model_localisation_language->getLanguages();
        
        if (isset($languagesByCode[$this->request->post['code']]['language_id'])) {
          $this->config->set('config_language_id', $languagesByCode[$this->request->post['code']]['language_id']);
        }
      }
      
      if (isset($this->request->server['HTTPS']) && (($this->request->server['HTTPS'] == 'on') || ($this->request->server['HTTPS'] == '1'))) {
        $connection = 'SSL';
      } else {
        $connection = 'NONSSL';
      }
    
      $redir_route = $this->request->post['redirect'];
      
      if (substr($redir_route, 0, 1) == '/') {
        $this->response->redirect($this->request->post['redirect']); 
      }
      
      if (substr($redir_route, 0, 4) == 'http') {
        $redir_route = 'common/home';
      }
      
      if ($redir_params = strstr($redir_route, '&')) {
        $redir_route = str_replace($redir_params, '', $redir_route);
      } else {
        $redir_params = '';
      }
      
      // handle sub-stores rewriting
      if ($this->config->get('mlseo_store_mode')) {
        // set store currency
        $this->session->data['currency'] = $this->config->get('config_currency');
        unset($this->session->data['shipping_method']);
        unset($this->session->data['shipping_methods']);
        
        $lang_to_store = $this->config->get('mlseo_lang_to_store');
      }
      
      if (!empty($lang_to_store)) {
        $this->response->redirect(str_replace(array(rtrim($this->config->get('config_url'), '/'), rtrim($this->config->get('config_ssl'), '/')), $lang_to_store[$this->request->post['code']], $this->url->link($redir_route, str_replace('&amp;', '&', $redir_params), $connection)));
      }
      
      $this->response->redirect($this->url->link($redir_route, str_replace('&amp;', '&', $redir_params), $connection));
      ]]></add>
    </operation>
    <operation>
      <search position="replace"><![CDATA[if (isset($this->request->post['code'])) {]]></search>
      <add position="replace"><![CDATA[if (isset($this->request->post['code']) && !$this->config->get('mlseo_store_mode')) {
      $lgCodes = array_flip((array) $this->config->get('mlseo_lang_codes'));
      
      if (!empty($lgCodes[$this->request->post['code']])) {
        $this->config->set('config_language', $this->request->post['code']);
        $this->config->set('config_language_id', $lgCodes[$this->request->post['code']]);
      }
      ]]></add>
    </operation>
    <operation>
      <search position="replace"><![CDATA[$data['redirect'] = $this->url->link('common/home');]]></search>
      <add position="replace"><![CDATA[$data['redirect'] = 'common/home';]]></add>
    </operation>
    <operation>
      <search position="after"><![CDATA[unset($url_data['route']);]]></search>
      <add position="after"><![CDATA[
      unset($url_data['site_language']);
      unset($url_data['_route_']);
    ]]></add>
    </operation>
    <operation error="skip">
      <search position="replace"><![CDATA[$data['redirect'] = $this->url->link($route, $url, $this->request->server['HTTPS']);]]></search>
      <add position="replace"><![CDATA[$data['redirect'] = $route . $url;]]></add>
    </operation>
    
  </file>
  
  <!--file path="catalog/controller/common/language.php" error="skip" v="2.0" i="ocstore">
  
    <operation error="skip">
      <search position="replace"><![CDATA[$data['redirect'] = $this->url->link($route, $url, isset($this->request->server['HTTPS']) && (($this->request->server['HTTPS'] == 'on') || ($this->request->server['HTTPS'] == '1')));]]></search>
      <add position="replace"><![CDATA[$data['redirect'] = 'common/home';]]></add>
    </operation>
    
  </file-->
  <file path="catalog/controller/common/language.php" error="skip" v="2.0" i="ocstore">
  
    <operation error="skip">
      <search position="replace"><![CDATA[$data['redirect'] = $this->url->link($route, $url, isset($this->request->server['HTTPS']) && (($this->request->server['HTTPS'] == 'on') || ($this->request->server['HTTPS'] == '1')));]]></search>
      <add position="replace"><![CDATA[$data['redirect'] = $route . $url;]]></add>
    </operation>
    
  </file>
  
  <file path="catalog/controller/module/language.php" error="skip" v="1.5">
    
    <operation>
      <search position="replace"><![CDATA[$this->redirect($this->request->post['redirect']);]]></search>
      <add position="replace"><![CDATA[
        if (isset($this->request->server['HTTPS']) && (($this->request->server['HTTPS'] == 'on') || ($this->request->server['HTTPS'] == '1'))) {
          $connection = 'SSL';
            } else {
          $connection = 'NONSSL';
        }
        
        $redir_route = $this->request->post['redirect'];
        
        if (substr($redir_route, 0, 4) == 'http') {
          $redir_route = 'common/home';
        }
      
        if ($redir_params = strstr($redir_route, '&')) {
          $redir_route = str_replace($redir_params, '', $redir_route);
        } else {
          $redir_params = '';
        }
        
        $this->redirect($this->url->link($redir_route, str_replace('&amp;', '&', $redir_params), $connection));
      ]]></add>
    </operation>
    <operation>
      <search position="replace"><![CDATA[$this->data['redirect'] = $this->url->link('common/home');]]></search>
      <add position="replace"><![CDATA[$this->data['redirect'] = 'common/home';]]></add>
    </operation>
    <operation>
      <search position="replace"><![CDATA[$this->data['redirect'] = $this->url->link($route, $url, $connection);]]></search>
      <add position="replace"><![CDATA[$this->data['redirect'] = $route . $url;]]></add>
    </operation>
    <operation>
      <search position="after"><![CDATA[unset($data['_route_']);]]></search>
      <add position="after"><![CDATA[unset($data['site_language']);]]></add>
    </operation>
    
  </file>
  
  <file path="admin/language/english/catalog/*.php" error="skip">
  
    <operation error="skip">
      <search position="replace"><![CDATA['SEO Keyword:<br /><span class="help">Do not use spaces instead replace spaces with - and make sure the keyword is globally unique.</span>']]></search>
      <add position="replace"><![CDATA['SEO Keyword:']]></add>
    </operation>
    
  </file>
  
  <!--file path="admin/controller/catalog/category.php">

    <operation>
      <search position="replace" offset="4"><![CDATA[foreach ($this->request->post['category_description'] as $language_id => $value) {]]></search>
      <add position="replace" offset="4" trim="true"><![CDATA[
        $default_lang = $this->db->query("SELECT language_id FROM " . DB_PREFIX . "language WHERE code = '" . $this->config->get('config_language') . "'")->row['language_id'];
        foreach ($this->request->post['category_description'] as $language_id => $value) {
          if ($language_id == $default_lang) {
            if ((strlen(utf8_decode($value['name'])) < 2) || (strlen(utf8_decode($value['name'])) > 255)) {
              $this->error['name'][$language_id] = $this->language->get('error_name');
            }
          }
        }
      ]]></add>
    </operation>
    
    <operation error="skip" v="2.0">
      <search position="replace" offset="3"><![CDATA[if ((utf8_strlen($value['meta_title']) < 3) || (utf8_strlen($value['meta_title']) > 255)) {]]></search>
      <add position="replace" offset="3" trim="true"><![CDATA[]]></add>
    </operation>
    
  </file>
  
  <file path="admin/controller/catalog/information.php">
    
    <operation>
      <search position="replace" offset="8"><![CDATA[foreach ($this->request->post['information_description'] as $language_id => $value) {]]></search>
      <add position="replace" offset="8" trim="true"><![CDATA[
        $default_lang = $this->db->query("SELECT language_id FROM " . DB_PREFIX . "language WHERE code = '" . $this->config->get('config_language') . "'")->row['language_id'];
        foreach ($this->request->post['information_description'] as $language_id => $value) {
          if ($language_id == $default_lang) {
            if ((utf8_strlen($value['title']) < 3) || (utf8_strlen($value['title']) > 64)) {
              $this->error['title'][$language_id] = $this->language->get('error_title');
            }
          
            if (utf8_strlen($value['description']) < 3) {
              $this->error['description'][$language_id] = $this->language->get('error_description');
            }
          }
        }
      ]]></add>
    </operation>
    
    <operation error="skip" v="2.0">
      <search position="replace" offset="3"><![CDATA[if ((utf8_strlen($value['meta_title']) < 3) || (utf8_strlen($value['meta_title']) > 255)) {]]></search>
      <add position="replace" offset="3" trim="true"><![CDATA[]]></add>
    </operation>
    
  </file>
  
  <file path="admin/controller/catalog/product.php">
  
    <operation>
      <search position="replace" offset="4"><![CDATA[foreach ($this->request->post['product_description'] as $language_id => $value) {]]></search>
      <add position="replace" offset="4" trim="true"><![CDATA[
        $default_lang = $this->db->query("SELECT language_id FROM " . DB_PREFIX . "language WHERE code = '" . $this->config->get('config_language') . "'")->row['language_id'];
        foreach ($this->request->post['product_description'] as $language_id => $value) {
          if ($language_id == $default_lang) {
            if ((strlen(utf8_decode($value['name'])) < 1) || (strlen(utf8_decode($value['name'])) > 255)) {
              $this->error['name'][$language_id] = $this->language->get('error_name');
            }
          }
        }
      ]]></add>
    </operation>
    
    <operation error="skip" v="2.0">
      <search position="replace" offset="3"><![CDATA[if ((utf8_strlen($value['meta_title']) < 3) || (utf8_strlen($value['meta_title']) > 255)) {]]></search>
      <add position="replace" offset="3" trim="true"><![CDATA[]]></add>
    </operation>
    
  </file-->
  
  <file path="admin/controller/catalog/product.php" v="3">
    
    <operation error="skip">
      <search position="replace"><![CDATA[if ($this->request->post['product_seo_url']) {]]></search>
      <add position="replace"><![CDATA[if (false) {]]></add>
    </operation>
    
  </file><file path="admin/controller/catalog/product.php">
    
    <operation error="skip">
      <search position="replace"><![CDATA[if ((utf8_strlen($value['meta_title']) < 3) || (utf8_strlen($value['meta_title']) > 255)) {]]></search>
      <add position="replace"><![CDATA[if (false && (utf8_strlen($value['meta_title']) < 3) || (utf8_strlen($value['meta_title']) > 255)) {]]></add>
    </operation>
    
    <operation error="skip">
      <search position="replace"><![CDATA[if ((utf8_strlen($value['meta_title']) < 1) || (utf8_strlen($value['meta_title']) > 255)) {]]></search>
      <add position="replace"><![CDATA[if (false && (utf8_strlen($value['meta_title']) < 1) || (utf8_strlen($value['meta_title']) > 255)) {]]></add>
    </operation>
    
  </file><file path="admin/controller/catalog/product.php">
  
    <operation error="skip">
      <search position="before"><![CDATA[$this->response->setOutput($this->load->view('catalog/product_form]]></search>
      <add position="before"><![CDATA[
        $this->load->model('catalog/seo_package');
        
        $data['seo_multistore_active'] = $this->config->get('mlseo_multistore');
        
        if ($this->config->get('mlseo_multistore')) {
          if (isset($this->request->post['seo_product_description'])) {
            $data['seo_product_description'] = $this->request->post['seo_product_description'];
          } elseif (isset($this->request->get['product_id'])) {
            $data['seo_product_description'] = $this->model_catalog_seo_package->getSeoDescriptions('product', $this->request->get['product_id']);
          } else {
            $data['seo_product_description'] = array();
          }
        }
        
        if (isset($this->request->post['meta_robots'])) {
          $data['meta_robots'] = $this->request->post['meta_robots'];
        } elseif (!empty($product_info['meta_robots'])) {
          $data['meta_robots'] = $product_info['meta_robots'];
        } else {
          $data['meta_robots'] = '';
        }
        
        if (isset($this->request->post['seo_canonical'])) {
          $data['seo_canonical'] = $this->request->post['seo_canonical'];
        } elseif (!empty($product_info['seo_canonical'])) {
          $data['seo_canonical'] = $product_info['seo_canonical'];
        } else {
          $data['seo_canonical'] = '';
        }
        
        unset($this->session->data['gkd_seorand']);
        
        $this->load->model('tool/gkd_lib');
        $data['item_type'] = 'product';
        $data['seo_package_tab'] = $this->model_tool_gkd_lib->fetch('module/complete_seo_inc', $data, 'seo_tab');
        $data['seo_package_snippet_robots'] = $this->model_tool_gkd_lib->fetch('module/complete_seo_inc', $data, 'snippet_robots');
        $data['seo_package_snippet_seo_canonical'] = $this->model_tool_gkd_lib->fetch('module/complete_seo_inc', $data, 'seo_canonical');
        $data['seo_package_snippet_metas'] = $this->model_tool_gkd_lib->fetch('module/complete_seo_inc', $data, 'snippet_metas', 'all');
      ]]></add>
    </operation>
    
  </file><file path="admin/controller/catalog/product.php" v="1.5">
  
    <operation error="skip">
      <search position="before"><![CDATA[$this->template = 'catalog/product_form.tpl';]]></search>
      <add position="before"><![CDATA[
        $this->load->model('catalog/seo_package');
        
        $this->data['seo_multistore_active'] = $this->config->get('mlseo_multistore');
        
        if ($this->config->get('mlseo_multistore')) {
          if (isset($this->request->post['seo_product_description'])) {
            $this->data['seo_product_description'] = $this->request->post['seo_product_description'];
          } elseif (isset($this->request->get['product_id'])) {
            $this->data['seo_product_description'] = $this->model_catalog_seo_package->getSeoDescriptions('product', $this->request->get['product_id']);
          } else {
            $this->data['seo_product_description'] = array();
          }
        }
        
        if (isset($this->request->post['meta_robots'])) {
          $this->data['meta_robots'] = $this->request->post['meta_robots'];
        } elseif (!empty($product_info['meta_robots'])) {
          $this->data['meta_robots'] = $product_info['meta_robots'];
        } else {
          $this->data['meta_robots'] = '';
        }
        
        if (isset($this->request->post['seo_canonical'])) {
          $this->data['seo_canonical'] = $this->request->post['seo_canonical'];
        } elseif (!empty($product_info['seo_canonical'])) {
          $this->data['seo_canonical'] = $product_info['seo_canonical'];
        } else {
          $this->data['seo_canonical'] = '';
        }
        
        unset($this->session->data['gkd_seorand']);
        
        $this->load->model('tool/gkd_lib');
        $this->data['item_type'] = 'product';
        $this->data['seo_package_tab'] = $this->model_tool_gkd_lib->fetch('module/complete_seo_inc', $this->data, 'seo_tab');
        $this->data['seo_package_snippet_robots'] = $this->model_tool_gkd_lib->fetch('module/complete_seo_inc', $this->data, 'snippet_robots');
        $this->data['seo_package_snippet_metas'] = $this->model_tool_gkd_lib->fetch('module/complete_seo_inc', $this->data, 'snippet_metas', 'all');
      ]]></add>
    </operation>
    
  </file>
  
  <file path="admin/controller/catalog/category.php" v="3">
    
    <operation error="skip">
      <search position="replace"><![CDATA[if ($this->request->post['category_seo_url']) {]]></search>
      <add position="replace"><![CDATA[if (false) {]]></add>
    </operation>
    
  </file><file path="admin/controller/catalog/category.php">
  
    <operation error="skip">
      <search position="before"><![CDATA[$this->response->setOutput($this->load->view('catalog/category_form]]></search>
      <add position="before"><![CDATA[
        $this->load->model('catalog/seo_package');
        
        $data['seo_multistore_active'] = $this->config->get('mlseo_multistore');
        
        if ($this->config->get('mlseo_multistore')) {
          if (isset($this->request->post['seo_category_description'])) {
            $data['seo_category_description'] = $this->request->post['seo_category_description'];
          } elseif (isset($this->request->get['category_id'])) {
            $data['seo_category_description'] = $this->model_catalog_seo_package->getSeoDescriptions('category', $this->request->get['category_id']);
          } else {
            $data['seo_category_description'] = array();
          }
        }
        
        unset($this->session->data['gkd_seorand']);
        
        $this->load->model('tool/gkd_lib');
        $data['item_type'] = 'category';
        $data['seo_package_tab'] = $this->model_tool_gkd_lib->fetch('module/complete_seo_inc', $data, 'seo_tab');
        $data['seo_package_snippet_metas'] = $this->model_tool_gkd_lib->fetch('module/complete_seo_inc', $data, 'snippet_metas', 'all');
      ]]></add>
    </operation>
    
    <operation error="skip">
      <search position="replace"><![CDATA[if ((utf8_strlen($value['meta_title']) < 3) || (utf8_strlen($value['meta_title']) > 255)) {]]></search>
      <add position="replace"><![CDATA[if (false && (utf8_strlen($value['meta_title']) < 3) || (utf8_strlen($value['meta_title']) > 255)) {]]></add>
    </operation>
    
  </file>
  
  <file path="admin/controller/catalog/information.php" v="3">
    
    <operation error="skip">
      <search position="replace"><![CDATA[if ($this->request->post['information_seo_url']) {]]></search>
      <add position="replace"><![CDATA[if (false) {]]></add>
    </operation>
    
  </file><file path="admin/controller/catalog/information.php">
  
    <operation error="skip">
      <search position="before"><![CDATA[$this->response->setOutput($this->load->view('catalog/information_form]]></search>
      <add position="before"><![CDATA[
        $this->load->model('catalog/seo_package');
        
        $data['seo_multistore_active'] = $this->config->get('mlseo_multistore');
        
        if ($this->config->get('mlseo_multistore')) {
          if (isset($this->request->post['seo_information_description'])) {
            $data['seo_information_description'] = $this->request->post['seo_information_description'];
          } elseif (isset($this->request->get['information_id'])) {
            $data['seo_information_description'] = $this->model_catalog_seo_package->getSeoDescriptions('information', $this->request->get['information_id']);
          } else {
            $data['seo_information_description'] = array();
          }
        }
        
        if (isset($this->request->post['meta_robots'])) {
          $data['meta_robots'] = $this->request->post['meta_robots'];
        } elseif (!empty($information_info['meta_robots'])) {
          $data['meta_robots'] = $information_info['meta_robots'];
        } else {
          $data['meta_robots'] = '';
        }
        
        unset($this->session->data['gkd_seorand']);
        
        $this->load->model('tool/gkd_lib');
        $data['item_type'] = 'information';
        $data['seo_package_tab'] = $this->model_tool_gkd_lib->fetch('module/complete_seo_inc', $data, 'seo_tab');
        $data['seo_package_snippet_robots'] = $this->model_tool_gkd_lib->fetch('module/complete_seo_inc', $data, 'snippet_robots');
        $data['seo_package_snippet_metas'] = $this->model_tool_gkd_lib->fetch('module/complete_seo_inc', $data, 'snippet_metas', 'all');
      ]]></add>
    </operation>
    
    <operation error="skip">
      <search position="replace"><![CDATA[if ((utf8_strlen($value['meta_title']) < 3) || (utf8_strlen($value['meta_title']) > 255)) {]]></search>
      <add position="replace"><![CDATA[if (false && (utf8_strlen($value['meta_title']) < 3) || (utf8_strlen($value['meta_title']) > 255)) {]]></add>
    </operation>
    
  </file>
  
  <file path="admin/controller/catalog/manufacturer.php" v="3">
  
     <operation error="skip">
        <search position="replace"><![CDATA[if ($this->request->post['manufacturer_seo_url']) {]]></search>
        <add position="replace"><![CDATA[if (false) {]]></add>
      </operation>
      
  </file><file path="admin/controller/catalog/manufacturer.php" v="3">
    
    <operation error="skip">
      <search position="replace"><![CDATA[if ($this->request->post['manufacturer_seo_url']) {]]></search>
      <add position="replace"><![CDATA[if (false) {]]></add>
    </operation>
    
  </file><file path="admin/controller/catalog/manufacturer.php">
  
    <operation error="skip">
      <search position="before"><![CDATA[$this->response->setOutput($this->load->view('catalog/manufacturer_form]]></search>
      <add position="before"><![CDATA[
        $this->load->language('catalog/product');
        $this->load->language('catalog/manufacturer');
        
        $this->load->model('catalog/seo_package');
        
        $data['seo_multistore_active'] = $this->config->get('mlseo_multistore');
        $data['seo_enabled'] = $this->config->get('mlseo_enabled');
        
        if (isset($this->request->post['seo_manufacturer_description'])) {
          $data['seo_manufacturer_description'] = $this->request->post['seo_manufacturer_description'];
        } elseif (isset($this->request->get['manufacturer_id'])) {
          $data['seo_manufacturer_description'] = $this->model_catalog_seo_package->getSeoDescriptions('manufacturer', $this->request->get['manufacturer_id']);
        } else {
          $data['seo_manufacturer_description'] = array();
        }
        
        unset($this->session->data['gkd_seorand']);
        
        if (version_compare(VERSION, '3', '<')) {
          $this->load->model('localisation/language');
          $data['languages'] = $this->model_localisation_language->getLanguages();
        }
        
        foreach ($data['languages'] as $k => $language) {
          if (version_compare(VERSION, '2.2', '>=')) {
            $data['languages'][$k]['image'] = 'language/'.$language['code'].'/'.$language['code'].'.png';
          } else {
            $data['languages'][$k]['image'] = 'view/image/flags/'. $language['image'];
          }
        }
        
        $this->load->model('tool/gkd_lib');
        $data['item_type'] = 'manufacturer';
        $data['seo_package_tab'] = $this->model_tool_gkd_lib->fetch('module/complete_seo_inc', $data, 'seo_tab');
        $data['seo_package_snippet_metas'] = $this->model_tool_gkd_lib->fetch('module/complete_seo_inc', $data, 'snippet_metas', 'all');
        
        if (version_compare(VERSION, '3', '<')) {
          $data['tab_general'] = $this->language->get('tab_general');
          
          $ext = version_compare(VERSION, '2.2', '<') ? '.tpl': '';
          
          $this->response->setOutput($this->load->view('catalog/seo_manufacturer_form'.$ext, $data));
          return;
        }
      ]]></add>
    </operation>
    
  </file><!--file path="admin/controller/catalog/manufacturer.php" v="1.5">
  
    <operation error="skip">
      <search position="after"><![CDATA[$this->template = 'catalog/manufacturer_form.tpl';]]></search>
      <add position="after"><![CDATA[
        $this->load->language('catalog/product');
        $this->load->language('catalog/manufacturer');
        
        $this->load->model('catalog/seo_package');
        
        $this->data['seo_multistore_active'] = $this->config->get('mlseo_multistore');
        $this->data['seo_enabled'] = $this->config->get('mlseo_enabled');
        
        if (isset($this->request->post['seo_manufacturer_description'])) {
          $this->data['seo_manufacturer_description'] = $this->request->post['seo_manufacturer_description'];
        } elseif (isset($this->request->get['manufacturer_id'])) {
          $this->data['seo_manufacturer_description'] = $this->model_catalog_seo_package->getSeoDescriptions('manufacturer', $this->request->get['manufacturer_id']);
        } else {
          $this->data['seo_manufacturer_description'] = array();
        }
        
        unset($this->session->data['gkd_seorand']);
        
        if (version_compare(VERSION, '3', '<')) {
          $this->load->model('localisation/language');
          $this->data['languages'] = $this->model_localisation_language->getLanguages();
        }
        
        $this->load->model('tool/gkd_lib');
        $this->data['item_type'] = 'manufacturer';
        $this->data['seo_package_tab'] = $this->model_tool_gkd_lib->fetch('module/complete_seo_inc', $this->data, 'seo_tab');
        $this->data['seo_package_snippet_metas'] = $this->model_tool_gkd_lib->fetch('module/complete_seo_inc', $this->data, 'snippet_metas', 'all');
        
        $this->data['tab_general'] = $this->language->get('tab_general');

        //$this->template = 'catalog/seo_manufacturer_form.tpl';
      ]]></add>
    </operation>
    
  </file-->
  
  <file path="admin/model/catalog/category.php" v="3">
  
    <operation error="skip">
      <search position="replace" index="0"><![CDATA[$this->db->query("DELETE FROM `" . DB_PREFIX . "seo_url` WHERE query = 'category_id=" . (int)$category_id . "'");]]></search>
      <add position="replace" index="0"><![CDATA[//$this->db->query("DELETE FROM `" . DB_PREFIX . "seo_url` WHERE query = 'category_id=" . (int)$category_id . "'");]]></add>
    </operation>

  </file><file path="admin/model/catalog/category.php">

    <operation>
      <search position="after"><![CDATA[public function addCategory($data) {]]></search>
      <add position="after"><![CDATA[    $default_lang = $this->db->query("SELECT language_id FROM " . DB_PREFIX . "language WHERE code = '" . $this->config->get('config_language') . "'")->row['language_id'];
    $isInsertOrEdit = (strpos(__METHOD__, 'edit') !== false) ? 'edit' : 'insert';]]></add>
    </operation>
    
    <operation>
      <search position="before"><![CDATA[foreach ($data['category_description'] as $language_id => $value) {]]></search>
      <add position="before"><![CDATA[
      if (version_compare(VERSION, '3', '>=')) {
        $currentKeywordsQuery = $this->db->query("SELECT * FROM " . DB_PREFIX . "seo_url WHERE query = 'category_id=" . (int)$category_id . "'")->rows;
        $this->{'db'}->query("DELETE FROM " . DB_PREFIX . "seo_url WHERE query = 'category_id=" . (int)$category_id . "'");
      } else {
        $currentKeywordsQuery = $this->db->query("SELECT * FROM " . DB_PREFIX . "url_alias WHERE query = 'category_id=" . (int)$category_id . "'")->rows;
        $this->{'db'}->query("DELETE FROM " . DB_PREFIX . "url_alias WHERE query = 'category_id=" . (int)$category_id . "'");
      }
      
      $currentKeywords = array();
      
      foreach ($currentKeywordsQuery as $curKeyword) {
        $currentKeywords[(isset($curKeyword['store_id']) ? $curKeyword['store_id'] : 0)][(isset($curKeyword['language_id']) ? $curKeyword['language_id'] : $default_lang)] = $curKeyword['keyword'];
      }
      
      if ($this->config->get('mlseo_multistore')) {
        $this->load->model('catalog/seo_package');
        $this->model_catalog_seo_package->setSeoDescriptions('category', $data, $category_id, $isInsertOrEdit, $currentKeywords);
      }
      ]]></add>
    </operation>
    
    <operation>
      <search position="before"><![CDATA[$this->db->query("INSERT INTO " . DB_PREFIX . "category_description SET]]></search>
      <add position="before"><![CDATA[
      if ($this->config->get('mlseo_enabled')) {
        if (isset($data['keyword'])) {
          unset($data['keyword']);
        }
        
        if ($this->config->get('mlseo_'.$isInsertOrEdit.'autotitle')) {
          $value['name'] = ($value['name']) ? $value['name'] : $data['category_description'][$default_lang]['name'];
          $value['description'] = ($value['description']) ? $value['description'] : $data['category_description'][$default_lang]['description'];
        }

        $this->load->model('tool/seo_package');
        
        $data['category_id'] = $category_id; // add id into dataset for use with patterns
        
        $seo_kw = '';
        
        if (empty($value['seo_keyword']) && $this->config->get('mlseo_'.$isInsertOrEdit.'autourl')) {
          $seo_kw = $this->model_tool_seo_package->transformCategory($this->config->get('mlseo_category_url_pattern'), $language_id, $data);
        } else if (!empty($value['seo_keyword'])) {
          $seo_kw = html_entity_decode($value['seo_keyword'], ENT_QUOTES, 'UTF-8');
        }
        
        if ($seo_kw) {
          $seo_kw = $this->model_tool_seo_package->filter_seo($seo_kw, 'category', $category_id, $language_id);
        }

        $url_alias_table = version_compare(VERSION, '3', '>=') ? 'seo_url' : 'url_alias';
        
        if ($this->config->get('mlseo_backup')) {
          $currentKeyword = isset($currentKeywords[0][$language_id]) ? $currentKeywords[0][$language_id] : '';
          
          if ($currentKeyword && $currentKeyword != $seo_kw) {
            $this->db->query("INSERT IGNORE INTO " . DB_PREFIX . "url_redirect SET query = '/" . $this->db->escape($currentKeyword) . "', redirect = 'product/category&path=" . (int) $category_id . "', language_id = '" . (int) $language_id . "'");
          }
        }
        
        if (version_compare(VERSION, '3', '>=')) {
          $this->db->query("INSERT INTO " . DB_PREFIX . "seo_url SET query = 'category_id=" . (int)$category_id . "', language_id = '" . (int)$language_id . "', keyword = '" . $this->db->escape($seo_kw) . "', store_id = 0");
        } else if ($this->config->get('mlseo_ml_mode')) {
          $this->db->query("INSERT INTO " . DB_PREFIX . "url_alias SET query = 'category_id=" . (int)$category_id . "', language_id = '" . (int)$language_id . "', keyword = '" . $this->db->escape($seo_kw) . "'");
        } else {
          $this->db->query("INSERT INTO " . DB_PREFIX . "url_alias SET query = 'category_id=" . (int)$category_id . "', keyword = '" . $this->db->escape($seo_kw) . "'");
        }
        
        if (!$value['meta_title'] && $this->config->get('mlseo_'.$isInsertOrEdit.'autoseotitle')) {
          $value['meta_title'] = $this->model_tool_seo_package->transformCategory($this->config->get('mlseo_category_title_pattern'), $language_id, $data);
        }
        if (!trim(strip_tags(html_entity_decode($value['description'], ENT_QUOTES, 'UTF-8'))) && $this->config->get('mlseo_'.$isInsertOrEdit.'autodesc')) {
          $value['description'] = $this->model_tool_seo_package->transformCategory($this->config->get('mlseo_category_full_desc_pattern'), $language_id, $data);
        }
        if (!$value['meta_description'] && $this->config->get('mlseo_'.$isInsertOrEdit.'autometadesc')) {
          $value['meta_description'] = $this->model_tool_seo_package->transformCategory($this->config->get('mlseo_category_description_pattern'), $language_id, $data);
        }
        if (!$value['meta_keyword'] && $this->config->get('mlseo_'.$isInsertOrEdit.'autometakeyword')) {
          $value['meta_keyword'] = $this->model_tool_seo_package->transformCategory($this->config->get('mlseo_category_keyword_pattern'), $language_id, $data);
        }
        if (empty($value['seo_h1']) && $this->config->get('mlseo_'.$isInsertOrEdit.'autoh1')) {
          $value['seo_h1'] = $this->model_tool_seo_package->transformCategory($this->config->get('mlseo_category_h1_pattern'), $language_id, $data);
        }
        if (empty($value['seo_h2']) && $this->config->get('mlseo_'.$isInsertOrEdit.'autoh2')) {
          $value['seo_h2'] = $this->model_tool_seo_package->transformCategory($this->config->get('mlseo_category_h2_pattern'), $language_id, $data);
        }
        if (empty($value['seo_h3']) && $this->config->get('mlseo_'.$isInsertOrEdit.'autoh3')) {
          $value['seo_h3'] = $this->model_tool_seo_package->transformCategory($this->config->get('mlseo_category_h3_pattern'), $language_id, $data);
        }
      }
      ]]></add>
    </operation>
    
    <operation error="skip" v="1.5 - 2.x">
      <search position="replace"><![CDATA[if ($data['keyword']) {]]></search>
      <add position="replace"><![CDATA[if (!empty($data['keyword']) && !$this->config->get('mlseo_enabled')) {]]></add>
    </operation>
    
    <operation error="skip" v="1.5 - 2.x">
      <search position="replace" index="0"><![CDATA[$this->db->query("DELETE FROM " . DB_PREFIX . "url_alias WHERE query = 'category_id=" . (int)$category_id]]></search>
      <add position="replace" index="0"><![CDATA[    if (!$this->config->get('mlseo_enabled'))
      $this->db->query("DELETE FROM " . DB_PREFIX . "url_alias WHERE query = 'category_id=" . (int)$category_id]]></add>
    </operation>
    
  </file><file path="admin/model/catalog/category.php">
    
    <operation>
      <search position="after"><![CDATA[public function editCategory($category_id, $data) {]]></search>
      <add position="after"><![CDATA[    $default_lang = $this->db->query("SELECT language_id FROM " . DB_PREFIX . "language WHERE code = '" . $this->config->get('config_language') . "'")->row['language_id'];
    $isInsertOrEdit = (strpos(__METHOD__, 'edit') !== false) ? 'edit' : 'insert';]]></add>
    </operation>
    
    <operation>
      <search position="replace"><![CDATA[$this->db->query("INSERT INTO " . DB_PREFIX . "category_description SET]]></search>
      <add position="replace"><![CDATA[
        $value['seo_h1'] = empty($value['seo_h1']) ? '' : $value['seo_h1'];
        $value['seo_h2'] = empty($value['seo_h2']) ? '' : $value['seo_h2'];
        $value['seo_h3'] = empty($value['seo_h3']) ? '' : $value['seo_h3'];
        
        $extra_fields = '';
        if ($this->config->get('mlseo_enabled')) {
          $extra_fields = "seo_keyword = '" . $this->db->escape(isset($seo_kw) ? $seo_kw : '') . "', seo_h1 = '" . $this->db->escape($value['seo_h1']) . "', seo_h2 = '" . $this->db->escape($value['seo_h2']) . "', seo_h3 = '" . $this->db->escape($value['seo_h3']) . "', ";
          if (substr(VERSION, 0, 1) == 1) {
            $extra_fields .= "meta_title = '" . $this->db->escape($value['meta_title']) . "', ";
          }
        }
        
        $this->db->query("INSERT INTO " . DB_PREFIX . "category_description SET " . $extra_fields . "]]></add>
    </operation>
    
    <operation>
      <search position="replace"><![CDATA[$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "category_description]]></search>
      <add position="replace"><![CDATA[
      $extra_select = '';
      
      $url_alias_table = version_compare(VERSION, '3', '>=') ? 'seo_url' : 'url_alias';
      
      if ($this->config->get('mlseo_enabled')) {
        if (version_compare(VERSION, '3', '>=') || ($this->config->get('mlseo_multistore') && $this->config->get('mlseo_ml_mode'))) {
          $extra_select = ",(SELECT keyword FROM " . DB_PREFIX . $url_alias_table . " u WHERE query = 'category_id=".$category_id."' AND (u.language_id = d.language_id OR u.language_id = 0) AND store_id = 0 LIMIT 1) AS seo_keyword";
        } else if ($this->config->get('mlseo_multistore')) {
          $extra_select = ",(SELECT keyword FROM " . DB_PREFIX . $url_alias_table . " u WHERE query = 'category_id=".$category_id."' AND store_id = 0 LIMIT 1) AS seo_keyword";
        } else if ($this->config->get('mlseo_ml_mode')) {
          $extra_select = ",(SELECT keyword FROM " . DB_PREFIX . $url_alias_table . " u WHERE query = 'category_id=".$category_id."' AND (u.language_id = d.language_id OR u.language_id = 0) LIMIT 1) AS seo_keyword";
        } else {
          $extra_select = ",(SELECT keyword FROM " . DB_PREFIX . $url_alias_table . " WHERE query = 'category_id=".$category_id."' LIMIT 1) AS seo_keyword";
        }
      }
      
      $query = $this->db->query("SELECT * ".$extra_select." FROM " . DB_PREFIX . "category_description d]]></add>
    </operation>
    
    <operation>
      <search position="after"><![CDATA[$result['name'],]]></search>
      <add position="after"><![CDATA[        'seo_keyword'     => isset($result['seo_keyword']) ? $result['seo_keyword'] : '',
        'seo_h1'       => isset($result['seo_h1']) ? $result['seo_h1'] : '',
        'seo_h2'       => isset($result['seo_h2']) ? $result['seo_h2'] : '',
        'seo_h3'       => isset($result['seo_h3']) ? $result['seo_h3'] : '',]]></add>
    </operation>
    
    <operation v="1.5">
      <ignoreif><![CDATA[$this->event->trigger]]></ignoreif>
      <search position="after"><![CDATA[$result['name'],]]></search>
      <add position="after"><![CDATA[        'meta_title'     => isset($result['meta_title']) ? $result['meta_title'] : '',]]></add>
    </operation>
    
    <!--operation>
      <search position="after"><![CDATA[public function deleteCategory($category_id) {]]></search>
      <add position="after"><![CDATA[
      Powercache::remove('seo_rewrite', 'path=', (int)$category_id);
      ]]></add>
    </operation-->
    
    <operation error="skip" v="2.0">
      <search position="replace"><![CDATA[, (SELECT DISTINCT keyword FROM " . DB_PREFIX . "url_alias WHERE query = 'category_id=" . (int)$category_id . "') AS keyword]]></search>
      <add position="replace"><![CDATA[, (SELECT DISTINCT keyword FROM " . DB_PREFIX . "url_alias WHERE query = 'category_id=" . (int)$category_id . "' LIMIT 1) AS keyword]]></add>
    </operation>
    
    <operation error="skip" v="1.5">
      <search position="replace"><![CDATA[, (SELECT keyword FROM " . DB_PREFIX . "url_alias WHERE query = 'category_id=" . (int)$category_id . "') AS keyword]]></search>
      <add position="replace"><![CDATA[, (SELECT keyword FROM " . DB_PREFIX . "url_alias WHERE query = 'category_id=" . (int)$category_id . "' LIMIT 1) AS keyword]]></add>
    </operation>
    
  </file>
  
  <file path="admin/model/catalog/product.php" v="3">
  
    <operation error="skip">
      <search position="replace" index="0"><![CDATA[$this->db->query("DELETE FROM " . DB_PREFIX . "seo_url WHERE query = 'product_id=" . (int)$product_id . "'");]]></search>
      <add position="replace" index="0"><![CDATA[
      if (!$this->config->get('mlseo_enabled')) {
        $this->db->query("DELETE FROM " . DB_PREFIX . "seo_url WHERE query = 'product_id=" . (int)$product_id . "'");
      }
      ]]></add>
    </operation>

  </file><file path="admin/model/catalog/product.php">
  
    <operation>
      <search position="before"><![CDATA[if (isset($data['image'])) {]]></search>
      <add position="before"><![CDATA[
    if (isset($data['meta_robots'])) {
      $this->db->query("UPDATE " . DB_PREFIX . "product SET meta_robots = '" . $this->db->escape($data['meta_robots']) . "' WHERE product_id = '" . (int)$product_id . "'");
    }
    
    if (isset($data['seo_canonical'])) {
      $this->db->query("UPDATE " . DB_PREFIX . "product SET seo_canonical = '" . $this->db->escape($data['seo_canonical']) . "' WHERE product_id = '" . (int)$product_id . "'");
    }
      ]]></add>
    </operation>
    
    <operation>
      <search position="after"><![CDATA[public function addProduct($data) {]]></search>
      <add position="after"><![CDATA[    $default_lang = $this->db->query("SELECT language_id FROM " . DB_PREFIX . "language WHERE code = '" . $this->config->get('config_language') . "'")->row['language_id'];
    $isInsertOrEdit = (strpos(__METHOD__, 'edit') !== false) ? 'edit' : 'insert';]]></add>
    </operation>
    
    <operation>
      <search position="before"><![CDATA[foreach ($data['product_description'] as $language_id => $value) {]]></search>
      <add position="before"><![CDATA[
      // fix issue with copy in case of not correctly deleted products
      if ($isInsertOrEdit == 'insert') {
        $this->{'db'}->query("DELETE FROM " . DB_PREFIX . "product_description WHERE product_id = '" . (int)$product_id . "'");
      }
      
      if (version_compare(VERSION, '3', '>=')) {
        $currentKeywordsQuery = $this->db->query("SELECT * FROM " . DB_PREFIX . "seo_url WHERE query = 'product_id=" . (int)$product_id . "'")->rows;
        $this->{'db'}->query("DELETE FROM " . DB_PREFIX."seo_url WHERE query = 'product_id=" . (int)$product_id . "'");
      } else {
        $currentKeywordsQuery = $this->db->query("SELECT * FROM " . DB_PREFIX . "url_alias WHERE query = 'product_id=" . (int)$product_id . "'")->rows;
        $this->{'db'}->query("DELETE FROM " . DB_PREFIX."url_alias WHERE query = 'product_id=" . (int)$product_id . "'");
      }
      
      $currentKeywords = array();
      
      foreach ($currentKeywordsQuery as $curKeyword) {
        $currentKeywords[(isset($curKeyword['store_id']) ? $curKeyword['store_id'] : 0)][(isset($curKeyword['language_id']) ? $curKeyword['language_id'] : $default_lang)] = $curKeyword['keyword'];
      }
      
      if ($this->config->get('mlseo_multistore')) {
        $this->load->model('catalog/seo_package');
        $this->model_catalog_seo_package->setSeoDescriptions('product', $data, $product_id, $isInsertOrEdit, $currentKeywords);
      }
      ]]></add>
    </operation>
    
    <operation>
      <search position="before"><![CDATA[$this->db->query("INSERT INTO " . DB_PREFIX . "product_description SET]]></search>
      <add position="before"><![CDATA[
      if ($this->config->get('mlseo_enabled')) {
        if (isset($data['keyword'])) {
          unset($data['keyword']);
        }
        
        if ($this->config->get('mlseo_'.$isInsertOrEdit.'autotitle')) {
          $value['name'] = ($value['name']) ? $value['name'] : $data['product_description'][$default_lang]['name'];
          $value['description'] = ($value['description']) ? $value['description'] : $data['product_description'][$default_lang]['description'];
        }
        
        $this->load->model('tool/seo_package');
        
        $data['product_id'] = $product_id; // add id into dataset for use with patterns
        
        $seo_kw = '';
        
        if (empty($value['seo_keyword']) && $this->config->get('mlseo_'.$isInsertOrEdit.'autourl')) {
          $seo_kw = $this->model_tool_seo_package->transformProduct($this->config->get('mlseo_product_url_pattern'), $language_id, $data);
        } else if (!empty($value['seo_keyword'])) {
          $seo_kw = html_entity_decode($value['seo_keyword'], ENT_QUOTES, 'UTF-8');
        }
        
        if ($seo_kw) {
          $seo_kw = $this->model_tool_seo_package->filter_seo($seo_kw, 'product', $product_id, $language_id);
        }
        
        $url_alias_table = version_compare(VERSION, '3', '>=') ? 'seo_url' : 'url_alias';
        
        if ($this->config->get('mlseo_backup')) {
          $currentKeyword = isset($currentKeywords[0][$language_id]) ? $currentKeywords[0][$language_id] : '';
          
          if ($currentKeyword && $currentKeyword != $seo_kw) {
            $this->db->query("INSERT IGNORE INTO " . DB_PREFIX . "url_redirect SET query = '/" . $this->db->escape($currentKeyword) . "', redirect = 'product/product&product_id=" . (int) $product_id . "', language_id = '" . (int) $language_id . "'");
          }
        }
        
        if (version_compare(VERSION, '3', '>=')) {
          $this->db->query("INSERT INTO " . DB_PREFIX . $url_alias_table . " SET query = 'product_id=" . (int)$product_id . "', language_id = '" . (int)$language_id . "', keyword = '" . $this->db->escape($seo_kw) . "', store_id = 0");
        } else if ($this->config->get('mlseo_ml_mode')) {
          $this->db->query("INSERT INTO " . DB_PREFIX . $url_alias_table . " SET query = 'product_id=" . (int)$product_id . "', language_id = '" . (int)$language_id . "', keyword = '" . $this->db->escape($seo_kw) . "'");
        } else {
          $this->db->query("INSERT INTO " . DB_PREFIX . $url_alias_table . " SET query = 'product_id=" . (int)$product_id . "', keyword = '" . $this->db->escape($seo_kw) . "'");
        }
        
        if (!$value['meta_title'] && $this->config->get('mlseo_'.$isInsertOrEdit.'autoseotitle')) {
          $value['meta_title'] = $this->model_tool_seo_package->transformProduct($this->config->get('mlseo_product_title_pattern'), $language_id, $data);
        }
        if (!trim(strip_tags(html_entity_decode($value['description'], ENT_QUOTES, 'UTF-8'))) && $this->config->get('mlseo_'.$isInsertOrEdit.'autodesc')) {
          $value['description'] = $this->model_tool_seo_package->transformProduct($this->config->get('mlseo_product_full_desc_pattern'), $language_id, $data);
        }
        if (!$value['meta_description'] && $this->config->get('mlseo_'.$isInsertOrEdit.'autometadesc')) {
          $value['meta_description'] = $this->model_tool_seo_package->transformProduct($this->config->get('mlseo_product_description_pattern'), $language_id, $data);
        }
        if (!$value['meta_keyword'] && $this->config->get('mlseo_'.$isInsertOrEdit.'autometakeyword')) {
          $value['meta_keyword'] = $this->model_tool_seo_package->transformProduct($this->config->get('mlseo_product_keyword_pattern'), $language_id, $data);
        }
        if (empty($value['seo_h1']) && $this->config->get('mlseo_'.$isInsertOrEdit.'autoh1')) {
          $value['seo_h1'] = $this->model_tool_seo_package->transformProduct($this->config->get('mlseo_product_h1_pattern'), $language_id, $data);
        }
        if (empty($value['seo_h2']) && $this->config->get('mlseo_'.$isInsertOrEdit.'autoh2')) {
          $value['seo_h2'] = $this->model_tool_seo_package->transformProduct($this->config->get('mlseo_product_h2_pattern'), $language_id, $data);
        }
        if (empty($value['seo_h3']) && $this->config->get('mlseo_'.$isInsertOrEdit.'autoh3')) {
          $value['seo_h3'] = $this->model_tool_seo_package->transformProduct($this->config->get('mlseo_product_h3_pattern'), $language_id, $data);
        }
        if (empty($value['image_title']) && $this->config->get('mlseo_'.$isInsertOrEdit.'autoimgtitle')) {
          $value['image_title'] = $this->model_tool_seo_package->transformProduct($this->config->get('mlseo_product_image_title_pattern'), $language_id, $data);
        }
        if (empty($value['image_alt']) && $this->config->get('mlseo_'.$isInsertOrEdit.'autoimgalt')) {
          $value['image_alt'] = $this->model_tool_seo_package->transformProduct($this->config->get('mlseo_product_image_alt_pattern'), $language_id, $data);
        }
        if (empty($value['tag']) && $this->config->get('mlseo_'.$isInsertOrEdit.'autotags')) {
          $value['tag'] = $this->model_tool_seo_package->transformProduct($this->config->get('mlseo_product_tag_pattern'), $language_id, $data);
        }
      }
      ]]></add>
    </operation>
    
    <operation>
      <search position="replace"><![CDATA[if (isset($data['image'])) {]]></search>
      <add position="replace"><![CDATA[
        if ($this->config->get('mlseo_'.$isInsertOrEdit.'autoimgname') && !defined('GKD_UNIV_IMPORT') && isset($data['image'])) {
          $this->load->model('tool/seo_package');
          $seo_image_name = $this->model_tool_seo_package->transformProduct($this->config->get('mlseo_product_image_name_pattern'), $this->config->get('config_language_id'), $data);
          
          $path = pathinfo($data['image']);
          
          if (!empty($path['filename'])) {
            $filename = $this->model_tool_seo_package->filter_seo($seo_image_name, 'image', '', '');
            $value = $path['dirname'] . '/' . $filename . '.' . $path['extension'];
            
            if ($data['image'] == $value) {
              $this->db->query("UPDATE " . DB_PREFIX . "product SET image = '". $this->db->escape($value) ."' WHERE product_id = '" . (int)$product_id . "'");
            } else if (file_exists(DIR_IMAGE . $data['image'])) {
              $x = 1;
              
              while (file_exists(DIR_IMAGE . $value)) {
                $value = $path['dirname'] . '/' . $filename . '-' . $x . '.' . $path['extension'];
                $x++;
              }

              if (rename(DIR_IMAGE . $data['image'], DIR_IMAGE . $value)) {
                $this->db->query("UPDATE " . DB_PREFIX . "product SET image = '". $this->db->escape($value) ."' WHERE product_id = '" . (int)$product_id . "'");
                $this->db->query("UPDATE " . DB_PREFIX . "product SET image = '". $this->db->escape($value) ."' WHERE image = '" . $this->db->escape($data['image']) . "'");
                $this->db->query("UPDATE " . DB_PREFIX . "product_image SET image = '". $this->db->escape($value) ."' WHERE image = '" . $this->db->escape($data['image']) . "'");
                
                if (isset(${'data'}['product_image'])) {
                  foreach (${'data'}['product_image'] as $k => $product_image) {
                    ${'data'}['product_image'][$k]['image'] = str_replace($data['image'], $value, $product_image['image']);
                  }
                }
                
                $data['image'] = $value;
              }
            }
          }
        } else if (isset($data['image'])) {
      ]]></add>
    </operation>
    
    <operation error="skip" v="1.5 - 2.x">
      <search position="replace"><![CDATA[if ($data['keyword']) {]]></search>
      <add position="replace"><![CDATA[if (!empty($data['keyword']) && !$this->config->get('mlseo_enabled')) {]]></add>
    </operation>
    
    <operation error="skip" v="1.5 - 2.x">
      <search position="replace" index="0"><![CDATA[$this->db->query("DELETE FROM " . DB_PREFIX . "url_alias WHERE query = 'product_id=" . (int)$product_id]]></search>
      <add position="replace" index="0"><![CDATA[    if (!$this->config->get('mlseo_enabled'))
          $this->db->query("DELETE FROM " . DB_PREFIX . "url_alias WHERE query = 'product_id=" . (int)$product_id]]></add>
    </operation>
    
  </file><file path="admin/model/catalog/product.php">
  
    <operation>
      <search position="after"><![CDATA[public function editProduct($product_id, $data) {]]></search>
      <add position="after"><![CDATA[    $default_lang = $this->db->query("SELECT language_id FROM " . DB_PREFIX . "language WHERE code = '" . $this->config->get('config_language') . "'")->row['language_id'];
    $isInsertOrEdit = (strpos(__METHOD__, 'edit') !== false) ? 'edit' : 'insert';]]></add>
    </operation>
    
    <operation>
      <search position="before"><![CDATA[if (isset($data['product_related'])) {]]></search>
      <add position="before"><![CDATA[
        if (empty($data['product_related']) && $this->config->get('mlseo_'.$isInsertOrEdit.'autorelated')) {
          $prod_name = str_replace(array('%', '#', "'", '"'), '', $data['product_description'][$default_lang]['name']);
          $prod_tag = str_replace(array('%', '#', "'", '"'), '', $data['product_description'][$default_lang]['tag']);
          $prod_desc = str_replace(array('\n', '\r', '%', '#', "'", '"'), '', $data['product_description'][$default_lang]['description']);
          
          if ($this->config->get('mlseo_product_related_relevance')) {
            $relevance = $this->config->get('mlseo_product_related_relevance');
          } else {
            $relevance = 2;
          }
          
          if ($this->config->get('mlseo_product_related_no')) {
            $max_items = $this->config->get('mlseo_product_related_no');
          } else {
            $max_items = 5;
          }
          
          $rel_count = $this->db->query("SELECT COUNT(*) AS count FROM " . DB_PREFIX . "product_related WHERE product_id = '" . (int) $product_id . "'")->row;
          
          if (isset($rel_count['count']) && $rel_count['count'] < $max_items) {
            $max_items -= $rel_count['count'];
            
            $same_cat = '';
            $process_related = true;
            
            if ($this->config->get('mlseo_product_related_samecat')) {
              if (!empty($data['product_category'])) {
                $data['product_category'] = array_map('intval', $data['product_category']);
                
                $rel_cat = $this->db->query("SELECT category_id FROM " . DB_PREFIX . "category_path WHERE category_id IN (".implode(',', $data['product_category']).") ORDER BY level DESC LIMIT 1")->row;
                
                if (!empty($rel_cat['category_id'])) {
                  $same_cat = "AND pc.category_id = " . (int) $rel_cat['category_id'];
                }
              } else {
                $process_related = false;
              }
            }
            
            if ($process_related) {
              $rel_query = $this->db->query("SELECT DISTINCT ROUND(MATCH (pd.name, pd.description) AGAINST ('" . $prod_name . " " . $prod_tag . " " . $prod_desc . "'), 0) / 5 as relevance,  p.product_id FROM " . DB_PREFIX . "product_description pd LEFT JOIN " . DB_PREFIX . "product p on pd.product_id = p.product_id INNER JOIN " . DB_PREFIX . "product_to_category pc on pd.product_id = pc.product_id WHERE p.product_id <> " . (int) $product_id . " " . $same_cat . "  AND p.status = 1 GROUP BY p.product_id HAVING relevance >= " . (int) $relevance . " ORDER BY relevance DESC LIMIT 0, " . (int) $max_items)->rows;
              
              foreach ($rel_query as $rel) {
                $data['product_related'][] = $rel['product_id'];
              }
            }
            
            if (isset($data["product_related"])) {
              foreach ($data["product_related"] as $related_id) {
                // only insert related to current product to avoid inserting too much related products
                $this->db->query("DELETE FROM `" . DB_PREFIX . "product_related` WHERE product_id = '" . (int)$product_id . "' AND related_id = '" . (int)$related_id . "'");
                $this->db->query("INSERT INTO `" . DB_PREFIX . "product_related` SET product_id = '" . (int)$product_id . "', related_id = '" . (int)$related_id . "'");
              }
            }
          }
        } else
      ]]></add>
    </operation>
    
    <operation>
      <search position="replace"><![CDATA[$this->db->query("INSERT INTO " . DB_PREFIX . "product_description SET]]></search>
      <add position="replace"><![CDATA[
        $value['seo_h1'] = empty($value['seo_h1']) ? '' : $value['seo_h1'];
        $value['seo_h2'] = empty($value['seo_h2']) ? '' : $value['seo_h2'];
        $value['seo_h3'] = empty($value['seo_h3']) ? '' : $value['seo_h3'];
        $value['image_alt'] = empty($value['image_alt']) ? '' : $value['image_alt'];
        $value['image_title'] = empty($value['image_title']) ? '' : $value['image_title'];
      
        $extra_fields = '';
        if ($this->config->get('mlseo_enabled')) {
          $extra_fields = "seo_keyword = '" . $this->db->escape(isset($seo_kw) ? $seo_kw : '') . "', seo_h1 = '" . $this->db->escape($value['seo_h1']) . "', seo_h2 = '" . $this->db->escape($value['seo_h2']) . "', seo_h3 = '" . $this->db->escape($value['seo_h3']) . "', image_alt = '" . $this->db->escape($value['image_alt']) . "', image_title = '" . $this->db->escape($value['image_title']) . "', ";
          if (substr(VERSION, 0, 1) == 1) {
            $extra_fields .= "meta_title = '" . $this->db->escape($value['meta_title']) . "', ";
          }
        }
        
        $this->db->query("INSERT INTO " . DB_PREFIX . "product_description SET " . $extra_fields . "]]></add>
    </operation>
    
    <operation error="skip" v="1.5 - 2.x">
      <search position="replace"><![CDATA[, (SELECT keyword FROM " . DB_PREFIX . "url_alias WHERE query = 'product_id=" . (int)$product_id . "') AS keyword]]></search>
      <add position="replace"><![CDATA[, (SELECT keyword FROM " . DB_PREFIX . "url_alias WHERE query = 'product_id=" . (int)$product_id . "' LIMIT 1) AS keyword]]></add>
    </operation>
    
  </file><file path="admin/model/catalog/product.php">
    
    <operation>
      <search position="replace"><![CDATA[$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_description]]></search>
      <add position="replace"><![CDATA[
      $extra_select = '';
      
      $url_alias_table = version_compare(VERSION, '3', '>=') ? 'seo_url' : 'url_alias';
      
      if ($this->config->get('mlseo_enabled')) {
        if (version_compare(VERSION, '3', '>=') || ($this->config->get('mlseo_multistore') && $this->config->get('mlseo_ml_mode'))) {
          $extra_select = ",(SELECT keyword FROM " . DB_PREFIX . $url_alias_table . " u WHERE query = 'product_id=".$product_id."' AND (u.language_id = d.language_id OR u.language_id = 0) AND store_id = 0 LIMIT 1) AS seo_keyword";
        } else if ($this->config->get('mlseo_multistore')) {
          $extra_select = ",(SELECT keyword FROM " . DB_PREFIX . $url_alias_table . " u WHERE query = 'product_id=".$product_id."' AND store_id = 0 LIMIT 1) AS seo_keyword";
        } else if ($this->config->get('mlseo_ml_mode')) {
          $extra_select = ",(SELECT keyword FROM " . DB_PREFIX . $url_alias_table . " u WHERE query = 'product_id=".$product_id."' AND (u.language_id = d.language_id OR u.language_id = 0) LIMIT 1) AS seo_keyword";
        } else {
          $extra_select = ",(SELECT keyword FROM " . DB_PREFIX . $url_alias_table . " WHERE query = 'product_id=".$product_id."' LIMIT 1) AS seo_keyword";
        }
      }
      
      $query = $this->db->query("SELECT * ".$extra_select." FROM " . DB_PREFIX . "product_description d]]></add>
    </operation>
    
    <operation>
      <search position="after"><![CDATA[$result['name'],]]></search>
      <add position="after"><![CDATA[        'seo_keyword'     => isset($result['seo_keyword']) ? $result['seo_keyword'] : '',
        'seo_h1'       => isset($result['seo_h1']) ? $result['seo_h1'] : '',
        'seo_h2'       => isset($result['seo_h2']) ? $result['seo_h2'] : '',
        'seo_h3'       => isset($result['seo_h3']) ? $result['seo_h3'] : '',
        'image_alt'       => isset($result['image_alt']) ? $result['image_alt'] : '',
        'image_title'       => isset($result['image_title']) ? $result['image_title'] : '',]]></add>
    </operation>
    
    <operation v="1.5">
      <ignoreif><![CDATA[$this->event->trigger]]></ignoreif>
      <search position="after"><![CDATA[$result['name'],]]></search>
      <add position="after"><![CDATA[        'meta_title'     => isset($result['meta_title']) ? $result['meta_title'] : '',]]></add>
    </operation>
    
    <!--operation>
      <search position="after"><![CDATA[public function deleteProduct($product_id) {]]></search>
      <add position="after"><![CDATA[
      Powercache::remove('seo_rewrite', 'product_id=' . (int)$product_id);
      ]]></add>
    </operation-->
    
  </file>
  
  <file path="admin/model/catalog/information.php" v="3">
  
    <operation error="skip">
      <search position="replace" index="0"><![CDATA[$this->db->query("DELETE FROM " . DB_PREFIX . "seo_url WHERE query = 'information_id=" . (int)$information_id . "'");]]></search>
      <add position="replace" index="0"><![CDATA[
      if (!$this->config->get('mlseo_enabled')) {
        $this->db->query("DELETE FROM " . DB_PREFIX . "seo_url WHERE query = 'information_id=" . (int)$information_id . "'");
      }
      ]]></add>
    </operation>

  </file><file path="admin/model/catalog/information.php">
  
    <operation>
      <search position="before"><![CDATA[if (isset($data['information_store'])) {]]></search>
      <add position="before"><![CDATA[
    if (isset($data['meta_robots'])) {
      $this->db->query("UPDATE " . DB_PREFIX . "information SET meta_robots = '" . $this->db->escape($data['meta_robots']) . "' WHERE information_id = '" . (int)$information_id . "'");
    }
      ]]></add>
    </operation>
    
  </file><file path="admin/model/catalog/information.php">
  
    <operation>
      <search position="after"><![CDATA[public function addInformation($data) {]]></search>
      <add position="after"><![CDATA[    $default_lang = $this->db->query("SELECT language_id FROM " . DB_PREFIX . "language WHERE code = '" . $this->config->get('config_language') . "'")->row['language_id'];
    $isInsertOrEdit = (strpos(__METHOD__, 'edit') !== false) ? 'edit' : 'insert';]]></add>
    </operation>
    
    <operation>
      <search position="before"><![CDATA[foreach ($data['information_description'] as $language_id => $value) {]]></search>
      <add position="before"><![CDATA[
      if (version_compare(VERSION, '3', '>=')) {
        $currentKeywordsQuery = $this->db->query("SELECT * FROM " . DB_PREFIX . "seo_url WHERE query = 'information_id=" . (int)$information_id . "'")->rows;
        $this->{'db'}->query("DELETE FROM " . DB_PREFIX . "seo_url WHERE query = 'information_id=" . (int)$information_id . "'");
      } else {
        $currentKeywordsQuery = $this->db->query("SELECT * FROM " . DB_PREFIX . "url_alias WHERE query = 'information_id=" . (int)$information_id . "'")->rows;
        $this->{'db'}->query("DELETE FROM " . DB_PREFIX . "url_alias WHERE query = 'information_id=" . (int)$information_id . "'");
      }
      
      $currentKeywords = array();
      
      foreach ($currentKeywordsQuery as $curKeyword) {
        $currentKeywords[(isset($curKeyword['store_id']) ? $curKeyword['store_id'] : 0)][(isset($curKeyword['language_id']) ? $curKeyword['language_id'] : $default_lang)] = $curKeyword['keyword'];
      }
      
      if ($this->config->get('mlseo_multistore')) {
        $this->load->model('catalog/seo_package');
        $this->model_catalog_seo_package->setSeoDescriptions('information', $data, $information_id, $isInsertOrEdit, $currentKeywords);
      }
      ]]></add>
    </operation>
    
    <operation>
      <search position="before"><![CDATA[$this->db->query("INSERT INTO " . DB_PREFIX . "information_description SET]]></search>
      <add position="before"><![CDATA[
      if ($this->config->get('mlseo_enabled')) {
        if (isset($data['keyword'])) {
          unset($data['keyword']);
        }
        
        if ($this->config->get('mlseo_'.$isInsertOrEdit.'autotitle')) {
          $value['title'] = ($value['title']) ? $value['title'] : $data['information_description'][$default_lang]['title'];
          $value['description'] = ($value['description']) ? $value['description'] : $data['information_description'][$default_lang]['description'];
        }
        
        $this->load->model('tool/seo_package');
        
        $data['information_id'] = $information_id; // add id into dataset for use with patterns
        
        $seo_kw = '';
        
        if (empty($value['seo_keyword']) && $this->config->get('mlseo_'.$isInsertOrEdit.'autourl')) {
          $seo_kw = $this->model_tool_seo_package->transformInformation($this->config->get('mlseo_information_url_pattern'), $language_id, $data);
        } else if (!empty($value['seo_keyword'])) {
          $seo_kw = html_entity_decode($value['seo_keyword'], ENT_QUOTES, 'UTF-8');
        }
        
        if ($seo_kw) {
          $seo_kw = $this->model_tool_seo_package->filter_seo($seo_kw, 'information', $information_id, $language_id);
        }
      
        $url_alias_table = version_compare(VERSION, '3', '>=') ? 'seo_url' : 'url_alias';
        
        if ($this->config->get('mlseo_backup')) {
          $currentKeyword = isset($currentKeywords[0][$language_id]) ? $currentKeywords[0][$language_id] : '';
          
          if ($currentKeyword && $currentKeyword != $seo_kw) {
            $this->db->query("INSERT IGNORE INTO " . DB_PREFIX . "url_redirect SET query = '/" . $this->db->escape($currentKeyword) . "', redirect = 'information/information&information_id=" . (int) $information_id . "', language_id = '" . (int) $language_id . "'");
          }
        }
        
        if (version_compare(VERSION, '3', '>=')) {
          $this->db->query("INSERT INTO " . DB_PREFIX . $url_alias_table . " SET query = 'information_id=" . (int)$information_id . "', language_id = '" . (int)$language_id . "', keyword = '" . $this->db->escape($seo_kw) . "', store_id = 0");
        } else if ($this->config->get('mlseo_ml_mode')) {
          $this->db->query("INSERT INTO " . DB_PREFIX . $url_alias_table . " SET query = 'information_id=" . (int)$information_id . "', language_id = '" . (int)$language_id . "', keyword = '" . $this->db->escape($seo_kw) . "'");
        } else {
          $this->db->query("INSERT INTO " . DB_PREFIX . $url_alias_table . " SET query = 'information_id=" . (int)$information_id . "', keyword = '" . $this->db->escape($seo_kw) . "'");
        }
      
        if (!$value['meta_title'] && $this->config->get('mlseo_'.$isInsertOrEdit.'autoseotitle')) {
          $value['meta_title'] = $this->model_tool_seo_package->transformInformation($this->config->get('mlseo_information_title_pattern'), $language_id, $data);
        }
        if (!trim(strip_tags(html_entity_decode($value['description'], ENT_QUOTES, 'UTF-8'))) && $this->config->get('mlseo_'.$isInsertOrEdit.'autodesc')) {
          $value['description'] = $this->model_tool_seo_package->transformInformation($this->config->get('mlseo_category_full_desc_pattern'), $language_id, $data);
        }
        if (!$value['meta_description'] && $this->config->get('mlseo_'.$isInsertOrEdit.'autometadesc')) {
          $value['meta_description'] = $this->model_tool_seo_package->transformInformation($this->config->get('mlseo_information_description_pattern'), $language_id, $data);
        }
        if (!$value['meta_keyword'] && $this->config->get('mlseo_'.$isInsertOrEdit.'autometakeyword')) {
          $value['meta_keyword'] = $this->model_tool_seo_package->transformInformation($this->config->get('mlseo_information_keyword_pattern'), $language_id, $data);
        }
        if (empty($value['seo_h1']) && $this->config->get('mlseo_'.$isInsertOrEdit.'autoh1')) {
          $value['seo_h1'] = $this->model_tool_seo_package->transformInformation($this->config->get('mlseo_information_h1_pattern'), $language_id, $data);
        }
        if (empty($value['seo_h2']) && $this->config->get('mlseo_'.$isInsertOrEdit.'autoh2')) {
          $value['seo_h2'] = $this->model_tool_seo_package->transformInformation($this->config->get('mlseo_information_h2_pattern'), $language_id, $data);
        }
        if (empty($value['seo_h3']) && $this->config->get('mlseo_'.$isInsertOrEdit.'autoh3')) {
          $value['seo_h3'] = $this->model_tool_seo_package->transformInformation($this->config->get('mlseo_information_h3_pattern'), $language_id, $data);
        }
      }
      ]]></add>
    </operation>
    
    <operation error="skip" v="1.5 - 2.x">
      <search position="replace"><![CDATA[if ($data['keyword']) {]]></search>
      <add position="replace"><![CDATA[if (!empty($data['keyword']) && !$this->config->get('mlseo_enabled')) {]]></add>
    </operation>
    
    <operation error="skip" v="1.5 - 2.x">
      <search position="replace" index="0"><![CDATA[$this->db->query("DELETE FROM " . DB_PREFIX . "url_alias WHERE query = 'information_id=" . (int)$information_id]]></search>
      <add position="replace" index="0"><![CDATA[    if (!$this->config->get('mlseo_enabled'))
      $this->db->query("DELETE FROM " . DB_PREFIX . "url_alias WHERE query = 'information_id=" . (int)$information_id]]></add>
    </operation>
    
  </file><file path="admin/model/catalog/information.php">
  
    <operation>
      <search position="after"><![CDATA[public function editInformation($information_id, $data) {]]></search>
      <add position="after"><![CDATA[    $default_lang = $this->db->query("SELECT language_id FROM " . DB_PREFIX . "language WHERE code = '" . $this->config->get('config_language') . "'")->row['language_id'];
    $isInsertOrEdit = (strpos(__METHOD__, 'edit') !== false) ? 'edit' : 'insert';]]></add>
    </operation>
    
    <operation>
      <search position="replace"><![CDATA[$this->db->query("INSERT INTO " . DB_PREFIX . "information_description SET]]></search>
      <add position="replace"><![CDATA[
        $value['seo_h1'] = empty($value['seo_h1']) ? '' : $value['seo_h1'];
        $value['seo_h2'] = empty($value['seo_h2']) ? '' : $value['seo_h2'];
        $value['seo_h3'] = empty($value['seo_h3']) ? '' : $value['seo_h3'];
        
        $extra_fields = '';
        if ($this->config->get('mlseo_enabled')) {
          $extra_fields = "seo_keyword = '" . $this->db->escape(isset($seo_kw) ? $seo_kw : '') . "', seo_h1 = '" . $this->db->escape($value['seo_h1']) . "', seo_h2 = '" . $this->db->escape($value['seo_h2']) . "', seo_h3 = '" . $this->db->escape($value['seo_h3']) . "', ";
          if (substr(VERSION, 0, 1) == 1) {
            $extra_fields .= "meta_title = '" . $this->db->escape($value['meta_title']) . "', meta_keyword = '" . $this->db->escape($value['meta_keyword']) . "', meta_description = '" . $this->db->escape($value['meta_description']) . "', ";
          }
        }
        
        $this->db->query("INSERT INTO " . DB_PREFIX . "information_description SET " . $extra_fields . "]]></add>
    </operation>
    
    <operation error="skip" v="1.5 - 2.x">
      <search position="replace"><![CDATA[, (SELECT keyword FROM " . DB_PREFIX . "url_alias WHERE query = 'information_id=" . (int)$information_id . "') AS keyword]]></search>
      <add position="replace"><![CDATA[, (SELECT keyword FROM " . DB_PREFIX . "url_alias WHERE query = 'information_id=" . (int)$information_id . "' LIMIT 1) AS keyword]]></add>
    </operation>
    
  </file><file path="admin/model/catalog/information.php">
  
    <operation>
      <search position="replace"><![CDATA[$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "information_description]]></search>
      <add position="replace"><![CDATA[
      $extra_select = '';
      
      $url_alias_table = version_compare(VERSION, '3', '>=') ? 'seo_url' : 'url_alias';
      
      if ($this->config->get('mlseo_enabled')) {
        if (version_compare(VERSION, '3', '>=') || ($this->config->get('mlseo_multistore') && $this->config->get('mlseo_ml_mode'))) {
          $extra_select = ",(SELECT keyword FROM " . DB_PREFIX . $url_alias_table . " u WHERE query = 'information_id=".$information_id."' AND (u.language_id = d.language_id OR u.language_id = 0) AND store_id = 0 LIMIT 1) AS seo_keyword";
        } else if ($this->config->get('mlseo_multistore')) {
          $extra_select = ",(SELECT keyword FROM " . DB_PREFIX . $url_alias_table . " u WHERE query = 'information_id=".$information_id."' AND store_id = 0 LIMIT 1) AS seo_keyword";
        } else if ($this->config->get('mlseo_ml_mode')) {
          $extra_select = ",(SELECT keyword FROM " . DB_PREFIX . $url_alias_table . " u WHERE query = 'information_id=".$information_id."' AND (u.language_id = d.language_id OR u.language_id = 0) LIMIT 1) AS seo_keyword";
        } else {
          $extra_select = ",(SELECT keyword FROM " . DB_PREFIX . $url_alias_table . " WHERE query = 'information_id=".$information_id."' LIMIT 1) AS seo_keyword";
        }
      }
      
      $query = $this->db->query("SELECT * ".$extra_select." FROM " . DB_PREFIX . "information_description d]]></add>
    </operation>
    
    <operation>
      <search position="after"><![CDATA[$result['title'],]]></search>
      <add position="after"><![CDATA[        'seo_keyword'     => isset($result['seo_keyword']) ? $result['seo_keyword'] : '',
        'seo_h1'       => isset($result['seo_h1']) ? $result['seo_h1'] : '',
        'seo_h2'       => isset($result['seo_h2']) ? $result['seo_h2'] : '',
        'seo_h3'       => isset($result['seo_h3']) ? $result['seo_h3'] : '',]]></add>
    </operation>
    
    <operation v="1.5">
      <ignoreif><![CDATA[$this->event->trigger]]></ignoreif>
      <search position="after"><![CDATA[$result['title'],]]></search>
      <add position="after"><![CDATA[        'meta_title'     => $result['meta_title'],
        'meta_description'       => $result['meta_description'],
        'meta_keyword'       => $result['meta_keyword'],]]></add>
    </operation>
    
    <!--operation>
      <search position="after"><![CDATA[public function deleteInformation($information_id) {]]></search>
      <add position="after"><![CDATA[
      Powercache::remove('seo_rewrite', 'information_id=' . (int)$information_id);
      ]]></add>
    </operation-->
    
  </file>
  
  <file path="admin/model/catalog/manufacturer.php" v="3">
  
    <operation error="skip">
      <search position="replace" index="0"><![CDATA[$this->db->query("DELETE FROM `" . DB_PREFIX . "seo_url` WHERE query = 'manufacturer_id=" . (int)$manufacturer_id . "'");]]></search>
      <add position="replace" index="0"><![CDATA[//$this->db->query("DELETE FROM `" . DB_PREFIX . "seo_url` WHERE query = 'manufacturer_id=" . (int)$manufacturer_id . "'");]]></add>
    </operation>

  </file><file path="admin/model/catalog/manufacturer.php">
  
    <!--operation>
      <search position="after"><![CDATA[public function addmanufacturer($data) {]]></search>
      <add position="after"><![CDATA[    $default_lang = $this->db->query("SELECT language_id FROM " . DB_PREFIX . "language WHERE code = '" . $this->config->get('config_language') . "'")->row['language_id'];
    $isInsertOrEdit = (strpos(__METHOD__, 'edit') !== false) ? 'edit' : 'insert';]]></add>
    </operation-->
    
    <operation>
      <search position="before"><![CDATA[if (isset($data['manufacturer_store'])) {]]></search>
      <add position="before"><![CDATA[
      $isInsertOrEdit = (strpos(__METHOD__, 'edit') !== false) ? 'edit' : 'insert';
      
      if (version_compare(VERSION, '3', '>=')) {
        $currentKeywordsQuery = $this->db->query("SELECT * FROM " . DB_PREFIX . "seo_url WHERE query = 'manufacturer_id=" . (int)$manufacturer_id . "'")->rows;
        $this->{'db'}->query("DELETE FROM " . DB_PREFIX . "seo_url WHERE query = 'manufacturer_id=" . (int)$manufacturer_id . "'");
      } else {
        $currentKeywordsQuery = $this->db->query("SELECT * FROM " . DB_PREFIX . "url_alias WHERE query = 'manufacturer_id=" . (int)$manufacturer_id . "'")->rows;
        $this->{'db'}->query("DELETE FROM " . DB_PREFIX . "url_alias WHERE query = 'manufacturer_id=" . (int)$manufacturer_id . "'");
      }
      
      $currentKeywords = array();
      
      foreach ($currentKeywordsQuery as $curKeyword) {
        $currentKeywords[(isset($curKeyword['store_id']) ? $curKeyword['store_id'] : 0)][(isset($curKeyword['language_id']) ? $curKeyword['language_id'] : $default_lang)] = $curKeyword['keyword'];
      }
      
      $this->load->model('catalog/seo_package');
      $this->model_catalog_seo_package->setSeoDescriptions('manufacturer', $data, $manufacturer_id, $isInsertOrEdit, $currentKeywords);
      ]]></add>
    </operation>
  
    <operation error="skip" v="1.5 - 2.x">
      <search position="replace"><![CDATA[if ($data['keyword']) {]]></search>
      <add position="replace"><![CDATA[if (!empty($data['keyword']) && (version_compare(VERSION, '2', '<') || !$this->config->get('mlseo_enabled'))) {]]></add>
    </operation>
    
  </file><file path="admin/model/catalog/manufacturer.php">
  
    <operation error="skip" v="1.5 - 2.x">
      <search position="replace"><![CDATA[, (SELECT keyword FROM " . DB_PREFIX . "url_alias WHERE query = 'manufacturer_id=" . (int)$manufacturer_id . "') AS keyword]]></search>
      <add position="replace"><![CDATA[, (SELECT keyword FROM " . DB_PREFIX . "url_alias WHERE query = 'manufacturer_id=" . (int)$manufacturer_id . "' LIMIT 1) AS keyword]]></add>
    </operation>
    
  </file>
  
  <file path="admin/view/template/catalog/category_form.tpl" error="skip">
  
    <operation error="skip" v="2.0">
      <search position="before"><![CDATA[<li><a href="#tab-design" data-toggle="tab"><?php echo $tab_design; ?></a></li>]]></search>
      <add position="before"><![CDATA[
      <?php if (!empty($seo_multistore_active)) { ?>
      <li><a href="#tab-seo" data-toggle="tab">SEO</a></li>
      <?php } ?>
      ]]></add>
    </operation>
    
    <operation error="skip" v="2.0">
      <search position="before"><![CDATA[<div class="tab-pane" id="tab-design">]]></search>
      <add position="before"><![CDATA[
      <div class="tab-pane" id="tab-seo">
        <?php echo $seo_package_tab; ?>
      </div>
      ]]></add>
    </operation>
    
    <operation error="skip" v="2.0">
      <search position="before" offset="1"><![CDATA[<?php echo $entry_meta_title; ?></label>]]></search>
      <add position="before" offset="1"><![CDATA[
      <?php echo isset($seo_package_snippet_metas[$language['language_id']]) ? $seo_package_snippet_metas[$language['language_id']] : ''; ?>
      ]]></add>
    </operation>
    
    <operation error="skip" v="2.0">
      <search position="replace" offset="8"><![CDATA[<label class="col-sm-2 control-label" for="input-keyword"><span data-toggle="tooltip" title="<?php echo $help_keyword; ?>"><?php echo $entry_keyword; ?></span></label>]]></search>
      <add position="replace" offset="8"><![CDATA[
              <?php if (version_compare(VERSION, '2.2', '>=') || $this->registry->get('config')->get('mlseo_enabled')) { ?>
              <input type="hidden" name="keyword" />
              <?php } else { ?>
              <label class="col-sm-2 control-label" for="input-keyword"><span data-toggle="tooltip" title="<?php echo $help_keyword; ?>"><?php echo $entry_keyword; ?></span></label>
                <div class="col-sm-10">
                  <input type="text" name="keyword" value="<?php echo $keyword; ?>" placeholder="<?php echo $entry_keyword; ?>" id="input-keyword" class="form-control" />
                  <?php if ($error_keyword) { ?>
                  <div class="text-danger"><?php echo $error_keyword; ?></div>
                  <?php } ?>
                </div>
              </div>
              <div class="form-group">
              <?php } ?>
      ]]></add>
    </operation>
  
    <operation error="skip" v="2.0">
      <search position="replace"><![CDATA[<input type="text" name="category_description[<?php echo $language['language_id']; ?>][meta_title]" value="<?php echo isset($category_description[$language['language_id']]) ? $category_description[$language['language_id']]['meta_title'] : ''; ?>" placeholder="<?php echo $entry_meta_title; ?>" id="input-meta-title<?php echo $language['language_id']; ?>" class="form-control" />]]></search>
      <add position="replace"><![CDATA[                      <div class="input-group">
                        <input type="text" name="category_description[<?php echo $language['language_id']; ?>][meta_title]" value="<?php echo isset($category_description[$language['language_id']]) ? $category_description[$language['language_id']]['meta_title'] : ''; ?>" placeholder="<?php echo $entry_meta_title; ?>" id="input-meta-title<?php echo $language['language_id']; ?>" class="form-control" />
                        <span class="input-group-addon btn btn-primary" data-toggle="tooltip" title="Generate value" onClick="seoPackageGen('meta_title', '<?php echo $language['language_id']; ?>')"><i class="fa fa-bolt"></i></span>
                      </div>]]></add>
    </operation>
    
    <operation error="skip" v="2.0">
      <search position="replace"><![CDATA[<textarea name="category_description[<?php echo $language['language_id']; ?>][meta_description]" rows="5" placeholder="<?php echo $entry_meta_description; ?>" id="input-meta-description<?php echo $language['language_id']; ?>" class="form-control"><?php echo isset($category_description[$language['language_id']]) ? $category_description[$language['language_id']]['meta_description'] : ''; ?></textarea>]]></search>
      <add position="replace"><![CDATA[                      <div class="input-group">
                        <textarea name="category_description[<?php echo $language['language_id']; ?>][meta_description]" rows="5" placeholder="<?php echo $entry_meta_description; ?>" id="input-meta-description<?php echo $language['language_id']; ?>" class="form-control"><?php echo isset($category_description[$language['language_id']]) ? $category_description[$language['language_id']]['meta_description'] : ''; ?></textarea>
                        <span class="input-group-addon btn btn-primary" data-toggle="tooltip" title="Generate value" onClick="seoPackageGen('meta_description', '<?php echo $language['language_id']; ?>')"><i class="fa fa-bolt"></i></span>
                      </div>]]></add>
    </operation>
    
    <operation error="skip" v="2.0">
      <search position="replace"><![CDATA[<textarea name="category_description[<?php echo $language['language_id']; ?>][meta_keyword]" rows="5" placeholder="<?php echo $entry_meta_keyword; ?>" id="input-meta-keyword<?php echo $language['language_id']; ?>" class="form-control"><?php echo isset($category_description[$language['language_id']]) ? $category_description[$language['language_id']]['meta_keyword'] : ''; ?></textarea>]]></search>
      <add position="replace"><![CDATA[                      <div class="input-group">
                        <textarea name="category_description[<?php echo $language['language_id']; ?>][meta_keyword]" rows="5" placeholder="<?php echo $entry_meta_keyword; ?>" id="input-meta-keyword<?php echo $language['language_id']; ?>" class="form-control"><?php echo isset($category_description[$language['language_id']]) ? $category_description[$language['language_id']]['meta_keyword'] : ''; ?></textarea>
                        <span class="input-group-addon btn btn-primary" data-toggle="tooltip" title="Generate value" onClick="seoPackageGen('meta_keyword', '<?php echo $language['language_id']; ?>')"><i class="fa fa-bolt"></i></span>
                      </div>]]></add>
    </operation>
    
    <operation error="skip" v="1.5">
      <search position="replace" offset="1"><![CDATA[<td><?php echo $entry_keyword; ?></td>]]></search>
      <add position="replace" offset="1"><![CDATA[
            <?php if (version_compare(VERSION, '2.2', '>=') || $this->registry->get('config')->get('mlseo_enabled')) { ?>
              <td colspan="2"></td>
            <?php } else { ?>
              <td><?php echo $entry_keyword; ?></td>
              <td><input type="text" name="keyword" value="<?php echo $keyword; ?>" /></td>
            <?php } ?>
      ]]></add>
    </operation>
    
    <operation error="skip" v="1.5">
      <search position="before" offset="1"><![CDATA[<td><?php echo $entry_meta_description; ?></td>]]></search>
      <add position="before" offset="1"><![CDATA[
      <?php if (version_compare(VERSION, '2.2', '>=') || $this->registry->get('config')->get('mlseo_enabled')) { ?>
      <tr>
        <td>SEO Title:</td>
        <td><input type="text" name="category_description[<?php echo $language['language_id']; ?>][meta_title]" size="100" value="<?php echo isset($category_description[$language['language_id']]) ? $category_description[$language['language_id']]['meta_title'] : ''; ?>" /></td>
      </tr>
      <tr>
        <td>SEO H1:</td>
        <td><input type="text" name="category_description[<?php echo $language['language_id']; ?>][seo_h1]" size="100" value="<?php echo isset($category_description[$language['language_id']]) ? $category_description[$language['language_id']]['seo_h1'] : ''; ?>" /></td>
      </tr>
      <tr>
        <td>SEO H2:</td>
        <td><input type="text" name="category_description[<?php echo $language['language_id']; ?>][seo_h2]" size="100" value="<?php echo isset($category_description[$language['language_id']]) ? $category_description[$language['language_id']]['seo_h2'] : ''; ?>" /></td>
      </tr>
      <tr>
        <td>SEO H3:</td>
        <td><input type="text" name="category_description[<?php echo $language['language_id']; ?>][seo_h3]" size="100" value="<?php echo isset($category_description[$language['language_id']]) ? $category_description[$language['language_id']]['seo_h3'] : ''; ?>" /></td>
      </tr>
      <?php } ?>
      ]]></add>
      </operation>
    
    <operation error="skip" v="1.5">
      <search position="after" offset="2"><![CDATA[<td><?php echo $entry_description; ?></td>]]></search>
      <add position="after" offset="2"><![CDATA[
        <?php if (version_compare(VERSION, '2.2', '>=') || $this->registry->get('config')->get('mlseo_enabled')) { ?>
        <tr>
          <td><?php echo $entry_keyword; ?></td>
          <td><input type="text" name="category_description[<?php echo $language['language_id']; ?>][seo_keyword]" size="80" value="<?php echo isset($category_description[$language['language_id']]) ? $category_description[$language['language_id']]['seo_keyword'] : ''; ?>" /></td>
        </tr>
        <?php } ?>
      ]]></add>
    </operation>
    
  </file>
  
  <file path="admin/view/template/catalog/product_form.tpl" error="skip">
  
    <operation error="skip" v="2.0">
      <search position="before"><![CDATA[<li><a href="#tab-design" data-toggle="tab"><?php echo $tab_design; ?></a></li>]]></search>
      <add position="before"><![CDATA[
      <?php if (!empty($seo_multistore_active)) { ?>
      <li><a href="#tab-seo" data-toggle="tab">SEO</a></li>
      <?php } ?>
      ]]></add>
    </operation>
    
    <operation error="skip" v="2.0">
      <search position="before"><![CDATA[<div class="tab-pane" id="tab-design">]]></search>
      <add position="before"><![CDATA[
      <div class="tab-pane" id="tab-seo">
        <?php echo $seo_package_tab; ?>
      </div>
      ]]></add>
    </operation>
    
    <operation error="skip" v="2.0">
      <search position="before" index="0" offset="1"><![CDATA[<?php echo $entry_sort_order; ?></label>]]></search>
      <add position="before" index="0" offset="1"><![CDATA[
              <?php echo isset($seo_package_snippet_robots) ? $seo_package_snippet_robots : ''; ?>
      ]]></add>
    </operation>
    
    <operation error="skip" v="2.0">
      <ignoreif><![CDATA[<?php $cfg_hidden_fields = $config->get('config_hidden_fields_enabled'); ?>]]></ignoreif>
      <search position="replace" offset="8"><![CDATA[<label class="col-sm-2 control-label" for="input-keyword"><span data-toggle="tooltip" title="<?php echo $help_keyword; ?>"><?php echo $entry_keyword; ?></span></label>]]></search>
      <add position="replace" offset="8"><![CDATA[
              <?php if (version_compare(VERSION, '2.2', '>=') || $this->registry->get('config')->get('mlseo_enabled')) { ?>
              <input type="hidden" name="keyword" />
              <?php } else { ?>
              <label class="col-sm-2 control-label" for="input-keyword"><span data-toggle="tooltip" title="<?php echo $help_keyword; ?>"><?php echo $entry_keyword; ?></span></label>
                <div class="col-sm-10">
                  <input type="text" name="keyword" value="<?php echo $keyword; ?>" placeholder="<?php echo $entry_keyword; ?>" id="input-keyword" class="form-control" />
                  <?php if ($error_keyword) { ?>
                  <div class="text-danger"><?php echo $error_keyword; ?></div>
                  <?php } ?>
                </div>
              </div>
              <div class="form-group">
              <?php } ?>
      ]]></add>
    </operation>
    
    <operation error="skip" v="2.0">
      <search position="before" offset="1"><![CDATA[<?php echo $entry_meta_title; ?></label>]]></search>
      <add position="before" offset="1"><![CDATA[
      <?php echo isset($seo_package_snippet_metas[$language['language_id']]) ? $seo_package_snippet_metas[$language['language_id']] : ''; ?>
      ]]></add>
    </operation>
  
    <operation error="skip" v="2.0">
      <search position="replace"><![CDATA[<input type="text" name="product_description[<?php echo $language['language_id']; ?>][meta_title]" value="<?php echo isset($product_description[$language['language_id']]) ? $product_description[$language['language_id']]['meta_title'] : ''; ?>" placeholder="<?php echo $entry_meta_title; ?>" id="input-meta-title<?php echo $language['language_id']; ?>" class="form-control" />]]></search>
      <add position="replace"><![CDATA[                      <div class="input-group">
                        <input type="text" name="product_description[<?php echo $language['language_id']; ?>][meta_title]" value="<?php echo isset($product_description[$language['language_id']]) ? $product_description[$language['language_id']]['meta_title'] : ''; ?>" placeholder="<?php echo $entry_meta_title; ?>" id="input-meta-title<?php echo $language['language_id']; ?>" class="form-control" />
                        <span class="input-group-addon btn btn-primary" data-toggle="tooltip" title="Generate value" onClick="seoPackageGen('meta_title', '<?php echo $language['language_id']; ?>')"><i class="fa fa-bolt"></i></span>
                      </div>]]></add>
    </operation>
    
    <operation error="skip" v="2.0">
      <search position="replace"><![CDATA[<textarea name="product_description[<?php echo $language['language_id']; ?>][meta_description]" rows="5" placeholder="<?php echo $entry_meta_description; ?>" id="input-meta-description<?php echo $language['language_id']; ?>" class="form-control"><?php echo isset($product_description[$language['language_id']]) ? $product_description[$language['language_id']]['meta_description'] : ''; ?></textarea>]]></search>
      <add position="replace"><![CDATA[                      <div class="input-group">
                        <textarea name="product_description[<?php echo $language['language_id']; ?>][meta_description]" rows="5" placeholder="<?php echo $entry_meta_description; ?>" id="input-meta-description<?php echo $language['language_id']; ?>" class="form-control"><?php echo isset($product_description[$language['language_id']]) ? $product_description[$language['language_id']]['meta_description'] : ''; ?></textarea>
                        <span class="input-group-addon btn btn-primary" data-toggle="tooltip" title="Generate value" onClick="seoPackageGen('meta_description', '<?php echo $language['language_id']; ?>')"><i class="fa fa-bolt"></i></span>
                      </div>]]></add>
    </operation>
    
    <operation error="skip" v="2.0">
      <search position="replace"><![CDATA[<textarea name="product_description[<?php echo $language['language_id']; ?>][meta_keyword]" rows="5" placeholder="<?php echo $entry_meta_keyword; ?>" id="input-meta-keyword<?php echo $language['language_id']; ?>" class="form-control"><?php echo isset($product_description[$language['language_id']]) ? $product_description[$language['language_id']]['meta_keyword'] : ''; ?></textarea>]]></search>
      <add position="replace"><![CDATA[                      <div class="input-group">
                        <textarea name="product_description[<?php echo $language['language_id']; ?>][meta_keyword]" rows="5" placeholder="<?php echo $entry_meta_keyword; ?>" id="input-meta-keyword<?php echo $language['language_id']; ?>" class="form-control"><?php echo isset($product_description[$language['language_id']]) ? $product_description[$language['language_id']]['meta_keyword'] : ''; ?></textarea>
                        <span class="input-group-addon btn btn-primary" data-toggle="tooltip" title="Generate value" onClick="seoPackageGen('meta_keyword', '<?php echo $language['language_id']; ?>')"><i class="fa fa-bolt"></i></span>
                      </div>]]></add>
    </operation>
    
    <operation error="skip" v="2.0">
      <search position="replace"><![CDATA[<input type="text" name="product_description[<?php echo $language['language_id']; ?>][tag]" value="<?php echo isset($product_description[$language['language_id']]) ? $product_description[$language['language_id']]['tag'] : ''; ?>" placeholder="<?php echo $entry_tag; ?>" id="input-tag<?php echo $language['language_id']; ?>" class="form-control" />]]></search>
      <add position="replace"><![CDATA[                      <div class="input-group">
                        <input type="text" name="product_description[<?php echo $language['language_id']; ?>][tag]" value="<?php echo isset($product_description[$language['language_id']]) ? $product_description[$language['language_id']]['tag'] : ''; ?>" placeholder="<?php echo $entry_tag; ?>" id="input-tag<?php echo $language['language_id']; ?>" class="form-control" />
                        <span class="input-group-addon btn btn-primary" data-toggle="tooltip" title="Generate value" onClick="seoPackageGen('tag', '<?php echo $language['language_id']; ?>')"><i class="fa fa-bolt"></i></span>
                      </div>]]></add>
    </operation>
    
    <operation error="skip" v="2.0">
      <search position="before" index="0" offset="1"><![CDATA[<td><?php echo $entry_sort_order; ?></td>]]></search>
      <add position="before" index="0" offset="1"><![CDATA[
              <?php echo isset($seo_package_snippet_robots) ? $seo_package_snippet_robots : ''; ?>
      ]]></add>
    </operation>
    
    <operation error="skip" v="1.5">
      <search position="replace" offset="1"><![CDATA[<td><?php echo $entry_keyword; ?></td>]]></search>
      <add position="replace" offset="1"><![CDATA[
            <?php if (version_compare(VERSION, '2.2', '>=') || $this->registry->get('config')->get('mlseo_enabled')) { ?>
              <td colspan="2"></td>
            <?php } else { ?>
              <td><?php echo $entry_keyword; ?></td>
              <td><input type="text" name="keyword" value="<?php echo $keyword; ?>" /></td>
            <?php } ?>
      ]]></add>
    </operation>
    
    <operation error="skip" v="1.5">
      <search position="before" offset="1"><![CDATA[<td><?php echo $entry_meta_description; ?></td>]]></search>
      <add position="before" offset="1"><![CDATA[
      <?php if (version_compare(VERSION, '2.2', '>=') || $this->registry->get('config')->get('mlseo_enabled')) { ?>
      <tr>
        <td>SEO Title:</td>
        <td><input type="text" name="product_description[<?php echo $language['language_id']; ?>][meta_title]" size="100" value="<?php echo isset($product_description[$language['language_id']]) ? $product_description[$language['language_id']]['meta_title'] : ''; ?>" /></td>
      </tr>
      <tr>
        <td>SEO H1:</td>
        <td><input type="text" name="product_description[<?php echo $language['language_id']; ?>][seo_h1]" size="100" value="<?php echo isset($product_description[$language['language_id']]) ? $product_description[$language['language_id']]['seo_h1'] : ''; ?>" /></td>
      </tr>
      <tr>
        <td>SEO H2:</td>
        <td><input type="text" name="product_description[<?php echo $language['language_id']; ?>][seo_h2]" size="100" value="<?php echo isset($product_description[$language['language_id']]) ? $product_description[$language['language_id']]['seo_h2'] : ''; ?>" /></td>
      </tr>
      <tr>
        <td>SEO H3:</td>
        <td><input type="text" name="product_description[<?php echo $language['language_id']; ?>][seo_h3]" size="100" value="<?php echo isset($product_description[$language['language_id']]) ? $product_description[$language['language_id']]['seo_h3'] : ''; ?>" /></td>
      </tr>
      <?php } ?>
      ]]></add>
      </operation>
    
    <operation error="skip" v="1.5">
      <search position="after" offset="2"><![CDATA[<td><?php echo $entry_tag; ?></td>]]></search>
      <add position="after" offset="2"><![CDATA[
      <?php if (version_compare(VERSION, '2.2', '>=') || $this->registry->get('config')->get('mlseo_enabled')) { ?>
      <tr>
        <td><?php echo $entry_keyword; ?></td>
        <td><input type="text" name="product_description[<?php echo $language['language_id']; ?>][seo_keyword]" size="80" value="<?php echo isset($product_description[$language['language_id']]) ? $product_description[$language['language_id']]['seo_keyword'] : ''; ?>" /></td>
      </tr>
      <?php } ?>
      ]]></add>
    </operation>
    
  </file>
  
  <file path="admin/view/template/catalog/product_form.twig" error="skip" v="3">
    
    <operation error="skip">
      <search position="before" offset="1"><![CDATA[<label class="col-sm-2 control-label" for="input-filter"><span data-toggle="tooltip" title="{{ help_filter }}">{{ entry_filter }}</span></label>]]></search>
      <add position="before" offset="1"><![CDATA[
        {{seo_package_snippet_seo_canonical}}
      ]]></add>
    </operation>
    
    <operation error="skip">
      <search position="replace"><![CDATA[<li><a href="#tab-seo" data-toggle="tab">{{ tab_seo }}</a></li>]]></search>
      <add position="replace"><![CDATA[{% if seo_multistore_active %}<li><a href="#tab-seo" data-toggle="tab">{{ tab_seo }}</a></li>{% endif %}]]></add>
    </operation>
    
    <operation error="skip">
      <search position="before" index="0" offset="1"><![CDATA[{{ entry_sort_order }}</label>]]></search>
      <add position="before" index="0" offset="1"><![CDATA[
              {{seo_package_snippet_robots}}
      ]]></add>
    </operation>
    
    <operation>
      <search position="replace"><![CDATA[<div class="tab-pane" id="tab-seo">]]></search>
      <add position="replace"><![CDATA[
      <div class="tab-pane" id="tab-seo">
        {{seo_package_tab}}
      </div>
      <div class="tab-pane" id="tab-seo-disabled">]]></add>
    </operation>
    
    <operation>
      <search position="replace"><![CDATA[name="product_seo_url[{{ store.store_id }}][{{ language.language_id }}]]]></search>
      <add position="replace"><![CDATA[name="product_seo_url_disabled[{{ store.store_id }}][{{ language.language_id }}]]]></add>
    </operation>
    
    <operation>
      <search position="before" offset="1"><![CDATA[{{ entry_meta_title }}</label>]]></search>
      <add position="before" offset="1"><![CDATA[
        {{seo_package_snippet_metas[language.language_id]}}
      ]]></add>
    </operation>
  
    <operation error="skip" v="2.0">
      <search position="replace"><![CDATA[<input type="text" name="product_description[{{ language.language_id }}][meta_title]" value="{{ product_description[language.language_id] ? product_description[language.language_id].meta_title }}" placeholder="{{ entry_meta_title }}" id="input-meta-title{{ language.language_id }}" class="form-control" />]]></search>
      <add position="replace"><![CDATA[                      <div class="input-group">
                        <input type="text" name="product_description[{{ language.language_id }}][meta_title]" value="{{ product_description[language.language_id] ? product_description[language.language_id].meta_title }}" placeholder="{{ entry_meta_title }}" id="input-meta-title{{ language.language_id }}" class="form-control" />
                        <span class="input-group-addon btn btn-primary" data-toggle="tooltip" title="Generate value" onClick="seoPackageGen('meta_title', '{{language.language_id}}')"><i class="fa fa-bolt"></i></span>
                      </div>]]></add>
    </operation>
    
  </file><file path="admin/view/template/catalog/product_form.twig" error="skip" v="3">
  
    <operation error="skip" v="2.0">
      <search position="replace"><![CDATA[<input type="text" name="product_description[{{ language.language_id }}][meta_title]" value="{{ product_description[language.language_id] ? product_description[language.language_id].meta_title }}" placeholder="{{ entry_meta_title }}" id="input-meta-title{{ language.language_id }}" class="form-control"/>]]></search>
      <add position="replace"><![CDATA[                      <div class="input-group">
                        <input type="text" name="product_description[{{ language.language_id }}][meta_title]" value="{{ product_description[language.language_id] ? product_description[language.language_id].meta_title }}" placeholder="{{ entry_meta_title }}" id="input-meta-title{{ language.language_id }}" class="form-control" />
                        <span class="input-group-addon btn btn-primary" data-toggle="tooltip" title="Generate value" onClick="seoPackageGen('meta_title', '{{language.language_id}}')"><i class="fa fa-bolt"></i></span>
                      </div>]]></add>
    </operation>
    
  </file><file path="admin/view/template/catalog/product_form.twig" error="skip" v="3">
  
    <operation error="skip" v="2.0">
      <search position="replace"><![CDATA[<textarea name="product_description[{{ language.language_id }}][meta_description]" rows="5" placeholder="{{ entry_meta_description }}" id="input-meta-description{{ language.language_id }}" class="form-control">{{ product_description[language.language_id] ? product_description[language.language_id].meta_description }}</textarea>]]></search>
      <add position="replace"><![CDATA[                      <div class="input-group">
                        <textarea name="product_description[{{ language.language_id }}][meta_description]" rows="5" placeholder="{{ entry_meta_description }}" id="input-meta-description{{ language.language_id }}" class="form-control">{{ product_description[language.language_id] ? product_description[language.language_id].meta_description }}</textarea>
                        <span class="input-group-addon btn btn-primary" data-toggle="tooltip" title="Generate value" onClick="seoPackageGen('meta_description', '{{language.language_id}}')"><i class="fa fa-bolt"></i></span>
                      </div>]]></add>
    </operation>
    
    <operation error="skip" v="2.0">
      <search position="replace"><![CDATA[<textarea name="product_description[{{ language.language_id }}][meta_keyword]" rows="5" placeholder="{{ entry_meta_keyword }}" id="input-meta-keyword{{ language.language_id }}" class="form-control">{{ product_description[language.language_id] ? product_description[language.language_id].meta_keyword }}</textarea>]]></search>
      <add position="replace"><![CDATA[                      <div class="input-group">
                        <textarea name="product_description[{{ language.language_id }}][meta_keyword]" rows="5" placeholder="{{ entry_meta_keyword }}" id="input-meta-keyword{{ language.language_id }}" class="form-control">{{ product_description[language.language_id] ? product_description[language.language_id].meta_keyword }}</textarea>
                        <span class="input-group-addon btn btn-primary" data-toggle="tooltip" title="Generate value" onClick="seoPackageGen('meta_keyword', '{{language.language_id}}')"><i class="fa fa-bolt"></i></span>
                      </div>]]></add>
    </operation>
    
    <operation error="skip" v="2.0">
      <search position="replace"><![CDATA[<input type="text" name="product_description[{{ language.language_id }}][tag]" value="{{ product_description[language.language_id] ? product_description[language.language_id].tag }}" placeholder="{{ entry_tag }}" id="input-tag{{ language.language_id }}" class="form-control" />]]></search>
      <add position="replace"><![CDATA[                      <div class="input-group">
                        <input type="text" name="product_description[{{ language.language_id }}][tag]" value="{{ product_description[language.language_id] ? product_description[language.language_id].tag }}" placeholder="{{ entry_tag }}" id="input-tag{{ language.language_id }}" class="form-control" />
                        <span class="input-group-addon btn btn-primary" data-toggle="tooltip" title="Generate value" onClick="seoPackageGen('tag', '{{language.language_id}}')"><i class="fa fa-bolt"></i></span>
                      </div>]]></add>
    </operation>
    
  </file>
  
  <file path="admin/view/template/catalog/category_form.twig" error="skip" v="3">
    
    <operation error="skip">
      <search position="replace"><![CDATA[<li><a href="#tab-seo" data-toggle="tab">{{ tab_seo }}</a></li>]]></search>
      <add position="replace"><![CDATA[{% if seo_multistore_active %}<li><a href="#tab-seo" data-toggle="tab">{{ tab_seo }}</a></li>{% endif %}]]></add>
    </operation>
    
    <operation>
      <search position="replace"><![CDATA[<div class="tab-pane" id="tab-seo">]]></search>
      <add position="replace"><![CDATA[
      <div class="tab-pane" id="tab-seo">
        {{seo_package_tab}}
      </div>
      <div class="tab-pane" id="tab-seo-disabled">]]></add>
    </operation>
    
    <operation>
      <search position="replace"><![CDATA[name="category_seo_url[{{ store.store_id }}][{{ language.language_id }}]]]></search>
      <add position="replace"><![CDATA[name="category_seo_url_disabled[{{ store.store_id }}][{{ language.language_id }}]]]></add>
    </operation>
    
    <operation>
      <search position="before" offset="1"><![CDATA[{{ entry_meta_title }}</label>]]></search>
      <add position="before" offset="1"><![CDATA[
        {{seo_package_snippet_metas[language.language_id]}}
      ]]></add>
    </operation>
  
    <operation error="skip" v="2.0">
      <search position="replace"><![CDATA[<input type="text" name="category_description[{{ language.language_id }}][meta_title]" value="{{ category_description[language.language_id] ? category_description[language.language_id].meta_title }}" placeholder="{{ entry_meta_title }}" id="input-meta-title{{ language.language_id }}" class="form-control" />]]></search>
      <add position="replace"><![CDATA[                      <div class="input-group">
                        <input type="text" name="category_description[{{ language.language_id }}][meta_title]" value="{{ category_description[language.language_id] ? category_description[language.language_id].meta_title }}" placeholder="{{ entry_meta_title }}" id="input-meta-title{{ language.language_id }}" class="form-control" />
                        <span class="input-group-addon btn btn-primary" data-toggle="tooltip" title="Generate value" onClick="seoPackageGen('meta_title', '{{language.language_id}}')"><i class="fa fa-bolt"></i></span>
                      </div>]]></add>
    </operation>
    
    <operation error="skip" v="2.0">
      <search position="replace"><![CDATA[<textarea name="category_description[{{ language.language_id }}][meta_description]" rows="5" placeholder="{{ entry_meta_description }}" id="input-meta-description{{ language.language_id }}" class="form-control">{{ category_description[language.language_id] ? category_description[language.language_id].meta_description }}</textarea>]]></search>
      <add position="replace"><![CDATA[                      <div class="input-group">
                        <textarea name="category_description[{{ language.language_id }}][meta_description]" rows="5" placeholder="{{ entry_meta_description }}" id="input-meta-description{{ language.language_id }}" class="form-control">{{ category_description[language.language_id] ? category_description[language.language_id].meta_description }}</textarea>
                        <span class="input-group-addon btn btn-primary" data-toggle="tooltip" title="Generate value" onClick="seoPackageGen('meta_description', '{{language.language_id}}')"><i class="fa fa-bolt"></i></span>
                      </div>]]></add>
    </operation>
    
    <operation error="skip" v="2.0">
      <search position="replace"><![CDATA[<textarea name="category_description[{{ language.language_id }}][meta_keyword]" rows="5" placeholder="{{ entry_meta_keyword }}" id="input-meta-keyword{{ language.language_id }}" class="form-control">{{ category_description[language.language_id] ? category_description[language.language_id].meta_keyword }}</textarea>]]></search>
      <add position="replace"><![CDATA[                      <div class="input-group">
                        <textarea name="category_description[{{ language.language_id }}][meta_keyword]" rows="5" placeholder="{{ entry_meta_keyword }}" id="input-meta-keyword{{ language.language_id }}" class="form-control">{{ category_description[language.language_id] ? category_description[language.language_id].meta_keyword }}</textarea>
                        <span class="input-group-addon btn btn-primary" data-toggle="tooltip" title="Generate value" onClick="seoPackageGen('meta_keyword', '{{language.language_id}}')"><i class="fa fa-bolt"></i></span>
                      </div>]]></add>
    </operation>
    
    <operation error="skip" v="2.0">
      <search position="replace"><![CDATA[<input type="text" name="category_description[{{ language.language_id }}][tag]" value="{{ category_description[language.language_id] ? category_description[language.language_id].tag }}" placeholder="{{ entry_tag }}" id="input-tag{{ language.language_id }}" class="form-control" />]]></search>
      <add position="replace"><![CDATA[                      <div class="input-group">
                        <input type="text" name="category_description[{{ language.language_id }}][tag]" value="{{ category_description[language.language_id] ? category_description[language.language_id].tag }}" placeholder="{{ entry_tag }}" id="input-tag{{ language.language_id }}" class="form-control" />
                        <span class="input-group-addon btn btn-primary" data-toggle="tooltip" title="Generate value" onClick="seoPackageGen('tag', '{{language.language_id}}')"><i class="fa fa-bolt"></i></span>
                      </div>]]></add>
    </operation>
    
  </file>
  
  <file path="admin/view/template/catalog/information_form.twig" error="skip" v="3">

    <operation error="skip">
      <search position="replace"><![CDATA[<li><a href="#tab-seo" data-toggle="tab">{{ tab_seo }}</a></li>]]></search>
      <add position="replace"><![CDATA[{% if seo_multistore_active %}<li><a href="#tab-seo" data-toggle="tab">{{ tab_seo }}</a></li>{% endif %}]]></add>
    </operation>
    
    <operation error="skip">
      <search position="before" index="0" offset="1"><![CDATA[{{ entry_sort_order }}</label>]]></search>
      <add position="before" index="0" offset="1"><![CDATA[
              {{seo_package_snippet_robots}}
      ]]></add>
    </operation>
    
    <operation>
      <search position="replace"><![CDATA[<div class="tab-pane" id="tab-seo">]]></search>
      <add position="replace"><![CDATA[
      <div class="tab-pane" id="tab-seo">
        {{seo_package_tab}}
      </div>
      <div class="tab-pane" id="tab-seo-disabled">]]></add>
    </operation>
    
    <operation>
      <search position="replace"><![CDATA[name="information_seo_url[{{ store.store_id }}][{{ language.language_id }}]]]></search>
      <add position="replace"><![CDATA[name="information_seo_url_disabled[{{ store.store_id }}][{{ language.language_id }}]]]></add>
    </operation>
    
    <operation>
      <search position="before" offset="1"><![CDATA[{{ entry_meta_title }}</label>]]></search>
      <add position="before" offset="1"><![CDATA[
        {{seo_package_snippet_metas[language.language_id]}}
      ]]></add>
    </operation>
  
    <operation error="skip" v="2.0">
      <search position="replace"><![CDATA[<input type="text" name="information_description[{{ language.language_id }}][meta_title]" value="{{ information_description[language.language_id] ? information_description[language.language_id].meta_title }}" placeholder="{{ entry_meta_title }}" id="input-meta-title{{ language.language_id }}" class="form-control" />]]></search>
      <add position="replace"><![CDATA[                      <div class="input-group">
                        <input type="text" name="information_description[{{ language.language_id }}][meta_title]" value="{{ information_description[language.language_id] ? information_description[language.language_id].meta_title }}" placeholder="{{ entry_meta_title }}" id="input-meta-title{{ language.language_id }}" class="form-control" />
                        <span class="input-group-addon btn btn-primary" data-toggle="tooltip" title="Generate value" onClick="seoPackageGen('meta_title', '{{language.language_id}}')"><i class="fa fa-bolt"></i></span>
                      </div>]]></add>
    </operation>
    
    <operation error="skip" v="2.0">
      <search position="replace"><![CDATA[<textarea name="information_description[{{ language.language_id }}][meta_description]" rows="5" placeholder="{{ entry_meta_description }}" id="input-meta-description{{ language.language_id }}" class="form-control">{{ information_description[language.language_id] ? information_description[language.language_id].meta_description }}</textarea>]]></search>
      <add position="replace"><![CDATA[                      <div class="input-group">
                        <textarea name="information_description[{{ language.language_id }}][meta_description]" rows="5" placeholder="{{ entry_meta_description }}" id="input-meta-description{{ language.language_id }}" class="form-control">{{ information_description[language.language_id] ? information_description[language.language_id].meta_description }}</textarea>
                        <span class="input-group-addon btn btn-primary" data-toggle="tooltip" title="Generate value" onClick="seoPackageGen('meta_description', '{{language.language_id}}')"><i class="fa fa-bolt"></i></span>
                      </div>]]></add>
    </operation>
    
    <operation error="skip" v="2.0">
      <search position="replace"><![CDATA[<textarea name="information_description[{{ language.language_id }}][meta_keyword]" rows="5" placeholder="{{ entry_meta_keyword }}" id="input-meta-keyword{{ language.language_id }}" class="form-control">{{ information_description[language.language_id] ? information_description[language.language_id].meta_keyword }}</textarea>]]></search>
      <add position="replace"><![CDATA[                      <div class="input-group">
                        <textarea name="information_description[{{ language.language_id }}][meta_keyword]" rows="5" placeholder="{{ entry_meta_keyword }}" id="input-meta-keyword{{ language.language_id }}" class="form-control">{{ information_description[language.language_id] ? information_description[language.language_id].meta_keyword }}</textarea>
                        <span class="input-group-addon btn btn-primary" data-toggle="tooltip" title="Generate value" onClick="seoPackageGen('meta_keyword', '{{language.language_id}}')"><i class="fa fa-bolt"></i></span>
                      </div>]]></add>
    </operation>
    
    <operation error="skip" v="2.0">
      <search position="replace"><![CDATA[<input type="text" name="information_description[{{ language.language_id }}][tag]" value="{{ information_description[language.language_id] ? information_description[language.language_id].tag }}" placeholder="{{ entry_tag }}" id="input-tag{{ language.language_id }}" class="form-control" />]]></search>
      <add position="replace"><![CDATA[                      <div class="input-group">
                        <input type="text" name="information_description[{{ language.language_id }}][tag]" value="{{ information_description[language.language_id] ? information_description[language.language_id].tag }}" placeholder="{{ entry_tag }}" id="input-tag{{ language.language_id }}" class="form-control" />
                        <span class="input-group-addon btn btn-primary" data-toggle="tooltip" title="Generate value" onClick="seoPackageGen('tag', '{{language.language_id}}')"><i class="fa fa-bolt"></i></span>
                      </div>]]></add>
    </operation>
    
  </file>
  
  <file path="admin/view/template/catalog/manufacturer_form.twig" error="skip" v="3">

    <operation>
      <search position="replace"><![CDATA[<div class="tab-pane" id="tab-seo">]]></search>
      <add position="replace"><![CDATA[
      {% if seo_enabled %}
      <div class="tab-pane" id="tab-seo">
        {{seo_package_tab}}
      </div>
      <div class="tab-pane" id="tab-seo-disabled">
      {% else %}
      <div class="tab-pane" id="tab-seo">
      {% endif %}
      ]]></add>
    </operation>
    
    <operation>
      <search position="replace"><![CDATA[name="manufacturer_seo_url[{{ store.store_id }}][{{ language.language_id }}]]]></search>
      <add position="replace"><![CDATA[name="manufacturer_seo_url{% if seo_enabled %}_disabled{% endif %}[{{ store.store_id }}][{{ language.language_id }}]]]></add>
    </operation>
    
  </file>
  
  <!--file path="admin/view/template/catalog/manufacturer_form.tpl" error="skip" v="1.5">

    <operation>
      <search position="replace"><![CDATA[<div id="tabs" class="htabs"><a href="#tab-general"><?php echo $tab_general; ?></a></div>]]></search>
      <add position="replace"><![CDATA[<div id="tabs" class="htabs"><a href="#tab-general"><?php echo $tab_general; ?></a><?php if (!empty($seo_enabled)) { ?><a href="#tab-seo">SEO</a><?php } ?></div>]]></add>
    </operation>
    
    <operation>
      <search position="before"><![CDATA[<div id="tab-general">]]></search>
      <add position="before"><![CDATA[
      <?php if (!empty($seo_enabled)) { ?>
      <div class="tab-pane" id="tab-seo">
        <?php echo $seo_package_tab; ?>
      </div>
      <?php } ?>
      ]]></add>
    </operation>
    
    <operation>
      <search position="replace" offset="2"><![CDATA[<td><?php echo $entry_keyword; ?></td>]]></search>
      <add position="replace"><![CDATA[
        <?php if (empty($seo_enabled)) { ?>
              <td><?php echo $entry_keyword; ?></td>
              <td><input type="text" name="keyword" value="<?php echo $keyword; ?>" /></td>
        <?php } ?>
      ]]></add>
    </operation>
    
  </file-->
  
  <file path="admin/view/template/catalog/information_form.tpl" error="skip">
  
    <operation error="skip" v="2.0">
      <search position="before"><![CDATA[<li><a href="#tab-design" data-toggle="tab"><?php echo $tab_design; ?></a></li>]]></search>
      <add position="before"><![CDATA[
      <?php if (!empty($seo_multistore_active)) { ?>
      <li><a href="#tab-seo" data-toggle="tab">SEO</a></li>
      <?php } ?>
      ]]></add>
    </operation>
    
    <operation error="skip" v="2.0">
      <search position="before"><![CDATA[<div class="tab-pane" id="tab-design">]]></search>
      <add position="before"><![CDATA[
      <div class="tab-pane" id="tab-seo">
        <?php echo $seo_package_tab; ?>
      </div>
      ]]></add>
    </operation>
    
    <operation error="skip" v="2.0">
      <search position="before" index="0" offset="1"><![CDATA[<?php echo $entry_sort_order; ?></label>]]></search>
      <add position="before" index="0" offset="1"><![CDATA[
              <?php echo isset($seo_package_snippet_robots) ? $seo_package_snippet_robots : ''; ?>
      ]]></add>
    </operation>
    
    <operation error="skip" v="2.0">
      <search position="before" offset="1"><![CDATA[<?php echo $entry_meta_title; ?></label>]]></search>
      <add position="before" offset="1"><![CDATA[
      <?php echo isset($seo_package_snippet_metas[$language['language_id']]) ? $seo_package_snippet_metas[$language['language_id']] : ''; ?>
      ]]></add>
    </operation>
    
    <operation error="skip" v="2.0">
      <search position="replace" offset="8"><![CDATA[<label class="col-sm-2 control-label" for="input-keyword"><span data-toggle="tooltip" title="<?php echo $help_keyword; ?>"><?php echo $entry_keyword; ?></span></label>]]></search>
      <add position="replace" offset="8"><![CDATA[
              <?php if (version_compare(VERSION, '2.2', '>=') || $this->registry->get('config')->get('mlseo_enabled')) { ?>
              <input type="hidden" name="keyword" />
              <?php } else { ?>
              <label class="col-sm-2 control-label" for="input-keyword"><span data-toggle="tooltip" title="<?php echo $help_keyword; ?>"><?php echo $entry_keyword; ?></span></label>
                <div class="col-sm-10">
                  <input type="text" name="keyword" value="<?php echo $keyword; ?>" placeholder="<?php echo $entry_keyword; ?>" id="input-keyword" class="form-control" />
                  <?php if ($error_keyword) { ?>
                  <div class="text-danger"><?php echo $error_keyword; ?></div>
                  <?php } ?>
                </div>
              </div>
              <div class="form-group">
              <?php } ?>
      ]]></add>
    </operation>
  
    <operation error="skip" v="2.0">
      <search position="replace"><![CDATA[<input type="text" name="information_description[<?php echo $language['language_id']; ?>][meta_title]" value="<?php echo isset($information_description[$language['language_id']]) ? $information_description[$language['language_id']]['meta_title'] : ''; ?>" placeholder="<?php echo $entry_meta_title; ?>" id="input-meta-title<?php echo $language['language_id']; ?>" class="form-control" />]]></search>
      <add position="replace"><![CDATA[                      <div class="input-group">
                        <input type="text" name="information_description[<?php echo $language['language_id']; ?>][meta_title]" value="<?php echo isset($information_description[$language['language_id']]) ? $information_description[$language['language_id']]['meta_title'] : ''; ?>" placeholder="<?php echo $entry_meta_title; ?>" id="input-meta-title<?php echo $language['language_id']; ?>" class="form-control" />
                        <span class="input-group-addon btn btn-primary" data-toggle="tooltip" title="Generate value" onClick="seoPackageGen('meta_title', '<?php echo $language['language_id']; ?>')"><i class="fa fa-bolt"></i></span>
                      </div>]]></add>
    </operation>
    
    <operation error="skip" v="2.0">
      <search position="replace"><![CDATA[<textarea name="information_description[<?php echo $language['language_id']; ?>][meta_description]" rows="5" placeholder="<?php echo $entry_meta_description; ?>" id="input-meta-description<?php echo $language['language_id']; ?>" class="form-control"><?php echo isset($information_description[$language['language_id']]) ? $information_description[$language['language_id']]['meta_description'] : ''; ?></textarea>]]></search>
      <add position="replace"><![CDATA[                      <div class="input-group">
                        <textarea name="information_description[<?php echo $language['language_id']; ?>][meta_description]" rows="5" placeholder="<?php echo $entry_meta_description; ?>" id="input-meta-description<?php echo $language['language_id']; ?>" class="form-control"><?php echo isset($information_description[$language['language_id']]) ? $information_description[$language['language_id']]['meta_description'] : ''; ?></textarea>
                        <span class="input-group-addon btn btn-primary" data-toggle="tooltip" title="Generate value" onClick="seoPackageGen('meta_description', '<?php echo $language['language_id']; ?>')"><i class="fa fa-bolt"></i></span>
                      </div>]]></add>
    </operation>
    
    <operation error="skip" v="2.0">
      <search position="replace"><![CDATA[<textarea name="information_description[<?php echo $language['language_id']; ?>][meta_keyword]" rows="5" placeholder="<?php echo $entry_meta_keyword; ?>" id="input-meta-keyword<?php echo $language['language_id']; ?>" class="form-control"><?php echo isset($information_description[$language['language_id']]) ? $information_description[$language['language_id']]['meta_keyword'] : ''; ?></textarea>]]></search>
      <add position="replace"><![CDATA[                      <div class="input-group">
                        <textarea name="information_description[<?php echo $language['language_id']; ?>][meta_keyword]" rows="5" placeholder="<?php echo $entry_meta_keyword; ?>" id="input-meta-keyword<?php echo $language['language_id']; ?>" class="form-control"><?php echo isset($information_description[$language['language_id']]) ? $information_description[$language['language_id']]['meta_keyword'] : ''; ?></textarea>
                        <span class="input-group-addon btn btn-primary" data-toggle="tooltip" title="Generate value" onClick="seoPackageGen('meta_keyword', '<?php echo $language['language_id']; ?>')"><i class="fa fa-bolt"></i></span>
                      </div>]]></add>
    </operation>
    
    <operation error="skip" v="1.5">
      <search position="replace" offset="2"><![CDATA[<td><?php echo $entry_keyword; ?></td>]]></search>
      <add position="replace" offset="2"><![CDATA[
            <?php if (version_compare(VERSION, '2.2', '>=') || $this->registry->get('config')->get('mlseo_enabled')) { ?>
              <td colspan="2"></td>
            <?php } else { ?>
              <td><?php echo $entry_keyword; ?></td>
              <td><input type="text" name="keyword" value="<?php echo $keyword; ?>" /></td>
            <?php } ?>
      ]]></add>
    </operation>

    <operation error="skip" v="1.5">
      <search position="before" offset="1"><![CDATA[<td><span class="required">*</span> <?php echo $entry_description; ?></td>]]></search>
      <add position="before" offset="1"><![CDATA[
        <?php if (version_compare(VERSION, '2.2', '>=') || $this->registry->get('config')->get('mlseo_enabled')) { ?>
        <tr>
          <td>SEO Title:</td>
          <td><input type="text" name="information_description[<?php echo $language['language_id']; ?>][meta_title]" size="100" value="<?php echo isset($information_description[$language['language_id']]) ? $information_description[$language['language_id']]['meta_title'] : ''; ?>" /></td>
        </tr>
            <tr>
          <td>SEO H1:</td>
          <td><input type="text" name="information_description[<?php echo $language['language_id']; ?>][seo_h1]" size="100" value="<?php echo isset($information_description[$language['language_id']]) ? $information_description[$language['language_id']]['seo_h1'] : ''; ?>" /></td>
        </tr>
        <tr>
          <td>SEO H2:</td>
          <td><input type="text" name="information_description[<?php echo $language['language_id']; ?>][seo_h2]" size="100" value="<?php echo isset($information_description[$language['language_id']]) ? $information_description[$language['language_id']]['seo_h2'] : ''; ?>" /></td>
        </tr>
        <tr>
          <td>SEO H3:</td>
          <td><input type="text" name="information_description[<?php echo $language['language_id']; ?>][seo_h3]" size="100" value="<?php echo isset($information_description[$language['language_id']]) ? $information_description[$language['language_id']]['seo_h3'] : ''; ?>" /></td>
        </tr>
        <tr>
          <td>Meta Tag Description:</td>
          <td><textarea name="information_description[<?php echo $language['language_id']; ?>][meta_description]" cols="40" rows="5"><?php echo isset($information_description[$language['language_id']]) ? $information_description[$language['language_id']]['meta_description'] : ''; ?></textarea></td>
        </tr>
        <tr>
          <td>Meta Tag Keywords:</td>
          <td><textarea name="information_description[<?php echo $language['language_id']; ?>][meta_keyword]" cols="40" rows="5"><?php echo isset($information_description[$language['language_id']]) ? $information_description[$language['language_id']]['meta_keyword'] : ''; ?></textarea></td>
        </tr>
        <?php } ?>
        ]]></add>
    </operation>
    
    <operation error="skip" v="1.5">
      <search position="after" offset="2"><![CDATA[<span class="error"><?php echo $error_description[$language['language_id']]; ?></span>]]></search>
      <add position="after" offset="2"><![CDATA[
      <?php if (version_compare(VERSION, '2.2', '>=') || $this->registry->get('config')->get('mlseo_enabled')) { ?>
      <tr>
        <td><?php echo $entry_keyword; ?></td>
        <td><input type="text" name="information_description[<?php echo $language['language_id']; ?>][seo_keyword]" size="80" value="<?php echo isset($information_description[$language['language_id']]) ? $information_description[$language['language_id']]['seo_keyword'] : ''; ?>" /></td>
      </tr>
      <?php } ?>
      ]]></add>
    </operation>
    
  </file>
  
  <file path="catalog/model/catalog/category.php">
  
    <operation error="skip">
      <search position="after"><![CDATA[$query = $this->db->query("SELECT DISTINCT * FROM " . DB_PREFIX . "category c LEFT JOIN " . DB_PREFIX . "category_description]]></search>
      <add position="after"><![CDATA[
    if ($this->config->get('mlseo_enabled') && $query->num_rows && $this->config->get('mlseo_multistore') && $this->config->get('config_store_id')) {
      $this->load->model('tool/seo_package');
      $seoDescription = $this->model_tool_seo_package->getSeoDescription('category', $query->row['category_id']);
      
      if (!empty($seoDescription['meta_title'])) {
        $query->row['meta_title'] = $seoDescription['meta_title'];
      }
      
      if (!empty($seoDescription['meta_description'])) {
        $query->row['meta_description'] = $seoDescription['meta_description'];
      }
      
      if (!empty($seoDescription['meta_keyword'])) {
        $query->row['meta_keyword'] = $seoDescription['meta_keyword'];
      }
      
      if (!empty($seoDescription['name'])) {
        $query->row['name'] = $seoDescription['name'];
      }
      
      if (isset($seoDescription['description']) && trim(strip_tags($seoDescription['description']))) {
        $query->row['description'] = $seoDescription['description'];
      }
      
      if (!empty($seoDescription['seo_h1'])) {
        $query->row['seo_h1'] = $seoDescription['seo_h1'];
      }
      
      if (!empty($seoDescription['seo_h2'])) {
        $query->row['seo_h2'] = $seoDescription['seo_h2'];
      }
      
      if (!empty($seoDescription['seo_h3'])) {
        $query->row['seo_h3'] = $seoDescription['seo_h3'];
      }
    }
      ]]></add>
    </operation>
    
    <operation error="skip">
      <search position="after"><![CDATA[$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "category c LEFT JOIN " . DB_PREFIX . "category_description]]></search>
      <add position="after"><![CDATA[
    if ($this->config->get('mlseo_enabled') && $query->num_rows && $this->config->get('mlseo_multistore') && $this->config->get('config_store_id')) {
      $this->load->model('tool/seo_package');
      foreach ($query->rows as &$row) {
        $seoDescription = $this->model_tool_seo_package->getSeoDescription('category', $row['category_id']);
        if (!empty($seoDescription['name'])) {
          $row['name'] = $seoDescription['name'];
        }
      }
    }
      ]]></add>
    </operation>
    
  </file>
  
  <file path="catalog/model/catalog/information.php">
  
    <operation error="skip">
      <search position="after"><![CDATA[$query = $this->db->query("SELECT DISTINCT * FROM " . DB_PREFIX . "information i LEFT JOIN " . DB_PREFIX . "information_description]]></search>
      <add position="after"><![CDATA[
    if ($this->config->get('mlseo_enabled') && $query->num_rows && $this->config->get('mlseo_multistore') && $this->config->get('config_store_id')) {
      $this->load->model('tool/seo_package');
      $seoDescription = $this->model_tool_seo_package->getSeoDescription('information', $query->row['information_id']);
      
      if (!empty($seoDescription['meta_title'])) {
        $query->row['meta_title'] = $seoDescription['meta_title'];
      }
      
      if (!empty($seoDescription['meta_description'])) {
        $query->row['meta_description'] = $seoDescription['meta_description'];
      }
      
      if (!empty($seoDescription['meta_keyword'])) {
        $query->row['meta_keyword'] = $seoDescription['meta_keyword'];
      }
      
      if (!empty($seoDescription['name'])) {
        $query->row['title'] = $seoDescription['name'];
      }
      
      if (isset($seoDescription['description']) && trim(strip_tags($seoDescription['description']))) {
        $query->row['description'] = $seoDescription['description'];
      }
      
      if (!empty($seoDescription['seo_h1'])) {
        $query->row['seo_h1'] = $seoDescription['seo_h1'];
      }
      
      if (!empty($seoDescription['seo_h2'])) {
        $query->row['seo_h2'] = $seoDescription['seo_h2'];
      }
      
      if (!empty($seoDescription['seo_h3'])) {
        $query->row['seo_h3'] = $seoDescription['seo_h3'];
      }
    }
      ]]></add>
    </operation>
    
    <operation error="skip">
      <search position="after"><![CDATA[$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "information i LEFT JOIN " . DB_PREFIX . "information_description]]></search>
      <add position="after"><![CDATA[
    if ($this->config->get('mlseo_enabled') && $query->num_rows && $this->config->get('mlseo_multistore') && $this->config->get('config_store_id')) {
      $this->load->model('tool/seo_package');
      foreach ($query->rows as &$row) {
        $seoDescription = $this->model_tool_seo_package->getSeoDescription('information', $row['information_id']);
        if (!empty($seoDescription['name'])) {
          $row['title'] = $seoDescription['name'];
        }
      }
    }
      ]]></add>
    </operation>
    
  </file>
  
  <file path="catalog/model/catalog/manufacturer.php">
  
    <operation error="skip">
      <!--search position="before"><![CDATA[$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "manufacturer m LEFT JOIN " . DB_PREFIX . "manufacturer_to_store m2s ON (m.manufacturer_id = m2s.manufacturer_id) WHERE m.manufacturer_id = '" . (int)$manufacturer_id . "']]></search-->
      <search position="before"><![CDATA[return $query->row;]]></search>
      <add position="before"><![CDATA[
    if ($this->config->get('mlseo_enabled') && !empty($query) && $query->num_rows) {
      $this->load->model('tool/seo_package');
      $seoDescription = $this->model_tool_seo_package->getSeoDescription('manufacturer', $query->row['manufacturer_id']);
      
      $query->row['meta_title'] = isset($seoDescription['meta_title']) ? $seoDescription['meta_title'] : '';
      $query->row['meta_description'] = isset($seoDescription['meta_description']) ? $seoDescription['meta_description'] : '';
      $query->row['meta_keyword'] = isset($seoDescription['meta_keyword']) ? $seoDescription['meta_keyword'] : '';
      $query->row['name'] = !empty($seoDescription['name']) ? $seoDescription['name'] : $query->row['name'];
      $query->row['description'] = isset($seoDescription['description']) ? html_entity_decode($seoDescription['description'], ENT_QUOTES, 'UTF-8') : '';
      $query->row['seo_h1'] = isset($seoDescription['seo_h1']) ? $seoDescription['seo_h1'] : '';
      $query->row['seo_h2'] = isset($seoDescription['seo_h2']) ? $seoDescription['seo_h2'] : '';
      $query->row['seo_h3'] = isset($seoDescription['seo_h3']) ? $seoDescription['seo_h3'] : '';
    }
      ]]></add>
    </operation>
    
    <operation error="skip">
      <search position="after"><![CDATA[$query = $this->db->query($sql);]]></search>
      <add position="after"><![CDATA[
        if ($this->config->get('mlseo_enabled') && $query->num_rows) {
          $this->load->model('tool/seo_package');
          foreach ($query->rows as &$row) {
            $seoDescription = $this->model_tool_seo_package->getSeoDescription('manufacturer', $row['manufacturer_id']);
            if (!empty($seoDescription['name'])) {
              $row['name'] = $seoDescription['name'];
            }
          }
        }
      ]]></add>
    </operation>
    
  </file>
  
  <file path="catalog/view/theme/journal3/template/product/manufacturer_info.twig" error="skip">
  
    <operation error="skip" i="description">
      <search position="before"><![CDATA[{{ content_top }}]]></search>
      <add position="before"><![CDATA[
        {% if description %}<div class="seo_brand_desc" style="padding-bottom:25px">{{description}}</div>{% endif %}
      ]]></add>
    </operation>
    
  </file><file path="catalog/view/theme/*/template/product/manufacturer_info.twig" error="skip">
  
    <operation error="skip" i="description">
      <ignoreif><![CDATA[seo_brand_desc]]></ignoreif>
      <search position="after"><![CDATA[{{ heading_title }}]]></search>
      <add position="after"><![CDATA[
        {% if description %}<div class="seo_brand_desc" style="padding-bottom:25px">{{description}}</div>{% endif %}
      ]]></add>
    </operation>
    
  </file><file path="catalog/view/theme/*/template/product/manufacturer_info.tpl" error="skip">
  
    <operation error="skip" i="description">
      <ignoreif><![CDATA[seo_brand_desc]]></ignoreif>
      <search position="after"><![CDATA[<h2><?php echo $heading_title; ?></h2>]]></search>
      <add position="after"><![CDATA[
        <?php if (!empty($description)) { ?><div class="seo_brand_desc" style="padding-bottom:25px"><?php echo $description; ?></div><?php } ?>
      ]]></add>
    </operation>
    
  </file>
  
  <file path="catalog/view/theme/journal2/template/product/manufacturer_info.twig" error="skip">
  
    <operation error="skip" i="description">
      <search position="after"><![CDATA[{{ heading_title }}]]></search>
      <add position="after"><![CDATA[
        {% if description %}<div class="seo_brand_desc" style="padding-bottom:25px">{{description}}</div>{% endif %}
      ]]></add>
    </operation>
    
  </file><file path="catalog/view/theme/journal2/template/product/manufacturer_info.tpl" error="skip">
  
    <operation error="skip" i="description">
      <search position="after"><![CDATA[<?php echo $heading_title; ?>]]></search>
      <add position="after"><![CDATA[
        <?php if (!empty($description)) { ?><div class="seo_brand_desc" style="padding-bottom:25px"><?php echo $description; ?></?php></div><?php } ?>
      ]]></add>
    </operation>
    
  </file>

  <file path="catalog/controller/journal3/search.php" i="fix journal3 search links" error="skip">
  
    <operation error="skip">
      <search position="replace"><![CDATA['href'        => $this->url->link('product/product', '&search=' . urlencode(html_entity_decode($this->request->get['search'], ENT_QUOTES, 'UTF-8')) . '&product_id=' . $result['product_id'] . $url),]]></search>
      <add position="replace"><![CDATA[
      'href'        => ($this->config->get('mlseo_fpp_remove_search')) ? $this->url->link('product/product', '&product_id=' . $result['product_id']) : $this->url->link('product/product', '&search=' . urlencode(html_entity_decode($this->request->get['search'], ENT_QUOTES, 'UTF-8')) . '&product_id=' . $result['product_id'] . $url),
        ]]></add>
    </operation>
    
  </file>
  
  <!-- titles, meta and image alt -->
  <file path="catalog/model/catalog/product.php">
  
    <operation>
      <search position="before"><![CDATA[$query->row['name'],]]></search>
      <add position="before"><![CDATA[
      'meta_title' => isset($query->row['meta_title']) ? $query->row['meta_title'] : '',
      'seo_h1' => isset($query->row['seo_h1']) ? $query->row['seo_h1'] : '',
      'seo_h2' => isset($query->row['seo_h2']) ? $query->row['seo_h2'] : '',
      'seo_h3' => isset($query->row['seo_h3']) ? $query->row['seo_h3'] : '',
      'image_title' => isset($query->row['image_title']) ? $query->row['image_title'] : '',
      'image_alt' => isset($query->row['image_alt']) ? $query->row['image_alt'] : '',
      'meta_robots' => isset($query->row['meta_robots']) ? $query->row['meta_robots'] : '',]]></add>
    </operation>
    
    <operation error="skip">
      <search position="before" index="0"><![CDATA[if ($query->num_rows) {]]></search>
      <add position="before" index="0"><![CDATA[
    if ($this->config->get('mlseo_enabled') && $query->num_rows && $this->config->get('mlseo_multistore') && $this->config->get('config_store_id')) {
      $this->load->model('tool/seo_package');
      $seoDescription = $this->model_tool_seo_package->getSeoDescription('product', $query->row['product_id']);
      
      if (!empty($seoDescription['meta_title'])) {
        $query->row['meta_title'] = $seoDescription['meta_title'];
      }
      
      if (!empty($seoDescription['meta_description'])) {
        $query->row['meta_description'] = $seoDescription['meta_description'];
      }
      
      if (!empty($seoDescription['meta_keyword'])) {
        $query->row['meta_keyword'] = $seoDescription['meta_keyword'];
      }
      
      if (!empty($seoDescription['image_alt'])) {
        $query->row['image_alt'] = $seoDescription['image_alt'];
      }
      
      if (!empty($seoDescription['image_title'])) {
        $query->row['image_title'] = $seoDescription['image_title'];
      }
      
      if (!empty($seoDescription['name'])) {
        $query->row['name'] = $seoDescription['name'];
      }
      
      if (isset($seoDescription['description']) && trim(strip_tags($seoDescription['description']))) {
        $query->row['description'] = $seoDescription['description'];
      }
      
      if (!empty($seoDescription['seo_h1'])) {
        $query->row['seo_h1'] = $seoDescription['seo_h1'];
      }
      
      if (!empty($seoDescription['seo_h2'])) {
        $query->row['seo_h2'] = $seoDescription['seo_h2'];
      }
      
      if (!empty($seoDescription['seo_h3'])) {
        $query->row['seo_h3'] = $seoDescription['seo_h3'];
      }
    }
      ]]></add>
    </operation>
    
  </file>
  
  <file path="catalog/controller/product/manufacturer.php">
    
    <operation>
      <search position="after"><![CDATA[data['continue'] = $this->url->link('common/home');]]></search>
      <add position="after"><![CDATA[
      if ($this->config->get('mlseo_enabled')) {
        $this->load->model('tool/seo_package');
        
        if ($this->config->get('mlseo_microdata')) {
          if (version_compare(VERSION, '2', '>=')) {
            $this->document->addSeoMeta($this->model_tool_seo_package->rich_snippet('microdata', 'manufacturer', $data));
          } else {
            $this->document->addSeoMeta($this->model_tool_seo_package->rich_snippet('microdata', 'manufacturer', $this->data));
          }
        }
      }
      ]]></add>
    </operation>
    
    <operation error="skip">
      <search position="replace"><![CDATA[=> $this->url->link('product/product', 'manufacturer_id=' . $result['manufacturer_id'] . '&product_id=' . $result['product_id'] . $url)]]></search>
      <add position="replace"><![CDATA[=> $this->url->link('product/product', 'manufacturer_id=' . $result['manufacturer_id'] . '&product_id=' . $result['product_id'])]]></add>
    </operation>
    
  </file><file path="catalog/controller/product/manufacturer.php">
  
    <operation error="skip" v="2.x" i="canonical">
      <search position="before"><![CDATA[if ($page == 1) {]]></search>
      <add position="before"><![CDATA[
      if ($page > 1 AND $this->config->get('mlseo_pagination_canonical')) {
         $this->document->addLink($this->url->link('product/manufacturer/info', 'manufacturer_id=' . $this->request->get['manufacturer_id']), 'canonical');
      }
      ]]></add>
    </operation>
    
  </file><file path="catalog/controller/product/manufacturer.php">
  
    <operation error="skip" v="3" i="fix OC 3 native bug on brand pagination">
      <search position="replace"><![CDATA['&page='. (($page - 2) ? '&page='. ($page - 1) : '')]]></search>
      <add position="replace"><![CDATA[(($page - 2) ? '&page='. ($page - 1) : '')]]></add>
    </operation>
    
  </file>
  
  <file path="catalog/controller/information/contact.php">
    
    <operation>
      <search position="before"><![CDATA[data['action'] = $this->url->link('information/contact']]></search>
      <add position="before"><![CDATA[
      if ($this->config->get('mlseo_enabled')) {
        $this->load->model('tool/seo_package');
        
        if ($this->config->get('mlseo_microdata')) {
          if (version_compare(VERSION, '2', '>=')) {
            $this->document->addSeoMeta($this->model_tool_seo_package->rich_snippet('microdata', 'contact', $data));
          } else {
            $this->document->addSeoMeta($this->model_tool_seo_package->rich_snippet('microdata', 'contact', $this->data));
          }
        }
      }
      ]]></add>
    </operation>
    
  </file>
  
  <file path="catalog/controller/product/product.php">

    <operation>
      <search position="after" offset="1"><![CDATA[data['heading_title'] = $product_info['name'];]]></search>
      <add position="after" offset="1"><![CDATA[
      if (version_compare(VERSION, '2', '>=')) {
        if ($this->config->get('mlseo_fpp_noprodbreadcrumb')) {
          array_pop($data['breadcrumbs']);
        }
        
        //$data['heading_title'] = $product_info['name'];
        
        $data["heading_title"] = !empty($product_info['seo_h1']) && $this->config->get('mlseo_enabled') ? $product_info['seo_h1'] : $product_info['name'];
        $data['seo_h1'] = !empty($product_info['seo_h1']) ? $product_info['seo_h1'] : '';
        $data['seo_h2'] = !empty($product_info['seo_h2']) ? $product_info['seo_h2'] : '';
        $data['seo_h3'] = !empty($product_info['seo_h3']) ? $product_info['seo_h3'] : '';
      } else {
        if ($this->config->get('mlseo_fpp_noprodbreadcrumb')) {
          array_pop($this->data['breadcrumbs']);
        }
        
        //$this->data['heading_title'] = $product_info['name'];
        
        $this->data["heading_title"] = !empty($product_info['seo_h1']) && $this->config->get('mlseo_enabled') ? $product_info['seo_h1'] : $product_info['name'];
        $this->data['seo_h1'] = !empty($product_info['seo_h1']) ? $product_info['seo_h1'] : '';
        $this->data['seo_h2'] = !empty($product_info['seo_h2']) ? $product_info['seo_h2'] : '';
        $this->data['seo_h3'] = !empty($product_info['seo_h3']) ? $product_info['seo_h3'] : '';
      }
      
      $this->load->model('catalog/review');
      
      $data['seo_reviews'] = '';
      
      if ($this->config->get('mlseo_reviews')) {
        $gkd_seo_reviews = $this->model_catalog_review->getReviewsByProductId($this->request->get['product_id'], 0, (int)$this->config->get('mlseo_reviews'));
        
        if (count($gkd_seo_reviews)) {
          $data['seo_reviews'] .= '<div class="seo_reviews">';
            foreach ($gkd_seo_reviews as $review) {
              $data['seo_reviews'] .= '<table class="table table-striped table-bordered seo_review">';
              $data['seo_reviews'] .= '<tr>';
              $data['seo_reviews'] .= '  <td style="width: 50%;"><strong>' . $review['author']. '</strong></td>';
              $data['seo_reviews'] .= '  <td class="text-right">' . $review['date_added']. '</td>';
              $data['seo_reviews'] .= '</tr>';
              $data['seo_reviews'] .= '<tr>';
              $data['seo_reviews'] .= '  <td colspan="2"><p>' . $review['text']. '</p>';
              for ($i = 1; $i <= 5; $i++) { 
                if ($review['rating'] < $i) {
                  $data['seo_reviews'] .= '    <span class="fa fa-stack"><i class="fa fa-star-o fa-stack-2x"></i></span>';
                } else {
                  $data['seo_reviews'] .= '    <span class="fa fa-stack"><i class="fa fa-star fa-stack-2x"></i><i class="fa fa-star-o fa-stack-2x"></i></span>';
                }
              }
              $data['seo_reviews'] .= '  </td>';
              $data['seo_reviews'] .= '</tr>';
              $data['seo_reviews'] .= '</table>';
            }
          $data['seo_reviews'] .= '</div>';
        }
      }
      
      if (!empty($product_info['meta_robots'])) {
        $this->document->addSeoMeta('<meta name="robots" content="'.$product_info['meta_robots'].'"/>'."\n");
      }
      
      if ($this->config->get('mlseo_header_lm_product')) {
        $array_lm = array(strtotime($product_info['date_modified']));
        
        if (strtotime($product_info['date_available']) < strtotime(date('Y-m-d'))) {
          $array_lm[] = strtotime($product_info['date_available']);
        }
        
        $special_query = $this->db->query("SELECT date_start, date_end FROM " . DB_PREFIX . "product_special ps WHERE ps.product_id = '".(int)$product_id."' AND ps.customer_group_id = '" . (int)$this->config->get('config_customer_group_id') . "' AND ((ps.date_start = '0000-00-00' OR ps.date_start < NOW()) AND (ps.date_end = '0000-00-00' OR ps.date_end > NOW()))")->row;
        
        if (!empty($special_query['date_start']) && strtotime($special_query['date_start']) < strtotime(date('Y-m-d'))) {
          $array_lm[] = strtotime($special_query['date_start']);
        }
        
        if (!empty($special_query['date_end']) && strtotime($special_query['date_end']) < strtotime(date('Y-m-d'))) {
          $array_lm[] = strtotime($special_query['date_end']);
        }
        
        $review_query = $this->db->query("SELECT date_modified FROM " . DB_PREFIX . "review WHERE product_id = '" . (int)$product_id . "' AND status = '1' ORDER BY date_modified DESC LIMIT 1")->row;
        
        if (!empty($review_query['date_modified']) && strtotime($review_query['date_modified']) < strtotime(date('Y-m-d'))) {
          $array_lm[] = strtotime($review_query['date_modified']);
        }
        
        $gkd_header_lm_date = max($array_lm);
        
        $this->response->addHeader('Last-Modified: '.date('D, d M Y H:i:s', $gkd_header_lm_date).' GMT');
      }
      ]]></add>
    </operation>
      
    <operation>
      <search position="after"><![CDATA[$this->model_catalog_product->updateViewed]]></search>
      <add position="after"><![CDATA[
      if ($this->config->get('mlseo_enabled')) {
        $this->load->model('tool/seo_package');
        
        if ($this->config->get('mlseo_opengraph')) {
          if (version_compare(VERSION, '2', '>=')) {
            $this->document->addSeoMeta($this->model_tool_seo_package->rich_snippet('opengraph', 'product', $data + array('product_info' => $product_info)));
          } else {
            $this->document->addSeoMeta($this->model_tool_seo_package->rich_snippet('opengraph', 'product', $this->data + array('product_info' => $product_info)));
          }
        }

        if ($this->config->get('mlseo_tcard')) {
          if (version_compare(VERSION, '2', '>=')) {
            $this->document->addSeoMeta($this->model_tool_seo_package->rich_snippet('tcard', 'product', $data + array('product_info' => $product_info)));
          } else {
            $this->document->addSeoMeta($this->model_tool_seo_package->rich_snippet('tcard', 'product', $this->data + array('product_info' => $product_info)));
          }
        }

        if ($this->config->get('mlseo_microdata')) {
          if (version_compare(VERSION, '2', '>=')) {
            $this->document->addSeoMeta($this->model_tool_seo_package->rich_snippet('microdata', 'product', $data + array('product_info' => $product_info)));
          } else {
            $this->document->addSeoMeta($this->model_tool_seo_package->rich_snippet('microdata', 'product', $this->data + array('product_info' => $product_info)));
          }
        }
      }
      ]]></add>
    </operation>
    
    <operation error="skip" v="2.0">
      <search position="replace"><![CDATA[$this->document->setTitle($product_info['meta_title']);]]></search>
      <add position="replace"><![CDATA[
      if ($this->config->get('mlseo_enabled')) {
        $this->document->setTitle(!empty($product_info['meta_title']) ? $product_info['meta_title'] : $product_info['name']);
        if (version_compare(VERSION, '2', '>=')) {
          $data['image_alt'] = !empty($product_info['image_alt']) ? $product_info['image_alt'] : '';
          $data['image_title'] = !empty($product_info['image_title']) ? $product_info['image_title'] : '';
        } else {
          $this->data['image_alt'] = !empty($product_info['image_alt']) ? $product_info['image_alt'] : '';
          $this->data['image_title'] = !empty($product_info['image_title']) ? $product_info['image_title'] : '';
        }
      } else {
        $this->document->setTitle($product_info['meta_title']);
      }
      ]]></add>
    </operation>
  
    <operation error="skip" v="1.5">
      <search position="replace"><![CDATA[$this->document->setTitle($product_info['name']);]]></search>
      <add position="replace"><![CDATA[
      if ($this->config->get('mlseo_enabled')) {
        $this->document->setTitle(!empty($product_info['meta_title']) ? $product_info['meta_title'] : $product_info['name']);
        if (version_compare(VERSION, '2', '>=')) {
          $data['image_alt'] = !empty($product_info['image_alt']) ? $product_info['image_alt'] : '';
          $data['image_title'] = !empty($product_info['image_title']) ? $product_info['image_title'] : '';
        } else {
          $this->data['image_alt'] = !empty($product_info['image_alt']) ? $product_info['image_alt'] : '';
          $this->data['image_title'] = !empty($product_info['image_title']) ? $product_info['image_title'] : '';
        }
      } else {
        $this->document->setTitle($product_info['name']);
      }
      ]]></add>
    </operation>
    
  </file>
  
  <file path="catalog/view/theme/*/template/product/product.tpl" error="skip">
  
    <!--operation error="skip"> Now in json
      <search position="before"><![CDATA[<?php echo $footer; ?>]]></search>
      <add position="before"><![CDATA[<?php echo !empty($mlseo_microdata) ? $mlseo_microdata : ''; ?>]]></add>
    </operation-->
    
    <!--operation error="skip"> seo reviews, now set it manually
      <search position="replace" error="skip"><![CDATA[<?php echo $footer; ?>]]></search>
      <add position="replace"><![CDATA[
<?php if ($gkd_seo_reviews) { ?>
<div style="display:none">
<?php foreach ($gkd_seo_reviews as $review) { ?>
<p><?php echo $review['author']; ?> - <?php echo $review['date_added']; ?><br/><?php echo $review['text']; ?></p>
<?php } ?>
</div>
<?php } ?>
<?php echo $footer; ?>]]></add>
    </operation-->
    
    <operation error="skip">
      <search position="replace"><![CDATA[alt="<?php echo $heading_title; ?>"]]></search>
      <add position="replace"><![CDATA[alt="<?php echo !empty($image_alt) ? $image_alt : $heading_title; ?>"]]></add>
    </operation>
    
    <operation error="skip">
      <search position="replace"><![CDATA[title="<?php echo $heading_title; ?>"]]></search>
      <add position="replace"><![CDATA[title="<?php echo !empty($image_title) ? $image_title : $heading_title; ?>"]]></add>
    </operation>
    
  </file>
  
  <file path="catalog/view/theme/*/template/product/product.twig" error="skip">
    
    <operation error="skip">
      <search position="replace"><![CDATA[alt="{{ heading_title }}"]]></search>
      <add position="replace"><![CDATA[alt="{{ image_alt ? image_alt : heading_title }}"]]></add>
    </operation>
    
    <operation error="skip">
      <search position="replace"><![CDATA[title="{{ heading_title }}"]]></search>
      <add position="replace"><![CDATA[title="{{ image_title ? image_title : heading_title }}"]]></add>
    </operation>
    
  </file>
  
  <file path="catalog/view/theme/*/template/product/category.tpl" error="skip">
  
    <operation error="skip">
      <search position="replace"><![CDATA[alt="<?php echo $product['name']; ?>"]]></search>
      <add position="replace"><![CDATA[alt="<?php echo !empty($product['image_alt']) ? $product['image_alt'] : $product['name']; ?>"]]></add>
    </operation>
    
    <operation error="skip">
      <search position="replace"><![CDATA[title="<?php echo $product['name']; ?>"]]></search>
      <add position="replace"><![CDATA[title="<?php echo !empty($product['image_title']) ? $product['image_title'] : $product['name']; ?>"]]></add>
    </operation>
    
  </file>

  <file path="catalog/view/theme/*/template/product/category.twig" error="skip">
    
    <operation error="skip">
      <search position="replace"><![CDATA[alt="{{ heading_title }}"]]></search>
      <add position="replace"><![CDATA[alt="{{ image_alt ? image_alt : heading_title }}"]]></add>
    </operation>
    
    <operation error="skip">
      <search position="replace"><![CDATA[title="{{ heading_title }}"]]></search>
      <add position="replace"><![CDATA[title="{{ image_title ? image_title : heading_title }}"]]></add>
    </operation>
    
  </file>
  
  <file path="catalog/controller/product/category.php">

    <operation error="skip">
      <search position="replace"><![CDATA[$data['heading_title'] = $category_info['name'];]]></search>
      <add position="replace"><![CDATA[
      //$data['heading_title'] = $category_info['name'];
      
      $data["heading_title"] = !empty($category_info['seo_h1']) && $this->config->get('mlseo_enabled') ? $category_info['seo_h1'] : $category_info['name'];
      
      $data['seo_h1'] = !empty($category_info['seo_h1']) ? $category_info['seo_h1'] : '';
      $data['seo_h2'] = !empty($category_info['seo_h2']) ? $category_info['seo_h2'] : '';
      $data['seo_h3'] = !empty($category_info['seo_h3']) ? $category_info['seo_h3'] : '';
      
      if ($this->config->get('mlseo_enabled')) {
        $this->load->model('tool/seo_package');
        
        if ($this->config->get('mlseo_microdata')) {
          $this->document->addSeoMeta($this->model_tool_seo_package->rich_snippet('microdata', 'category', $data));
        }
      }
      
      if ($this->config->get('mlseo_header_lm_category')) {
        $gkd_header_lm_date = strtotime($category_info['date_modified']);
        
        $this->response->addHeader('Last-Modified: '.date('D, d M Y H:i:s', $gkd_header_lm_date).' GMT');
      }
      ]]></add>
    </operation>

  </file><file path="catalog/controller/product/category.php" v="1.5">

    <operation>
      <search position="after"><![CDATA[=> $result['product_id'],]]></search>
        <add position="after"><![CDATA[
        'image_title' => isset($result['image_title']) ? $result['image_title'] : '',
        'image_alt' => isset($result['image_alt']) ? $result['image_alt'] : '',
        ]]></add>
    </operation>
    
    <operation error="skip" v="2.0"><!-- fix canonical and prev next links-->
      <search position="replace"><![CDATA[$this->url->link('product/category', 'path=' . $category_info['category_id']]]></search>
      <add position="replace"><![CDATA[$this->url->link('product/category', 'path=' . ($this->config->get('mlseo_enabled') && $this->config->get('mlseo_pagination_fix') ? $this->request->get['path'] : $category_info['category_id'])]]></add>
    </operation>
    
    <operation error="skip" v="2.0">
      <search position="replace"><![CDATA[$this->document->setTitle($category_info['meta_title']);]]></search>
      <add position="replace"><![CDATA[$this->document->setTitle(!empty($category_info['meta_title']) && $this->config->get('mlseo_enabled') ? $category_info['meta_title'] : $category_info['name']);]]></add>
    </operation>
  
    <operation error="skip" v="1.5">
      <search position="replace"><![CDATA[$this->document->setTitle($category_info['name']);]]></search>
      <add position="replace"><![CDATA[$this->document->setTitle(!empty($category_info['meta_title']) && $this->config->get('mlseo_enabled') ? $category_info['meta_title'] : $category_info['name']);]]></add>
    </operation>
    
  </file><file path="catalog/controller/product/category.php" v="1.5">
  
    <operation error="skip">
      <search position="replace"><![CDATA[$this->data['heading_title'] = $category_info['name'];]]></search>
      <add position="replace"><![CDATA[
      //$this->data['heading_title'] = $category_info['name'];
      
      $this->data["heading_title"] = !empty($category_info['seo_h1']) && $this->config->get('mlseo_enabled') ? $category_info['seo_h1'] : $category_info['name'];

      $this->data['seo_h1'] = !empty($category_info['seo_h1']) ? $category_info['seo_h1'] : '';
      $this->data['seo_h2'] = !empty($category_info['seo_h2']) ? $category_info['seo_h2'] : '';
      $this->data['seo_h3'] = !empty($category_info['seo_h3']) ? $category_info['seo_h3'] : '';
      
      
      if ($this->config->get('mlseo_enabled')) {
        $this->load->model('tool/seo_package');
        
        if ($this->config->get('mlseo_microdata')) {
          $this->document->addSeoMeta($this->model_tool_seo_package->rich_snippet('microdata', 'category', $this->data));
        }
      }
      
      if ($this->config->get('mlseo_header_lm_category')) {
        $gkd_header_lm_date = strtotime($category_info['date_modified']);
        
        $this->response->addHeader('Last-Modified: '.date('D, d M Y H:i:s', $gkd_header_lm_date).' GMT');
      }
      ]]></add>
    </operation>
    
  </file><file path="catalog/controller/product/category.php">
  
    <operation error="skip" i="seo headings">
      <search position="after"><![CDATA[$data['description'] = ]]></search>
      <add position="after"><![CDATA[
      $seoHeadings = $this->config->get('mlseo_headings');
      
      if ($this->config->get('mlseo_enabled')) {
        $extraTopDesc = $extraBottomDesc = '';
        
        foreach (array('h1', 'h2', 'h3') as $headingType) {
          if (!empty($seoHeadings['category'][$headingType]['pos']) && !empty($category_info['seo_'.$headingType]) && $seoHeadings['category'][$headingType]['pos'] == 'topdesc') {
            $extraTopDesc .= '<'.$headingType.' class="seo_'.$headingType.'"'.(!empty($seoHeadings['category'][$headingType]['css']) ? ' style="'.$seoHeadings['category'][$headingType]['css'].'"' : '').'>'.$category_info['seo_'.$headingType].'</'.$headingType.'>';
          }
          
          if (!empty($seoHeadings['category'][$headingType]['pos']) && !empty($category_info['seo_'.$headingType]) && $seoHeadings['category'][$headingType]['pos'] == 'botdesc') {
            $extraBottomDesc .= '<'.$headingType.' class="seo_'.$headingType.'"'.(!empty($seoHeadings['category'][$headingType]['css']) ? ' style="'.$seoHeadings['category'][$headingType]['css'].'"' : '').'>'.$category_info['seo_'.$headingType].'</'.$headingType.'>';
          }
        }
        
        if ($this->config->get('mlseo_autolink')) {
          $autolinks = $this->db->query("SELECT * FROM " . DB_PREFIX . "url_autolink WHERE language_id =  '". (int) $this->config->get('config_language_id') . "'")->rows;
          
          foreach ($autolinks as $autolink) {
            $data['description'] = preg_replace('/\b('.$autolink['query'].')\b/', '<a href="'.$autolink['redirect'].'">$1</a>', $data['description']);
          }
        }
        
        $data['description'] = $extraTopDesc . $data['description'] . $extraBottomDesc;
      }
      ]]></add>
    </operation>
    
  </file>
  
  <file path="catalog/controller/information/information.php">
    
    <operation>
      <search position="replace"><![CDATA[data['heading_title'] = $information_info['title'];]]></search>
      <add position="replace"><![CDATA[data['heading_title'] = !empty($information_info['seo_h1']) && $this->config->get('mlseo_enabled') ? $information_info['seo_h1'] : $information_info['title'];
        
        if (version_compare(VERSION, '2', '>=')) {
          $data['seo_h1'] = !empty($information_info['seo_h1']) ? $information_info['seo_h1'] : '';
          $data['seo_h2'] = !empty($information_info['seo_h2']) ? $information_info['seo_h2'] : '';
          $data['seo_h3'] = !empty($information_info['seo_h3']) ? $information_info['seo_h3'] : '';
        } else {
          $this->data['seo_h1'] = !empty($information_info['seo_h1']) ? $information_info['seo_h1'] : '';
          $this->data['seo_h2'] = !empty($information_info['seo_h2']) ? $information_info['seo_h2'] : '';
          $this->data['seo_h3'] = !empty($information_info['seo_h3']) ? $information_info['seo_h3'] : '';
        }
        
        $this->load->model('tool/seo_package');
  
        if ($this->config->get('mlseo_opengraph')) {
          if (version_compare(VERSION, '2', '>=')) {
            $this->document->addSeoMeta($this->model_tool_seo_package->rich_snippet('opengraph', 'info', $data));
          } else {
            $this->document->addSeoMeta($this->model_tool_seo_package->rich_snippet('opengraph', 'info', $this->data));
          }
          
          if ($this->config->get('mlseo_microdata')) {
            if (version_compare(VERSION, '2', '>=')) {
              $this->document->addSeoMeta($this->model_tool_seo_package->rich_snippet('microdata', 'information', $data));
            } else {
              $this->document->addSeoMeta($this->model_tool_seo_package->rich_snippet('microdata', 'information', $this->data));
            }
          }
        }
        
        if (!empty($information_info['meta_robots'])) {
          $this->document->addSeoMeta('<meta name="robots" content="'.$information_info['meta_robots'].'"/>'."\n");
        }
      ]]></add>
    </operation>
    
    <operation error="skip" v="2.0">
      <search position="replace"><![CDATA[$this->document->setTitle($information_info['meta_title']);]]></search>
      <add position="replace"><![CDATA[$this->document->setTitle(!empty($information_info['meta_title']) && $this->config->get('mlseo_enabled') ? $information_info['meta_title'] : $information_info['title']);]]></add>
    </operation>
    
    <operation error="skip" v="1.5">
      <search position="replace"><![CDATA[$this->document->setTitle($information_info['title']);]]></search>
      <add position="replace"><![CDATA[
      if ($this->config->get('mlseo_enabled')) {
        $this->document->setTitle(($information_info['meta_title'] ? $information_info['meta_title'] : $information_info['title']));
        $this->document->setKeywords($information_info['meta_keyword']);
        $this->document->setDescription($information_info['meta_description']);
      } else {
        $this->document->setTitle($information_info['title']);
      }
      ]]></add>
    </operation>
    
  </file><file path="catalog/controller/information/information.php">
  
    <operation error="skip" i="seo headings">
      <search position="after"><![CDATA[$data['description'] = ]]></search>
      <add position="after"><![CDATA[
      $seoHeadings = $this->config->get('mlseo_headings');
      
      if ($this->config->get('mlseo_enabled')) {
        $extraTopDesc = $extraBottomDesc = '';
        
        foreach (array('h1', 'h2', 'h3') as $headingType) {
          if (!empty($seoHeadings['information'][$headingType]['pos']) && !empty($information_info['seo_'.$headingType]) && $seoHeadings['information'][$headingType]['pos'] == 'topdesc') {
            $extraTopDesc .= '<'.$headingType.' class="seo_'.$headingType.'"'.(!empty($seoHeadings['information'][$headingType]['css']) ? ' style="'.$seoHeadings['information'][$headingType]['css'].'"' : '').'>'.$information_info['seo_'.$headingType].'</'.$headingType.'>';
          }
          
          if (!empty($seoHeadings['information'][$headingType]['pos']) && !empty($information_info['seo_'.$headingType]) && $seoHeadings['information'][$headingType]['pos'] == 'botdesc') {
            $extraBottomDesc .= '<'.$headingType.' class="seo_'.$headingType.'"'.(!empty($seoHeadings['information'][$headingType]['css']) ? ' style="'.$seoHeadings['information'][$headingType]['css'].'"' : '').'>'.$information_info['seo_'.$headingType].'</'.$headingType.'>';
          }
        }
        
        if ($this->config->get('mlseo_autolink')) {
          $autolinks = $this->db->query("SELECT * FROM " . DB_PREFIX . "url_autolink WHERE language_id =  '". (int) $this->config->get('config_language_id') . "'")->rows;
          
          foreach ($autolinks as $autolink) {
            $data['description'] = preg_replace('/\b('.$autolink['query'].')\b/', '<a href="'.$autolink['redirect'].'">$1</a>', $data['description']);
          }
        }
        
        $data['description'] = $extraTopDesc . $data['description'] . $extraBottomDesc;
      }
      ]]></add>
    </operation>
    
  </file>
  
  <file path="catalog/controller/product/manufacturer.php">
    
    <operation>
      <search position="replace"><![CDATA[data['heading_title'] = $manufacturer_info['name'];]]></search>
      <add position="replace"><![CDATA[data['heading_title'] = !empty($manufacturer_info['seo_h1']) && $this->config->get('mlseo_enabled') ? $manufacturer_info['seo_h1'] : $manufacturer_info['name'];
        
        if (version_compare(VERSION, '2', '>=')) {
          $data['seo_h1'] = !empty($manufacturer_info['seo_h1']) ? $manufacturer_info['seo_h1'] : '';
          $data['seo_h2'] = !empty($manufacturer_info['seo_h2']) ? $manufacturer_info['seo_h2'] : '';
          $data['seo_h3'] = !empty($manufacturer_info['seo_h3']) ? $manufacturer_info['seo_h3'] : '';
          $data['description'] = !empty($manufacturer_info['description']) ? html_entity_decode($manufacturer_info['description'], ENT_QUOTES, 'UTF-8') : '';
        } else {
          $this->data['seo_h1'] = !empty($manufacturer_info['seo_h1']) ? $manufacturer_info['seo_h1'] : '';
          $this->data['seo_h2'] = !empty($manufacturer_info['seo_h2']) ? $manufacturer_info['seo_h2'] : '';
          $this->data['seo_h3'] = !empty($manufacturer_info['seo_h3']) ? $manufacturer_info['seo_h3'] : '';
          $this->data['description'] = !empty($manufacturer_info['description']) ? html_entity_decode($manufacturer_info['description'], ENT_QUOTES, 'UTF-8') : '';
        }
      ]]></add>
    </operation>
    
    <operation error="skip">
      <search position="replace"><![CDATA[$this->document->setTitle($manufacturer_info['name']);]]></search>
      <add position="replace"><![CDATA[
      if ($this->config->get('mlseo_enabled')) {
        $this->document->setTitle((!empty($manufacturer_info['meta_title']) ? $manufacturer_info['meta_title'] : $manufacturer_info['name']));
        
        if (!empty($manufacturer_info['meta_keyword'])) {
          $this->document->setKeywords($manufacturer_info['meta_keyword']);
        }
        
        if (!empty($manufacturer_info['meta_description'])) {
          $this->document->setDescription($manufacturer_info['meta_description']);
        }
      } else {
        $this->document->setTitle($manufacturer_info['name']);
      }
      ]]></add>
    </operation>
    
  </file>
  
  <file path="catalog/controller/*/seo_url.php" error="skip" v="3">
    
    <operation error="skip">
      <search position="replace"><![CDATA[$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "seo_url WHERE keyword = '" . $this->db->escape($part) . "' AND store_id = '" . (int)$this->config->get('config_store_id') . "'");]]></search>
      <add position="replace"><![CDATA[$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "seo_url WHERE (keyword = '" . $this->db->escape($part) . "' OR keyword = '" . $this->db->escape($this->request->get['_route_']) . "') AND store_id = '" . (int)$this->config->get('config_store_id') . "'");
      
        if ($this->config->get('mlseo_enabled') && $this->config->get('mlseo_absolute') && $query->num_rows > 1) {
          $currUrlValues = array();
          
          foreach ($query->rows as $key => $row) {
            // delete duplicate language
            if (in_array($row['query'], $currUrlValues)) {
              unset($query->rows[$key]);
              continue;
            }
            
            // if absolute enabled and we are not in subcategory and something else than category is found, then show this entry (manufacturer), else remove non-categories entries
            $currUrlValues[] = $row['query'];
            
            if (!$seoIsCategory && strpos($row['query'], 'category_id=') !== 0) {
              $query->row = $row;
              $query->rows = array($row);
              break;
            } if ($seoIsCategory && strpos($row['query'], 'manufacturer_id=') === 0) {
              unset($query->rows[$key]);
            }
          }
          
          $query->row = reset($query->rows);
          $query->num_rows = count($query->rows);
        }
      ]]></add>
    </operation>
    
  </file><file path="catalog/controller/*/seo_url.php" error="skip">
  
    <operation>
      <search position="after" offset="1"><![CDATA[$this->url->addRewrite($this);]]></search>
      <add position="after" offset="1"><![CDATA[
      if ($this->config->get('mlseo_enabled')) {
        // fix &amp; issue
        if (version_compare(VERSION, '2', '<')) {
          $_SERVER['REQUEST_URI'] = str_replace('&amp;', '&', $_SERVER['REQUEST_URI']);
        }
        
        // consider index.html as homepage too
        if ($_SERVER['REQUEST_URI'] == '/index.html') {
          return new Action('common/home');
        }
        
        // HTTP redirect
        if ($this->config->get('mlseo_redirect_http') && !empty($_SERVER['HTTP_HOST'])) {
          $isSSL = !empty($_SERVER['HTTPS']);
          $isWWW = strtolower(substr($_SERVER['HTTP_HOST'], 0, 4)) == 'www.';
          
          $redirLoc = false;
          
          if ($this->config->get('mlseo_redirect_http') == 1 && ($isSSL || $isWWW)) {
            $redirLoc = 'Location: ' . urldecode('http://'.str_replace('www.', '', $_SERVER['HTTP_HOST']).$_SERVER['REQUEST_URI']);
          } else if ($this->config->get('mlseo_redirect_http') == 2 && ($isSSL || !$isWWW)) {
            $redirLoc = 'Location: ' . urldecode('http://www.'.str_replace('www.', '', $_SERVER['HTTP_HOST']).$_SERVER['REQUEST_URI']);
          } else if ($this->config->get('mlseo_redirect_http') == 3 && (!$isSSL || $isWWW)) {
            $redirLoc = 'Location: ' . urldecode('https://'.str_replace('www.', '', $_SERVER['HTTP_HOST']).$_SERVER['REQUEST_URI']);
          } else if ($this->config->get('mlseo_redirect_http') == 4 && (!$isSSL || !$isWWW)) {
            $redirLoc = 'Location: ' . urldecode('https://www.'.str_replace('www.', '', $_SERVER['HTTP_HOST']).$_SERVER['REQUEST_URI']);
          } else if ($this->config->get('mlseo_redirect_http') == 5 && (!$isSSL)) {
            $redirLoc = 'Location: ' . urldecode('https://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
          } else if ($this->config->get('mlseo_redirect_http') == 6 && ($isSSL)) {
            $redirLoc = 'Location: ' . urldecode('http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
          } else if ($this->config->get('mlseo_redirect_http') == 7 && (!$isWWW)) {
            $redirLoc = 'Location: ' . urldecode('http'.($isSSL?'s':'').'://www.'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
          } else if ($this->config->get('mlseo_redirect_http') == 8 && ($isWWW)) {
            $redirLoc = 'Location: ' . urldecode('http'.($isSSL?'s':'').'://'.str_replace('www.', '', $_SERVER['HTTP_HOST']).$_SERVER['REQUEST_URI']);
          }
          
          if ($redirLoc) {
            header('HTTP/1.1 301 Moved Permanently');
            header('CSP-Redir: http (Mode:'.$this->config->get('mlseo_redirect_http').', SSL:'.(int)$isSSL.', WWW:'.(int)$isWWW.')', false);
            header($redirLoc);
            exit;
          }
        }
        
        // redirection manager
        if (!empty($_SERVER['HTTP_HOST'])) {
          $raw_url = 'http' . (!empty($_SERVER['HTTPS']) ? 's' : '') . '://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
          $raw_uri = $_SERVER['REQUEST_URI'];
          $url = urldecode($raw_url);
          $uri = urldecode($raw_uri);
          
          if ($this->config->get('mlseo_redirect_dynamic') && strpos(parse_url($uri, PHP_URL_QUERY), '_route_=') === 0) {
            $redir_url = $this->config->get('config_url') . str_replace('_route_=', '', parse_url($uri, PHP_URL_QUERY));
            header('HTTP/1.1 301 Moved Permanently');
            header('CSP-Redir: dynamic 1', false);
            header('Location: ' . str_replace('&amp;', '&', $redir_url));
          }
          
          if ($this->config->get('mlseo_redirect_dynamic') && isset($this->request->get['route']) && $this->request->get['route'] !== 'account/login' && !(!empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest')) {
            $redir_request = $_GET;
            $redir_route = $this->request->get['route'];
            unset($redir_request['route']);
            unset($redir_request['_route_']);
            
            if (!empty($_SERVER['HTTPS'])) {
              $redir_url = str_replace('&amp;', '&', $this->url->link($redir_route, http_build_query($redir_request, '', '&'), $_SERVER['HTTPS']));
            } else {
              $redir_url = str_replace('&amp;', '&', $this->url->link($redir_route, http_build_query($redir_request, '', '&')));
            }
            
            $redir_url = trim($redir_url);
            
            if (rtrim($redir_url, '/') != rtrim($url, '/') && !strpos($redir_url, 'route=')) {
              header('HTTP/1.1 301 Moved Permanently');
              header('CSP-Redir: dynamic 2', false);
              header('Location: ' . $redir_url); 
              exit;
            }
          }
          
          if ($this->config->get('mlseo_redirect')) {
            // regex require to be specifically defined to avoid unexpected match
            //$redirect = $this->db->query("SELECT redirect, language_id FROM " . DB_PREFIX . "url_redirect WHERE query = '" . $this->db->escape($raw_url) . "' OR query = '" . $this->db->escape($raw_uri) . "' OR ('".$this->db->escape($raw_url)."' REGEXP query) OR ('".$this->db->escape($raw_uri)."' REGEXP query) LIMIT 1")->row;
            //$redirect = $this->db->query("SELECT redirect, language_id FROM " . DB_PREFIX . "url_redirect WHERE query = '" . $this->db->escape($raw_url) . "' OR query = '" . $this->db->escape($raw_uri) . "' LIMIT 1")->row;
            //$redirect = $this->db->query("SELECT redirect, language_id FROM " . DB_PREFIX . "url_redirect WHERE query = '" . $this->db->escape(urldecode($raw_url)) . "' OR query = '" . $this->db->escape(urldecode($raw_uri)) . "' LIMIT 1")->row;
            
            $redirectQuery = $this->db->query("SELECT redirect, language_id FROM " . DB_PREFIX . "url_redirect WHERE 
              query = '" . $this->db->escape(urldecode($raw_url)) . "' OR query = '" . $this->db->escape(urldecode($raw_uri)) . "'
              OR (redirect LIKE 'product/product&product_id=%' AND query =  '" . $this->db->escape(urldecode(substr(strrchr($raw_uri, '/'), 0))) . "') LIMIT 1")->rows;
           
            if (count($redirectQuery) > 1) {
              foreach ($redirectQuery as $k => $redir) {
                if ($redir['language_id'] == $this->config->get('config_language_id')) {
                  $redirect = $redirectQuery[$k];
                }
              }
            } else if (!empty($redirectQuery[0]['redirect'])) {
              $redirect = $redirectQuery[0];
            }
            
            
            if (!empty($redirect['redirect'])) {
              $lang = $redirect['language_id'];
              $redirect = $redirect['redirect'];
              
              if ($lang) {
                $this->load->model('localisation/language');
                $languagesArray = $this->model_localisation_language->getLanguages();
                
                if(count($languagesArray) > 1) {
                  $languages = array();
                  foreach ($languagesArray as $result) { $languages[$result['language_id']] = $result; }
                  $this->config->set('config_language_id', $languages[$lang]['language_id']);
                  $this->config->set('config_language', $languages[$lang]['code']);
                  $this->session->data['language'] = $languages[$lang]['code'];
                }
              }
              
              if ((substr($redirect, 0, 1) != '/') && (substr($redirect, 0, 4) != 'http')) {
                if ($params = strstr($redirect, '&')) {
                  $route = str_replace(array($params, 'index.php?route='), '', $redirect);
                } else {
                  $route = str_replace('index.php?route=', '', $redirect);
                  $params = '';
                }
                
                $redirect = str_replace('&amp;', '&', $this->url->link($route, substr(str_replace('&amp;', '&', $params), 1)));
              }
              
              if ($redirect != $url) {
                header('HTTP/1.1 301 Moved Permanently');
                header('CSP-Redir: url', false);
                header('Location: ' . $redirect);
                exit;
              }
            }
          }
        }
      }
      ]]></add>
    </operation>
    
    <operation i="canonical redir">
      <search position="after" offset="2"><![CDATA[$this->request->get['route'] = 'information/information';]]></search>
      <add position="after" offset="20"><![CDATA[
        if (isset($this->request->get['route']) && $this->config->get('mlseo_redirect_canonical') && !in_array($this->request->get['route'], array('account/login', 'error/not_found', 'product/search', 'journal3/blog/post', 'journal3/blog')) && !isset($this->request->get['mfp']) && !isset($this->request->get['sort']) && !isset($this->request->get['limit']) && !empty($_SERVER['HTTP_HOST']) && !strpos($_SERVER['REQUEST_URI'], '/mfp/')) {
          $url = urldecode('http' . (!empty($_SERVER['HTTPS']) ? 's' : '') . '://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']);
          $uri = urldecode($_SERVER['REQUEST_URI']);
          
          $redir_request = $this->request->get; // no use of $_GET here
          $redir_route = $this->request->get['route'];
          unset($redir_request['route'], $redir_request['_route_']);
          
          if (!empty($_SERVER['HTTPS'])) {
            if ($this->request->get['route'] == 'product/category' && $this->config->get('mlseo_redirect_canonical') == '2' && !empty($redir_request['path'])) {
              $this->load->model('tool/path_manager');
              
              $cat_id = strstr($redir_request['path'], '_') ? substr(strrchr($redir_request['path'], '_'), 1) : $redir_request['path'];
              
              unset($redir_request['path']);
              $extra_params = '';
              if($redir_request) {
                $extra_params = '&'.http_build_query($redir_request, '', '&');
              }
              
              $redir_url = str_replace('&amp;', '&', $this->url->link('product/category', 'path=' . ($this->config->get('mlseo_fpp_cat_canonical') ? $this->model_tool_path_manager->getFullCategoryPath($cat_id) : $cat_id).$extra_params, $_SERVER['HTTPS']));
            } else {
              $redir_url = str_replace('&amp;', '&', $this->url->link($redir_route, http_build_query($redir_request, '', '&'), $_SERVER['HTTPS']));
            }
          } else {
            if ($this->request->get['route'] == 'product/category' && $this->config->get('mlseo_redirect_canonical') == '2' && !empty($redir_request['path'])) {
              $this->load->model('tool/path_manager');
              
              $cat_id = strstr($redir_request['path'], '_') ? substr(strrchr($redir_request['path'], '_'), 1) : $redir_request['path'];
              
              unset($redir_request['path']);
              $extra_params = '';
              if($redir_request) {
                $extra_params = '&'.http_build_query($redir_request, '', '&');
              }
              
              $redir_url = str_replace('&amp;', '&', $this->url->link('product/category', 'path=' . ($this->config->get('mlseo_fpp_cat_canonical') ? $this->model_tool_path_manager->getFullCategoryPath($cat_id).$extra_params : $cat_id)));
            } else {
              $redir_url = str_replace('&amp;', '&', $this->url->link($redir_route, http_build_query($redir_request, '', '&')));
            }
          }
          
          $redir_url = trim($redir_url);
          
          if (!strpos($redir_url, 'route=') && (($redir_url != str_replace('&amp;', '&', $url)) && (urldecode($redir_url) != str_replace('&amp;', '&', $url)) && (str_replace('&amp;', '&', urldecode($redir_url)) != str_replace('&amp;', '&', $url))) && !isset($redir_request['blogpath'])) {
            header('HTTP/1.1 301 Moved Permanently');
            header('CSP-Redir: canonical', false);
            header('Location: ' . $redir_url); 
            exit;
          }
        }
      ]]></add>
    </operation>
    
    <!--operation i="cache">
      <search position="after"><![CDATA[if (isset($data['route'])) {]]></search>
      <add position="after"><![CDATA[
      $url_cache = NULL;
      if ($this->config->get('mlseo_cache') && $this->config->get('mlseo_enabled') && $key != 'page' && is_string($value) && (($data['route'] == 'product/product' && $key == 'product_id') || (($data['route'] == 'product/manufacturer/info' || $data['route'] == 'product/product') && $key == 'manufacturer_id') || ($data['route'] == 'information/information' && $key == 'information_id')))
        $url_cache = Powercache::get('seo_rewrite.' . $this->config->get('config_language_id'), $this->db->escape($key . '=' . $value));
      if ($url_cache === NULL) {
        $old_url = $url;
      ]]></add>
    </operation-->

    <operation>
      <search position="replace"><![CDATA[if (isset($this->request->get['_route_'])) {]]></search>
      <add position="replace"><![CDATA[  /*if ($this->config->get('mlseo_flag') && !isset($this->request->get["_route_"]) && !isset($this->request->get["route"])) {
        if ($this->config->get('mlseo_default_lang') == substr($this->session->data['language'], 0, 2) || $this->config->get('mlseo_default_lang') == $this->session->data['language']) {
          if (version_compare(VERSION, '2', '>=')) return new Action('common/home');
          else return $this->forward('common/home');
        } else {
          if (version_compare(VERSION, '2', '>=')) $this->response->redirect($this->url->link('common/home'));
          else $this->redirect($this->url->link('common/home'));
        }
      }
      */
      
      if ($this->config->get('advanced_sitemap_rewrite')) {
        $uri = str_replace(array($this->config->get('config_url'), $this->config->get('config_ssl')), '', urldecode('http' . (!empty($_SERVER['HTTPS']) ? 's' : '') . '://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']));
        
        // remove language tag
        if (strpos($uri, '/sitemap')!==false) {
          $expl = explode('/', $uri);
          $lang = $expl[0];
          $uri = $expl[1];
        }
        
        $sitemapFolder = '';
        if ($uri == $sitemapFolder.'sitemap.xml') {
          $this->request->get['route'] = 'feed/advanced_sitemap';
          return new Action($this->request->get['route']);
        } else if (preg_match('/^'.$sitemapFolder.'sitemap(?:-(\w{3,}))?(?:-(\w{2}-\w{2}|[a-z]{2}))?(?:-(\d+))?\.xml$/i', $uri, $advStmpVars)) {
          if (preg_match('/^((\w{2}-\w{2})|\w{2})$/', $advStmpVars[1])) {
            $this->request->get['route'] = 'feed/advanced_sitemap';
            $this->request->get['lang'] = $advStmpVars[1];
          } else {
            $sitemapConf = $this->config->get('advanced_sitemap_cfg');
            if (!empty($sitemapConf['custom_links_include'])) {
              $sitemapTypes = array();
              foreach (explode("\n", $sitemapConf['custom_links_include']) as $k => $v) {
                if (strpos($v, '@')!==false) {
                  $type = trim(explode('@',$v,2)[0]);
                  if (!in_array($type, $sitemapTypes)) {
                    $sitemapTypes[] = $type;
                  }
                }
              }
            }
            if (isset($advStmpVars[1]) && isset($sitemapTypes) && in_array($advStmpVars[1], $sitemapTypes)) {
              $this->request->get['route'] = 'feed/advanced_sitemap/custom';
              $this->request->get['type'] = $advStmpVars[1];
            } else {
              $this->request->get['route'] = !empty($advStmpVars[1]) ? 'feed/advanced_sitemap/'.$advStmpVars[1] : 'feed/advanced_sitemap';
            }
            $this->request->get['lang'] = isset($advStmpVars[2]) ? $advStmpVars[2] : '';
          }
          
          $this->request->get['page'] = isset($advStmpVars[3]) ? $advStmpVars[3] : 1;
          
          return new Action($this->request->get['route']);
        } else if (preg_match('/^'.$sitemapFolder.'product-grid(?:-(\d+))?.xml$/', $uri, $advStmpVars)) {
          $this->request->get['route'] = 'feed/advanced_sitemap/product';
          $this->request->get['page'] = isset($advStmpVars[1]) ? $advStmpVars[1] : 1;
          $this->request->get['grid'] = 1;
          
          return new Action($this->request->get['route']);
        }
      }
      
      // Friendly urls
      if ($this->config->get('mlseo_friendly') && !empty($this->request->get['_route_'])) {
        if ($this->config->get('mlseo_extension')) {
          $route = rtrim(str_replace($this->config->get('mlseo_extension'), '', $this->request->get['_route_']), '/');
        } else {
          $route = rtrim($this->request->get['_route_'], '/');
        }
        
        $ml_mode = '';
        
        if ($this->config->get('mlseo_multistore')) {
          $ml_mode .= " AND (`store_id` = '" . (int)$this->config->get('config_store_id') . "' OR `store_id` = 0)";
        }
        
        if ($this->config->get('mlseo_ml_mode')) {
          $ml_mode .= " AND (`language_id` = '" . (int)$this->config->get('config_language_id') . "' OR `language_id` = 0)";
        }
        
        if ($this->config->get('mlseo_multistore') && $this->config->get('mlseo_ml_mode')) {
          $ml_mode .= "ORDER BY store_id DESC, language_id DESC";
        } else if ($this->config->get('mlseo_ml_mode')) {
          $ml_mode .= "ORDER BY language_id DESC";
        } else if ($this->config->get('mlseo_multistore')) {
          $ml_mode .= "ORDER BY store_id DESC";
        }
        
        $seoUrlTable = version_compare(VERSION, '3', '>=') ? 'seo_url' : 'url_alias';
        
        $friendly_qry = $this->db->query("SELECT * FROM " . DB_PREFIX . $seoUrlTable . " WHERE query LIKE 'route=%' AND keyword = '" . $this->db->escape($route) . "' " . $ml_mode);
        
        if (!empty($friendly_qry->row['query'])) {
          $this->request->get['route'] = str_replace('route=', '', $friendly_qry->row['query']);
          return new Action($this->request->get['route']);
        }
      }
      
      //if (isset($this->request->get['_route_'])) {
      
      if (!empty($this->request->get['_route_'])) {
        if ($this->config->get('mlseo_extension')) {
          $this->request->get['_route_'] = str_replace($this->config->get('mlseo_extension'), '', $this->request->get['_route_']);
        }]]></add>
    </operation>
    
    <operation>
      <search position="replace"><![CDATA[foreach ($parts as $part) {]]></search>
      <add position="replace"><![CDATA[
      // Friendly urls
      /*
      if ($this->config->get('mlseo_friendly') && !empty($parts[0])) {
        $ml_mode = '';
        
        if ($this->config->get('mlseo_multistore')) {
          $ml_mode .= " AND (`store_id` = '" . (int)$this->config->get('config_store_id') . "' OR `store_id` = 0)";
        }
        
        if ($this->config->get('mlseo_ml_mode')) {
          $ml_mode .= " AND (`language_id` = '" . (int)$this->config->get('config_language_id') . "' OR `language_id` = 0)";
        }
        
        if ($this->config->get('mlseo_multistore') && $this->config->get('mlseo_ml_mode')) {
          $ml_mode .= "ORDER BY store_id DESC, language_id DESC";
        } else if ($this->config->get('mlseo_ml_mode')) {
          $ml_mode .= "ORDER BY language_id DESC";
        } else if ($this->config->get('mlseo_multistore')) {
          $ml_mode .= "ORDER BY store_id DESC";
        }
        
        $seoUrlTable = version_compare(VERSION, '3', '>=') ? 'seo_url' : 'url_alias';
        /*
        $sk_query = $this->db->query("SELECT * FROM " . DB_PREFIX . $seoUrlTable . " WHERE query LIKE '%product/special%'")->row;
        $special_keyword = isset($sk_query['keyword']) ? $sk_query['keyword'] : '';
        
        if ($special_keyword && strpos($this->request->get['_route_'], $special_keyword) !== false) {
          $special_parts = explode('/', $this->request->get['_route_']);
          $this->request->get['_route_'] = $special_keyword;
          
          if (!empty($special_parts[1]) && strpos($special_parts[1], 'page-')!==false) {
            $this->request->get['page'] = str_replace('page-','',$special_parts[1]);
          }
        }
        *
        
        $friendly_qry = $this->db->query("SELECT * FROM " . DB_PREFIX . $seoUrlTable . " WHERE query LIKE 'route=%' AND keyword = '" . $this->db->escape($parts[0]) . "' " . $ml_mode);
        
        if (!empty($friendly_qry->row['query'])) {
          $this->request->get['route'] = str_replace('route=', '', $friendly_qry->row['query']);
          array_shift($parts);
          //return new Action($this->request->get['route']); // do not return to process other data
        }
      }
      */
      
      // Absolute url
      if ($this->config->get('mlseo_url_absolute')) {
        $fullUrl = (!empty($_SERVER['HTTPS']) ? 'https' : 'http').'://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];
        $fullUrl = str_replace(array($this->config->get('config_url'), $this->config->get('config_ssl')), '', $fullUrl);
        
        $searchWithWildcard = '';
        if (strpos($fullUrl, '?')) {
          $searchWithWildcard = " OR redirect = '" .  $this->db->escape(strstr($fullUrl, '?', true).'*') . "' ";
        }
        
        $urlAbsolute = $this->db->query("SELECT query, language_id FROM " . DB_PREFIX . "url_absolute WHERE redirect = '" . $this->db->escape($fullUrl) . "' " . $searchWithWildcard . " LIMIT 1")->row;
        
        if (!empty($urlAbsolute['query'])) {
           parse_str('route='.$urlAbsolute['query'], $this->request->get);
           $parts = array();
        }
      }
      
      if ($this->config->get('mlseo_tag') && !empty($parts[0]) && !empty($parts[1]) && $parts[0] === $this->config->get('mlseo_fpp_tag_'.$this->config->get('config_language_id'))) {
        $this->request->get['route'] = 'product/search';
        $this->request->get['tag'] = str_replace('-', ' ', $parts[1]);
        
        $parts = array();
      }
      
      if ($this->config->get('mlseo_search') && !empty($parts[0]) && $parts[0] === $this->config->get('mlseo_fpp_search_'.$this->config->get('config_language_id'))) {
        $this->request->get['route'] = 'product/search';
        
        if (!empty($parts[1])) {
          $this->request->get['search'] = str_replace('-', ' ', urldecode($parts[1]));
          unset($parts[1]);
        }
        
        unset($parts[0]);
      }
      
      $seoIsCategory = false;
      
      $seoSortNames = $this->config->get('mlseo_sortname_'.$this->config->get('config_language_id')) ? $this->config->get('mlseo_sortname_'.$this->config->get('config_language_id')) : 'name|price|rating|model';
      $seoSortOrders = $this->config->get('mlseo_order_'.$this->config->get('config_language_id')) ? $this->config->get('mlseo_order_'.$this->config->get('config_language_id')) : 'asc|desc';
      $seoSortKeyword = $this->config->get('mlseo_sort_'.$this->config->get('config_language_id')) ? $this->config->get('mlseo_sort_'.$this->config->get('config_language_id')) : 'sort';
      
      $partsIteration = 0;
      
      foreach ($parts as $part) {
        $partsIteration++;
        
        if ($this->config->get('mlseo_enabled') && $this->config->get('mlseo_sort') && preg_match('~^'.$seoSortKeyword.'-('.$seoSortNames.')-('.$seoSortOrders.')$~', $part, $sortParts)) {
          $sortNames = explode('|', $seoSortNames);
          $sortOrders = explode('|', $seoSortOrders);
          
          if (count($sortNames) == 4) {
            if (isset($this->request->get['route']) && $this->request->get['route'] == 'product/special') {
              $sortKey = array_search($sortParts[1], array_combine(array('pd.name', 'ps.price', 'rating', 'p.model'), $sortNames));
            } else {
              $sortKey = array_search($sortParts[1], array_combine(array('pd.name', 'p.price', 'rating', 'p.model'), $sortNames));
            }
          }
          
          if (count($sortOrders) == 2) {
            $sortOrder = array_search($sortParts[2], array_combine(array('ASC', 'DESC'), $sortOrders));
          }
          
          if (isset($sortKey) && in_array($sortKey, array('pd.name', 'ps.price', 'p.price', 'rating', 'p.model'))) {
            $this->request->get['sort'] = $sortKey;
            $this->request->get['order'] = $sortOrder;
          
            continue;
          }
        }
        
        if ($this->config->get('mlseo_enabled') && $this->config->get('mlseo_sort') && preg_match('~^'.($this->config->get('mlseo_limit_'.$this->config->get('config_language_id')) ? $this->config->get('mlseo_limit_'.$this->config->get('config_language_id')) : 'limit').'-(\d{1,3})$~', $part, $sortParts)) {
          $this->request->get['limit'] = $sortParts[1];
          continue;
        }
        
        //if ($this->config->get('mlseo_enabled') && $this->config->get('mlseo_pagination') && (!empty($this->request->get['path']) || !empty($this->request->get['search']) || !empty($this->request->get['manufacturer_id']) || (isset($this->request->get['route']) && $this->request->get['route'] == 'product/special')) && preg_match('/page-(\d+)/', $part, $page)) {
        if ($this->config->get('mlseo_enabled') && $this->config->get('mlseo_pagination') && preg_match('/^page-(\d+)$/', $part, $page)) {
          $this->request->get['page'] = $page[1];
          continue;
        }
        
        if (!$this->config->get('mlseo_multistore') && $this->config->get('config_store_id')) {
          $currentSubStore = $this->config->get('config_store_id');
          $this->config->set('config_store_id', 0);
        }
      ]]></add>
    </operation>
    
    <operation>
      <search position="before"><![CDATA[if ($query->num_rows) {]]></search>
      <add position="before"><![CDATA[
        if (!empty($currentSubStore)) {
          $this->config->set('config_store_id', $currentSubStore);
        }
        
                if ($this->config->get('mlseo_store_mode') && $this->config->get('mlseo_disable_other_store_links') && $this->request->get['route'] != 'journal3/blog') {
          // generate 404 if store mode prefix and not current language
          if ($partsIteration == count($parts)) {
            $hasValidLanguage = false;
            foreach ($query->rows as $checkStoreLang) {
              if (!isset($checkStoreLang['language_id']) || $checkStoreLang['language_id'] == $this->config->get('config_language_id')) {
                $hasValidLanguage = true;
                break;
              }
            }
            
            if (!$hasValidLanguage) {
              $this->request->get['route'] = '';
              continue;
            }
          }
        }
      ]]></add>
    </operation>
    
    <operation>
      <search position="after"><![CDATA[public function rewrite($link) {]]></search>
      <add position="after"><![CDATA[
        if (!empty($this->session->data['language']) && !($this->session->data['language'] == $this->config->get('config_language') || $this->session->data['language'] == substr($this->config->get('config_language'), 0, 2))) {
          $this->load->model('localisation/language');
          $languagesById = $this->model_localisation_language->getLanguages();
          $languages = array();
          foreach ($languagesById as $result) {
            $languages[$result['code']] = $result;
            if (strpos($result['code'], '-')) {
              $languages[substr($result['code'], 0, 2)] = $result;
            }
          }
          $this->config->set('config_language_id', $languages[ $this->session->data['language'] ]['language_id']);
        }
        
        $lang = isset($this->session->data['language']) ? $this->session->data['language'] : $this->config->get('config_language');
        
        $ml_mode = $url_append = '';
        
        if ($this->config->get('mlseo_multistore')) {
          //$ml_mode .= " AND (`store_id` = '" . (int)$this->config->get('config_store_id') . "' OR `store_id` = 0)";
          $ml_mode .= " AND (`store_id` = '" . (int)$this->config->get('config_store_id') . "')";
        }
        
        if ($this->config->get('mlseo_ml_mode')) {
          $ml_mode .= " AND (`language_id` = '" . (int)$this->config->get('config_language_id') . "' OR `language_id` = 0)";
        }
        
        if ($this->config->get('mlseo_multistore') && $this->config->get('mlseo_ml_mode')) {
          $ml_mode .= "ORDER BY store_id DESC, language_id DESC";
        } else if ($this->config->get('mlseo_ml_mode')) {
          $ml_mode .= "ORDER BY language_id DESC";
        } else if ($this->config->get('mlseo_multistore')) {
          $ml_mode .= "ORDER BY store_id DESC";
        }
      ]]></add>
    </operation>
    
    <operation>
      <search position="after"><![CDATA[$categories = explode('_', $value);]]></search>
      <add position="after"><![CDATA[
          $last_cat = count($categories)-1;
          foreach ($categories as $cat_key => $cat_id) {
            if($cat_key != $last_cat && in_array($cat_id, (array) $this->config->get('mlseo_fpp_categories'))) {
              unset($categories[$cat_key]);
            }
          }
      ]]></add>
    </operation>
    
    <operation error="skip">
      <search position="replace"><![CDATA[$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "url_alias WHERE keyword = '" . $this->db->escape($part) . "'");]]></search>
      <add position="replace"><![CDATA[$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "url_alias WHERE keyword = '" . $this->db->escape($part) . "' OR keyword = '" . $this->db->escape($this->request->get['_route_']) . "'");
      
        if ($this->config->get('mlseo_enabled') && $this->config->get('mlseo_absolute') && $query->num_rows > 1) {
          $currUrlValues = array();
          
          foreach ($query->rows as $key => $row) {
            // delete duplicate language
            if (in_array($row['query'], $currUrlValues)) {
              unset($query->rows[$key]);
              continue;
            }
            
            // if absolute enabled and we are not in subcategory and something else than category is found, then show this entry (manufacturer), else remove non-categories entries
            $currUrlValues[] = $row['query'];
            
            if (!$seoIsCategory && strpos($row['query'], 'category_id=') !== 0) {
              $query->row = $row;
              $query->rows = array($row);
              break;
            } if ($seoIsCategory && strpos($row['query'], 'manufacturer_id=') === 0) {
              unset($query->rows[$key]);
            }
          }
          
          $query->row = reset($query->rows);
          $query->num_rows = count($query->rows);
        }
      ]]></add>
    </operation>
  
  </file><file path="catalog/controller/*/seo_url.php" error="skip">
  
    <operation>
      <search position="before"><![CDATA[if ($url[0] == 'product_id') {]]></search>
      <add position="before"><![CDATA[
          if ($url[0] == 'route') {
            $this->request->get['route'] = $url[1];
          }
          
          if (isset($url[1]) && !in_array($url[0], array('route', 'product_id', 'category_id', 'information_id', 'manufacturer_id', 'blog_article_id'))) {
            $this->request->get[$url[0]] = $url[1];
          }
      ]]></add>
    </operation>
    
    <operation>
      <search position="after"><![CDATA[if ($url[0] == 'category_id') {]]></search>
      <add position="after"><![CDATA[
            $seoIsCategory = true;
            
            if ($this->config->get('mlseo_enabled') && $this->config->get('mlseo_absolute') && $query->num_rows > 1) {
              $parent_id = 0;
              
              if (!empty($this->request->get['path'])) {
                $parent_id = str_replace('_', '', strrchr($this->request->get['path'], '_'));
                
                if(!$parent_id) {
                  $parent_id = $this->request->get['path'];
                }
              }
              
              if (version_compare(VERSION, '3', '>=')) {
                $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "seo_url u left join " . DB_PREFIX . "category c on c.category_id = REPLACE(u.query, 'category_id=', '') WHERE u.keyword = '" . $this->db->escape($part) . "' AND c.parent_id = '" . $this->db->escape($parent_id) . "'");
              } else {
                $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "url_alias u left join " . DB_PREFIX . "category c on c.category_id = REPLACE(u.query, 'category_id=', '') WHERE u.keyword = '" . $this->db->escape($part) . "' AND c.parent_id = '" . $this->db->escape($parent_id) . "'");
              }
              
              if(isset($query->row['query'])) {
                $url = explode('=', $query->row['query']);
              }
            }
      ]]></add>
    </operation>
    
    <operation>
      <!--search position="replace" index="0" regex="true"><![CDATA[~\$url \.??= '/' \. \$query->row\['keyword'\];~]]></search-->
      <search position="before" index="0"><![CDATA[$url .= '/' . $query->row['keyword'];]]></search>
      <!--add position="before" index="0"><![CDATA[if ($this->config->get('mlseo_enabled') && !(($data['route'] == 'product/manufacturer/info' || $data['route'] == 'product/product') && $key == 'manufacturer_id')) $url .= '/' . $query->row['keyword'] . $this->config->get('mlseo_extension'); else]]></add-->
      <add position="before" index="0"><![CDATA[        if ($this->config->get('mlseo_enabled') && !($data['route'] == 'product/product' && $key == 'manufacturer_id')) $url .= '/' . $query->row['keyword']; else]]></add>
    </operation>

    <operation error="skip">
      <search position="replace"><![CDATA[$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "url_alias WHERE `query` = '" . $this->db->escape($key . '=' . (int)$value) . "'");]]></search>
      <add position="replace"><![CDATA[
            $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "url_alias WHERE `query` = '" . $this->db->escape($key . '=' . (int)$value) . "'" . $ml_mode);
      ]]></add>
    </operation>
    
    <operation error="skip">
      <search position="replace"><![CDATA[$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "url_alias WHERE `query` = 'category_id=" . (int)$category . "'");]]></search>
      <add position="replace"><![CDATA[
              $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "url_alias WHERE `query` = 'category_id=" . (int)$category . "'" . $ml_mode);
      ]]></add>
    </operation>
    
  </file><file path="catalog/controller/*/seo_url.php" error="skip" v="3">
  
    <operation error="skip">
      <search position="replace"><![CDATA[$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "seo_url WHERE `query` = '" . $this->db->escape($key . '=' . (int)$value) . "' AND store_id = '" . (int)$this->config->get('config_store_id') . "' AND language_id = '" . (int)$this->config->get('config_language_id') . "'");]]></search>
      <add position="replace"><![CDATA[$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "seo_url WHERE `query` = '" . $this->db->escape($key . '=' . (int)$value) . "' AND (`store_id` = '" . (int)$this->config->get('config_store_id') . "') AND language_id = '" . (int)$this->config->get('config_language_id') . "'");]]></add>
    </operation>
    
  </file><file path="catalog/controller/*/seo_url.php" error="skip">
    <!-- operation error="skip" v="2.0"> Not useful anymore?
      <search position="before"><![CDATA[$query .= '&' . rawurlencode((string)$key) . '=' . rawurlencode((string)$value);]]></search>
      <add position="before"><![CDATA[        if ($key != 'site_language')]]></add>
    </operation-->
    
    <operation error="skip" v="2.0.1+ fix">
      <search position="replace"><![CDATA[if ($query->row['query'] &&]]></search>
      <add position="replace"><![CDATA[if (empty($this->request->get['route']) && $url[0] != 'route' && isset ($query->row['query']) && $query->row['query'] &&]]></add>
    </operation>
    
    <operation error="skip" v="1.5.5 - 2.x">
      <search position="before"><![CDATA[return $url_info['scheme']]]></search>
      <add position="before"><![CDATA[
        if (!empty($url_append)) {
          $url = $url . $url_append;
        }
        
        $url = rtrim($url, '/');
        
        if (substr($url, -4) != '.xml' && $url) {
          if (!(!empty($gkd_is_category) && $this->config->get('mlseo_extension_mode') == 'nocat')) {
            $url .= $this->config->get('mlseo_extension');
          }
        }
        
        if ($this->config->get('mlseo_enabled') && $this->config->get('mlseo_flag') && !($this->config->get('mlseo_flag_default') && ($this->config->get('mlseo_default_lang') == $lang)) && !isset($seoPkgNoFlag)) {
          $customSeoFlag = $this->config->get('mlseo_flag_custom');
          
          if (!empty($customSeoFlag[$lang])) {
            $lang = $customSeoFlag[$lang];
          } else if ($this->config->get('mlseo_flag_short')) {
            $lang = substr($lang, 0, 2);
          }
          
          $url = ($this->config->get('mlseo_flag_upper')) ? '/'.strtoupper($lang).$url : '/'.$lang.$url;
        }
        
        if (($this->config->get('mlseo_fpp_slash') == '1' && !empty($gkd_is_category)) || $this->config->get('mlseo_fpp_slash') == '2') {
          if ((!$this->config->get('mlseo_extension') || ($this->config->get('mlseo_extension') && !strpos($url, $this->config->get('mlseo_extension')))) && !(substr($url, -4) == '.xml')) {
            $url .= '/';
          }
        }
      ]]></add>
    </operation>
    
  </file><file path="catalog/controller/*/seo_url.php" error="skip">
  
    <operation error="skip">
      <search position="replace"><![CDATA[} elseif ($key == 'path') {]]></search>
      <add position="replace"><![CDATA[
          } elseif ($this->config->get('mlseo_enabled') && $this->config->get('mlseo_sort') && $data['route'] == 'product/product' && in_array($key, array('limit', 'sort', 'order'))) {
            unset($data[${'key'}]);
            continue;
          } elseif ($this->config->get('mlseo_enabled') && $key == 'route' && $value == 'common/home') {
            $url .= '/';
          } elseif ($this->config->get('mlseo_enabled') && $this->config->get('mlseo_tag') && $key == 'route' && $value == 'product/search' && !empty($data['tag']) && $this->config->get('mlseo_fpp_tag_'.$this->config->get('config_language_id'))) {
            if ($this->config->get('mlseo_ascii_'.$this->config->get('config_language_id'))) {
              include_once(DIR_SYSTEM . 'library/gkd_urlify.php');
              $data['tag'] = URLify::downcode($data['tag'], substr($this->config->get('config_language'), 0, 2));
            }
            
            $url = '/'.$this->config->get('mlseo_fpp_tag_'.$this->config->get('config_language_id')).'/'.str_replace(' ', '-', $data['tag']);
            unset($data['tag']);
          } elseif ($this->config->get('mlseo_enabled') && $this->config->get('mlseo_search') && $key == 'route' && $value == 'product/search' && $this->config->get('mlseo_fpp_search_'.$this->config->get('config_language_id'))) {
            $url = '/'.$this->config->get('mlseo_fpp_search_'.$this->config->get('config_language_id'));
            
            if (!empty($data['search'])) {
              $url .= '/'.$data['search'];
              unset($data['search']);
            }
          } elseif ($this->config->get('mlseo_enabled') && $this->config->get('mlseo_pagination') && $key == 'page' && $url && isset($data['route']) && ($data['route'] == 'product/category' || $data['route'] == 'product/search' || $data['route'] == 'product/manufacturer/info' || $data['route'] == 'journal2/blog' || ($data['route'] == 'product/special' && !empty($data['page'])))) {
            $url_append .= '/page-'.$value;
            unset($data['page']);
          } elseif ($this->config->get('mlseo_enabled') && $this->config->get('mlseo_sort') && $key == 'limit') {
            $url .= '/'.($this->config->get('mlseo_limit_'.$this->config->get('config_language_id')) ? $this->config->get('mlseo_limit_'.$this->config->get('config_language_id')) : 'limit').'-'.$value;
            unset($data['limit']);
          } elseif ($this->config->get('mlseo_enabled') && $this->config->get('mlseo_sort') && $key == 'sort') {
            if ($value != 'p.sort_order') {
              $seoSortNames = $this->config->get('mlseo_sortname_'.$this->config->get('config_language_id')) ? $this->config->get('mlseo_sortname_'.$this->config->get('config_language_id')) : 'name|price|rating|model';
              $seoSortOrders = $this->config->get('mlseo_order_'.$this->config->get('config_language_id')) ? $this->config->get('mlseo_order_'.$this->config->get('config_language_id')) : 'asc|desc';
              $seoSortKeyword = $this->config->get('mlseo_sort_'.$this->config->get('config_language_id')) ? $this->config->get('mlseo_sort_'.$this->config->get('config_language_id')) : 'sort';
      
              $sortNames = explode('|', $seoSortNames);
              $sortOrders = explode('|', $seoSortOrders);
              
              if (count($sortNames) == 4) {
                if (isset($data['route']) && $data['route'] == 'product/special') {
                  $sortKey = array_search($value, array_combine($sortNames, array('pd.name', 'ps.price', 'rating', 'p.model')));
                } else {
                  $sortKey = array_search($value, array_combine($sortNames, array('pd.name', 'p.price', 'rating', 'p.model')));
                }
              }
              
              if (isset($data['order']) && count($sortOrders) == 2) {
                $sortOrder = array_search($data['order'], array_combine($sortOrders, array('ASC', 'DESC')));
              }
                
              if (isset($sortKey)) {
                $url .= '/'.$seoSortKeyword.'-'.$sortKey;
                
                if (isset($data['order'])) {
                  $url .= '-'.$sortOrder;
                }
              }
            }
            
            unset($data['sort'], $data['order']);
          } elseif ($this->config->get('mlseo_enabled') && $this->config->get('mlseo_friendly')
              && $value != 'common/home' && is_string($value) && !in_array($key, array('path', 'product_id', 'category_id', 'manufacturer_id', 'information_id', 'journal_blog_post_id', 'journal_blog_category_id', 'blog_id'))
              && !in_array($data['route'], array('offers/salescombopge', 'customerpartner/profile', 'customerpartner/profile/collection', 'news/article', 'news/ncategory'))
            ) {
            if (isset($data['journal_blog_tag'])) { $is_journal3_blog = true; }
            
            if (version_compare(VERSION, '3', '>=')) {
              $query = $this->db->query("SELECT keyword FROM " . DB_PREFIX . "seo_url WHERE `query` = '" . $this->db->escape($key . '=' . $value) . "'" . $ml_mode);
            } else {
              $query = $this->db->query("SELECT keyword FROM " . DB_PREFIX . "url_alias WHERE `query` = '" . $this->db->escape($key . '=' . $value) . "'" . $ml_mode);
            }
            if (${'query'}->num_rows) {
              $url .= '/' . $query->row["keyword"];
              //$url .= $query->row['keyword'] ? $this->config->get('mlseo_extension') : '';
              if($key != 'route') unset($data[$key]);
            }
          } elseif ($key == 'path') {
      ]]></add>
    </operation>
    
    <operation error="skip" v="1.5">
      <search position="before"><![CDATA[$query .= '&' . $key . '=' . $value;]]></search>
      <add position="before"><![CDATA[        if ($key != 'site_language')]]></add>
    </operation>
    
    <operation error="skip" v="1.5.4">
      <search position="before"><![CDATA[return $url_data['scheme']]]></search>
      <add position="before"><![CDATA[
        if ($this->config->get('mlseo_enabled') && $this->config->get('mlseo_flag') && !($this->config->get('mlseo_flag_default') && ($this->config->get('mlseo_default_lang') == $lang))) {
          $url = ($this->config->get('mlseo_flag_upper')) ? '/'.strtoupper($lang).$url : '/'.$lang.$url;
        }
        
        $url = rtrim($url, '/');
        
        if ($this->config->get('mlseo_cat_slash') && !empty($gkd_is_category)) {
          $url .= '/';
        }
      ]]></add>
    </operation>
    
  </file><file path="catalog/controller/*/seo_url.php" error="skip" i="MFP">
    
    <operation error="skip">
      <search position="before"><![CDATA[$parts = MegaFilterCore::prepareSeoParts( $this, $parts );]]></search>
      <add position="before"><![CDATA[
          // Complete seo compat of seo pagination with MFP
          foreach ($parts as $mfpPartKey => $mfpPart) {
            if ($this->config->get('mlseo_enabled') && $this->config->get('mlseo_pagination') && preg_match('/page-(\d+)/', $mfpPart, $page)) {
              $this->request->get['page'] = $page[1];
              unset($parts[$mfpPartKey]);
            }
          }
      ]]></add>
    </operation>
    
  </file>
  
  <file path="catalog/model/design/banner.php">
  
    <operation i="ml banners">
      <search position="before"><![CDATA[return $query->rows;]]></search>
      <add position="before"><![CDATA[
        if ($this->config->get('mlseo_banners')) {
          foreach($query->rows as &$row) {
            if ($row['link'] && strstr($row['link'], 'http') === false) {
              $route = $row['link'];
              
              if ($params = strstr($row['link'], '&')) {
                $route = str_replace(array($params, 'index.php?route='), '', $row['link']);
              } else {
                $params = '';
              }
              
              $row['link'] = $this->url->link($route, str_replace('&amp;', '&', $params));
            }
          }
        }
       ]]></add>
    </operation>
    
  </file>
  
  <file path="admin/controller/common/menu.php" error="skip">
  
    <operation>
      <search position="after"><![CDATA[$this->load->language('common/menu');]]></search>
      <add position="after"><![CDATA[
      $this->load->model('extension/extension');
      if (in_array('complete_seo', $this->model_extension_extension->getInstalled('module'))) {
        $data['text_complete_seo'] = 'Complete SEO';
        $data['link_complete_seo'] = $this->url->link('module/complete_seo', (isset($this->session->data['user_token']) ? 'user_token='.$this->session->data['user_token'] : 'token='.$this->session->data['token']), 'SSL');
      } else {
        $data['text_complete_seo'] = 'Install Complete SEO';
        $data['link_complete_seo'] = $this->url->link('extension/module/install', 'extension=complete_seo&token=' . (isset($this->session->data['user_token']) ? $this->session->data['user_token'] : $this->session->data['token']), 'SSL');
      }
      ]]></add>
    </operation>
    
  </file>
  
  <file path="admin/controller/common/column_left.php" error="skip" v="3">
  
    <operation error="skip">
      <search position="before"><![CDATA[if ($this->user->hasPermission('access', 'marketplace/event')) {]]></search>
      <add position="before"><![CDATA[
      $this->load->model('setting/extension');
      if ($this->user->hasPermission('access', 'module/complete_seo') && in_array('complete_seo', $this->model_setting_extension->getInstalled('module'))) {
        if ($this->config->get('mlseo_shortcut') == 'top') {
          $data['menus'][] = array(
            'id'       => 'menu-dashboard',
            'icon'	   => 'fa-bar-chart',
            'name'	   => 'Complete SEO',
            'href'     => $this->url->link('module/complete_seo', 'user_token=' . $this->session->data['user_token'], true),
            'children' => array()
          );
        } else if (!$this->config->get('mlseo_shortcut')) {
          $marketplace[] = array(
            'name'     => '<img style="vertical-align:top" src="view/seo_package/img/icon.png"/> Complete SEO',
            'href'     => $this->url->link('module/complete_seo', 'user_token=' . $this->session->data['user_token'], true),
            'children' => array()    
          );
        }
      }
      ]]></add>
    </operation>
    
  </file><file path="admin/controller/common/column_left.php" error="skip" v="2.3">
  
    <operation error="skip">
      <search position="before"><![CDATA[if ($this->user->hasPermission('access', 'extension/event')) {]]></search>
      <add position="before"><![CDATA[
      $this->load->model('extension/extension');
      
      if ($this->user->hasPermission('access', 'module/complete_seo')) {
        if ($this->config->get('mlseo_shortcut') == 'top') {
          $data['menus'][] = array(
            'id'       => 'menu-dashboard',
            'icon'	   => 'fa-bar-chart',
            'name'	   => 'Complete SEO',
            'href'     => $this->url->link('module/complete_seo', 'token=' . $this->session->data['token'], true),
            'children' => array()
          );
        } else if (!$this->config->get('mlseo_shortcut')) {
          if (!in_array('complete_seo', $this->model_extension_extension->getInstalled('module'))) {
            $extension[] = array(
              'name'     => '<img style="vertical-align:top" src="view/seo_package/img/icon.png"/> Install Complete SEO',
              'href'     => $this->url->link('extension/extension/module/install', 'extension=complete_seo&redir=1&token=' . (isset($this->session->data['user_token']) ? $this->session->data['user_token'] : (isset($this->session->data['user_token']) ? $this->session->data['user_token'] : $this->session->data['token'])), true),
              'children' => array()    
            );
          } else if ($this->user->hasPermission('access', 'module/complete_seo')) {
            $extension[] = array(
              'name'     => '<img style="vertical-align:top" src="view/seo_package/img/icon.png"/> Complete SEO',
              'href'     => $this->url->link('module/complete_seo', (isset($this->session->data['user_token']) ? 'user_token='.$this->session->data['user_token'] : 'token='.$this->session->data['token']), true),
              'children' => array()    
            );
          }
        }
      }
      ]]></add>
    </operation>
    
  </file>
  
  <file path="admin/view/template/common/menu.tpl" error="skip" v="2.1 - 2.2">
  
    <operation>
      <search position="after"><![CDATA[<li><a href="<?php echo $feed; ?>"><?php echo $text_feed; ?></a></li>]]></search>
      <add position="after"><![CDATA[
      <li><a href="<?php echo $link_complete_seo; ?>"><img style="vertical-align:top" src="view/seo_package/img/icon.png"/> <?php echo $text_complete_seo; ?></a></li>
      ]]></add>
    </operation>
    
  </file>
  
  <file path="admin/view/template/common/header.tpl" error="skip" v="1.5">
  
    <operation error="skip">
      <search position="after"><![CDATA[<li><a href="<?php echo $feed; ?>">]]></search>
      <add position="after"><![CDATA[
      <?php $this->load->model('setting/extension'); if (in_array('complete_seo', $this->model_setting_extension->getInstalled('module'))){ ?>
      <li><a href="<?php echo $this->url->link('module/complete_seo', (isset($this->session->data['user_token']) ? 'user_token='.$this->session->data['user_token'] : 'token='.$this->session->data['token']), 'SSL'); ?>"><img style="vertical-align:top" src="view/seo_package/img/icon.png"/> Complete SEO</a></li>
      <?php }else{ ?>
      <li><a href="<?php echo $this->url->link('extension/module/install', 'extension=complete_seo&token=' . (isset($this->session->data['user_token']) ? $this->session->data['user_token'] : $this->session->data['token']), 'SSL'); ?>"><img style="vertical-align:top" src="../seo_package/img/icon.png"/> Install Complete SEO</a></li>
      <?php } ?>
      ]]></add>
    </operation>
    
  </file>
  
  <file path="catalog/controller/common/home.php">
  
    <operation>
      <search position="after" offset="1"><![CDATA[$this->document->setDescription]]></search>
      <add position="after" offset="1"><![CDATA[
  // seo meta (overwrites the previously defined)
  if ($this->config->get('mlseo_enabled')) {
    $seo_meta = $this->config->get('mlseo_store');
    
    /*
    if (!empty($seo_meta[$this->config->get('config_store_id')]['analytics'])) {
      $ggAnalyticsCode = html_entity_decode($seo_meta[$this->config->get('config_store_id')]['analytics'], ENT_QUOTES, 'UTF-8');
      if (strpos($ggAnalyticsCode, 'google-site-verification')) {
        $this->document->addSeoMeta($ggAnalyticsCode."\n");
      } else if (strpos($ggAnalyticsCode, 'script')) {
        $this->document->addSeoMeta($ggAnalyticsCode."\n");
      } else {
        $this->document->addSeoMeta('<meta name="google-site-verification" content="'.$ggAnalyticsCode.'">'."\n");
      }
    }
    */
    
    if (isset($seo_meta[$this->config->get('config_store_id').$this->config->get('config_language_id')])) {
      $seo_meta = $seo_meta[$this->config->get('config_store_id').$this->config->get('config_language_id')];
    }
    
    if (!empty($seo_meta['seo_title'])) {
      ${'this'}->document->setTitle($seo_meta['seo_title']);
    } else if ($this->config->get('config_meta_title')) {
      ${'this'}->document->setTitle($this->config->get('config_meta_title'));
    } else {
      ${'this'}->document->setTitle($this->config->get('config_title'));
    }
    
    if (!empty($seo_meta['description'])) {
      ${'this'}->document->setDescription($seo_meta['description']);
    } else {
      ${'this'}->document->setDescription($this->config->get('config_meta_description'));
    }
    
    if (!empty($seo_meta['keywords'])) {
      ${'this'}->document->setKeywords($seo_meta['keywords']);
    }
    
    if (version_compare(VERSION, '2', '>=')) {
      if (!empty($seo_meta['title'])) {
        $data['heading_title'] = $data['seo_h1'] = $seo_meta['title'];
      } else if ($this->config->get('config_meta_title')) {
        $data['heading_title'] = $data['seo_h1'] = $this->config->get('config_meta_title');
      } else {
        $data['heading_title'] = $data['seo_h1'] = $this->config->get('config_title');
      }
      $data['heading_title'] = $data['seo_h1'] = !empty($seo_meta['title']) ? $seo_meta['title'] : $this->config->get('config_title');
      $data['seo_h2'] = !empty($seo_meta['h2']) ? $seo_meta['h2'] : '';
      $data['seo_h3'] = !empty($seo_meta['h3']) ? $seo_meta['h3'] : '';
    } else {
      $this->data['heading_title'] = $this->data['seo_h1'] = !empty($seo_meta['title']) ? $seo_meta['title'] : $this->config->get('config_title');
      $this->data['seo_h2'] = !empty($seo_meta['h2']) ? $seo_meta['h2'] : '';
      $this->data['seo_h3'] = !empty($seo_meta['h3']) ? $seo_meta['h3'] : '';
    }
  }
  /* now defined in header ctrl
  $this->load->model('tool/seo_package');
  
  if ($this->config->get('mlseo_opengraph')) {
    if (version_compare(VERSION, '2', '>=')) {
      $this->document->addSeoMeta($this->model_tool_seo_package->rich_snippet('opengraph', 'home'));
    } else {
      $this->document->addSeoMeta($this->model_tool_seo_package->rich_snippet('opengraph', 'home'));
    }
  }
  
  if ($this->config->get('mlseo_tcard')) {
    if (version_compare(VERSION, '2', '>=')) {
      $this->document->addSeoMeta($this->model_tool_seo_package->rich_snippet('tcard', 'home'));
    } else {
      $this->document->addSeoMeta($this->model_tool_seo_package->rich_snippet('tcard', 'home'));
    }
  }
  
  if ($this->config->get('mlseo_gpublisher')) {
    if (version_compare(VERSION, '2', '>=')) {
      $this->document->addSeoMeta($this->model_tool_seo_package->rich_snippet('gpublisher', 'home'));
    } else {
      $this->document->addSeoMeta($this->model_tool_seo_package->rich_snippet('gpublisher', 'home'));
    }
  }
  */
  // end - seo meta
      ]]></add>
    </operation>
    
  </file>
  
  <file path="catalog/view/theme/*/template/common/header.tpl" error="skip">
  
    <operation i="seo metas">
      <search position="before"><![CDATA[<?php foreach ($links as $link) { ?>]]></search>
      <add position="before"><![CDATA[
<?php if (!empty($mlseo_meta)) { echo $mlseo_meta; } ?>
      ]]></add>
    </operation>
    
    <operation error="skip" i="opengraph">
      <search position="replace"><![CDATA[<head>]]></search>
      <add position="replace"><![CDATA[<head prefix="og:http://ogp.me/ns# fb:http://ogp.me/ns/fb# product:http://ogp.me/ns/product#">]]></add>
    </operation>
    
    <operation error="skip" i="search fix" v="1.5">
      <search position="before"><![CDATA[<?php foreach ($scripts as $script) { ?>]]></search>
      <add position="before"><![CDATA[<?php if (!empty($mlseo_fix_search)) { ?><script type="text/javascript">$(document).ready(function() { $('#header input[name=\'search\']').unbind('keydown'); $('.button-search').unbind('click'); $('#header input[name=\'search\']').on('keydown', function(e){ if (e.keyCode == 13) {$('.button-search').click();}}); $('.button-search').on('click', function() { var url = '<?php echo isset($csp_search_url) ? $csp_search_url : "$('base').attr('href') + 'index.php?route=product/search"; ?>'; var value = $('input[name=\'search\']').attr('value'); if (value) {if (url.indexOf('?') > -1) {url += '&search=' + encodeURIComponent(value);} else {url += '?search=' + encodeURIComponent(value);}} location = url; });});</script><?php } ?>]]></add>
    </operation>
    
  </file>
  
  <file path="catalog/view/theme/*/template/common/header.twig" error="skip">
  
    <operation i="seo metas">
      <search position="before"><![CDATA[{% for link in links %}]]></search>
      <add position="before"><![CDATA[
        {{mlseo_meta}}
      ]]></add>
    </operation>
    
    <operation error="skip" i="opengraph">
      <search position="replace"><![CDATA[<head>]]></search>
      <add position="replace"><![CDATA[<head prefix="og:http://ogp.me/ns# fb:http://ogp.me/ns/fb# product:http://ogp.me/ns/product#">]]></add>
    </operation>
    
  </file>
  
  <file path="catalog/view/theme/journal3/template/common/header.twig" error="skip">
  
    <operation i="seo metas">
      <search position="replace"><![CDATA[{{mlseo_meta}}]]></search>
      <add position="replace"><![CDATA[]]></add>
    </operation>
    
    <operation i="seo metas">
      <search position="before"><![CDATA[</head>]]></search>
      <add position="before"><![CDATA[
        {{mlseo_meta}}
      ]]></add>
    </operation>
    
  </file>
  
  <file path="catalog/view/theme/*/template/common/parts/head.tpl" error="skip">
  
    <operation error="skip" i="seo metas on custom themes">
      <search position="before"><![CDATA[<?php foreach ($links as $link) { ?>]]></search>
      <add position="before"><![CDATA[
<?php if (!empty($mlseo_meta)) { echo $mlseo_meta; } ?>
      ]]></add>
    </operation>
    
  </file>
  
  <file path="catalog/controller/error/not_found.php">
  
    <operation>
      <search position="after"><![CDATA[public function index() {]]></search>
      <add position="after"><![CDATA[
  if ($this->config->get('mlseo_404') && $this->config->get('mlseo_404_log')) {
    $logUrl = true;
    
    if ($this->config->get('mlseo_404_filter')) {
      foreach (explode('|', $this->config->get('mlseo_404_filter')) as $part) {
        if (!$part) continue;
        if (strpos($_SERVER['REQUEST_URI'], $part) !== false) {
          $logUrl = false;
        }
      }
    }
    
    if ($this->config->get('mlseo_404_filter_ext')) {
      if (pathinfo($_SERVER['REQUEST_URI'], PATHINFO_EXTENSION)) {
        if (in_array(pathinfo($_SERVER['REQUEST_URI'], PATHINFO_EXTENSION), explode('|', $this->config->get('mlseo_404_filter_ext')))) {
          $logUrl = false;
        }
      }
    }
    
    if ($logUrl) {
     $this->load->model('tool/seo_package');
     $this->model_tool_seo_package->addUrl404(urldecode('http' . (!empty($_SERVER['HTTPS']) ? 's' : '') . '://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']));
    }
  }
  
  if ($this->config->get('mlseo_404') && $this->config->get('mlseo_404_redir')) {
    $seoSortNames = $this->config->get('mlseo_sortname_'.$this->config->get('config_language_id')) ? $this->config->get('mlseo_sortname_'.$this->config->get('config_language_id')) : 'name|price|rating|model';
    $seoSortOrders = $this->config->get('mlseo_order_'.$this->config->get('config_language_id')) ? $this->config->get('mlseo_order_'.$this->config->get('config_language_id')) : 'asc|desc';
    $seoSortKeyword = $this->config->get('mlseo_sort_'.$this->config->get('config_language_id')) ? $this->config->get('mlseo_sort_'.$this->config->get('config_language_id')) : 'sort';
    
    $parts = explode('/', $_SERVER['REQUEST_URI']);
    
    foreach ($parts as $key => $part) {
      if (preg_match('~^'.$seoSortKeyword.'-('.$seoSortNames.')-('.$seoSortOrders.')$~', $part)) {
        unset($parts[$key]);
      } else if (preg_match('~^'.($this->config->get('mlseo_limit_'.$this->config->get('config_language_id')) ? $this->config->get('mlseo_limit_'.$this->config->get('config_language_id')) : 'limit').'-(\d{1,3})$~', $part)) {
        unset($parts[$key]);
      } else if (preg_match('/page-(\d+)/', $part, $page)) {
        unset($parts[$key]);
      }
    }
    
    if (end($parts)) {
      $last_part = trim(str_replace(array('-', '_', $this->config->get('mlseo_extension')), ' ', end($parts)));
      if (strpos($last_part, '?')) {
        $last_part = strstr($last_part, '?', true);
      }
      
      if ($this->config->get('mlseo_404_redir') == 'first_word') {
        $words = explode(' ', $last_part);
        $search_404 = reset($words);
      } else if ($this->config->get('mlseo_404_redir') == 'last_word') {
        $words = explode(' ', $last_part);
        $search_404 = end($words);
      } else {
        $search_404 = $last_part;
      }
      
      if (substr($search_404, -5) == '.html') {
        $search_404 = substr($search_404, 0, -5);
      } else if (substr($search_404, -4) == '.php') {
        $search_404 = substr($search_404, 0, -4);
      }
      
      if (false) {
        // redirection mode without 404
        $redir = $this->url->link('product/search', 'search='.urlencode($search_404).'&description=1');
        $this->response->redirect($redir);
      } else {
        // search page with 404 code
        $this->request->get['search'] = urldecode($search_404);
        $this->request->get['description'] = 1;
        $this->response->addHeader($this->request->server['SERVER_PROTOCOL'] . ' 404 Not Found');
        return new Action('product/search');
      }
    }
  }
      ]]></add>
    </operation>
    
  </file>
  
  <file path="system/library/pagination.php">
  
    <operation error="skip" v="2.2" i="smart pagination">
      <search position="replace"><![CDATA[str_replace('&amp;page={page}']]></search>
      <add position="replace"><![CDATA[str_replace(array('&amp;page={page}', '?page={page}', '&page={page}', '/page-{page}')]]></add>
    </operation>
    
  </file><file path="system/library/pagination.php">
  
    <operation error="skip" v="2.3" i="smart pagination">
      <search position="replace"><![CDATA[array('&amp;page={page}', '&page={page}')]]></search>
      <add position="replace"><![CDATA[array('&amp;page={page}', '?page={page}', '&page={page}', '/page-{page}')]]></add>
    </operation>
    
  </file><file path="system/library/pagination.php">
  
    <operation error="skip" v="3" i="smart pagination">
      <search position="replace"><![CDATA[array('&amp;page={page}', '?page={page}', '&page={page}')]]></search>
      <add position="replace"><![CDATA[array('&amp;page={page}', '?page={page}', '&page={page}', '/page-{page}')]]></add>
    </operation>
    
  </file><file path="system/library/pagination.php">
  
    <operation error="skip" v="ocstore 2.1" i="smart pagination">
      <search position="replace"><![CDATA[str_replace('page={page}',]]></search>
      <add position="replace"><![CDATA[str_replace(array('/page-{page}','page={page}'),]]></add>
    </operation>
    
  </file>
  
  <file path="system/engine/controller.php">
  
    <operation error="skip" v="1.5" i="canonical urls">
      <search position="after"><![CDATA[protected function render() {]]></search>
      <add position="after"><![CDATA[
    /*if (!in_array(strstr($this->template, '/'), array('/template/account/login.tpl', '/template/common/column_left.tpl', '/template/common/column_right.tpl', '/template/common/content_top.tpl', '/template/common/content_bottom.tpl',
                                      '/template/common/footer.tpl', '/template/common/header.tpl', '/template/module/language.tpl', '/template/module/currency.tpl', '/template/module/cart.tpl'))) {*/
      if (in_array(strstr($this->template, '/'), array('/template/product/category.tpl', '/template/product/product.tpl', '/template/information/information.tpl', '/template/information/contact.tpl', '/template/information/sitemap.tpl'))) {
      $doc = $this->registry->get('document');
      if ($doc) {
        if (!isset($this->request->get['route'])) {
           $route = 'common/home';
        } else {
          $data = $this->request->get;
          unset($data['_route_']);
          $route = $data['route'];
          foreach($data as $param => $value) {
            if (!in_array($param, array('path', 'product_id', 'category_id', 'manufacturer_id', 'information_id','page')))
            unset($data[$param]);
          }
          $url = '';
          if ($data) {
            $route .= '&' . urldecode(http_build_query($data, '', '&'));
          }  
        }
        $doc->addLink($this->url->link($route), 'canonical');
      }
    }
      ]]></add>
    </operation>
    
  </file>
  
  <file path="catalog/controller/startup/seo_url.php" error="skip">
    <operation error="skip">
      <search position="after" index="0"><![CDATA[// Journal Theme Modification]]></search>
      <add position="after" index="0"><![CDATA[
                  if (!empty($currentSubStore)) {
                    $this->config->set('config_store_id', $currentSubStore);
                  }
        ]]></add>
    </operation>
    <operation error="skip">
      <search position="after" index="4"><![CDATA[// Journal Theme Modification]]></search>
      <add position="after" index="4"><![CDATA[
                  if (!empty($currentSubStore)) {
                    $this->config->set('config_store_id', $currentSubStore);
                  }
        ]]></add>
    </operation>
  </file>
  <file path="catalog/controller/startup/seo_url.php" error="skip" i="support for journal tag rewritting">
    <operation error="skip">
      <search position="replace"><![CDATA[} elseif (isset($data['route']) && $data['route'] == 'journal3/blog') {]]></search>
      <add position="replace"><![CDATA[} elseif (isset($data['route']) && $data['route'] == 'journal3/blog' && !isset($data['journal_blog_tag'])) {]]></add>
    </operation>
  </file>
  
  <!--file path="catalog/model/journal2/menu.php" error="skip" i="journal2" disabled="generate issues with common links">
  
    <operation error="skip">
      <search position="replace"><![CDATA[return $this->config->get('config_url');]]></search>
      <add position="replace"><![CDATA[
        // return $this->config->get('config_url'); // Complete SEO - Fix for using language tag
      ]]></add>
    </operation>
  
    <operation error="skip">
      <search position="replace"><![CDATA[$href = Journal2Utils::getProperty($link, 'menu_item.url');]]></search>
      <add position="replace"><![CDATA[
        // Complete SEO - Custom link
        if (strpos(Journal2Utils::getProperty($link, 'menu_item.url'), 'index.php?route=') !== false) {
          $href = $this->url->link(str_replace('index.php?route=', '', Journal2Utils::getProperty($link, 'menu_item.url')));
        } else {
          $href = Journal2Utils::getProperty($link, 'menu_item.url');
        }
      ]]></add>
    </operation>
    
  </file-->
  
  <file path="catalog/controller/journal3/admin_bar.php" error="skip" i="journal3">
  
    <operation error="skip">
      <search position="after"><![CDATA[$route = Arr::get($this->request->get, 'route');]]></search>
      <add position="after"><![CDATA[
        // Complete SEO Package - disable admin script for feeds (else it breaks the feed)
        if (Str::startsWith($route, 'feed/')) {
          return;
        }
      ]]></add>
    </operation>
    
  </file>
  
  <file path="catalog/view/theme/journal2/template/common/header.tpl" error="skip" i="journal2">
  
    <operation error="skip">
      <search position="replace"><![CDATA[<?php foreach ($this->journal2->settings->get('share_metas', array()) as $sm): ?>]]></search>
      <add position="replace"><![CDATA[<?php if (!empty($mlseo_meta)) { /*echo $mlseo_meta;*/ } 
else foreach ($this->journal2->settings->get('share_metas', array()) as $sm): ?>
      ]]></add>
    </operation>
    
  </file><file path="catalog/view/theme/journal3/template/common/header.tpl" error="skip" i="journal2">
  
    <operation error="skip">
      <search position="before"><![CDATA[<?php foreach ($links as $link): ?>]]></search>
      <add position="before"><![CDATA[<?php if (!empty($mlseo_meta)) { echo $mlseo_meta; } ?>]]></add>
    </operation>
    
  </file>
  
  <file path="catalog/controller/journal2/menu.php" error="skip" i="journal2">
  
    <operation error="skip">
      <search position="replace"><![CDATA[$href = Journal2Utils::getProperty($item, 'menu.menu_item.url');]]></search>
      <add position="replace"><![CDATA[
        // Complete SEO - Custom link
        if (strpos(Journal2Utils::getProperty($item, 'menu.menu_item.url'), 'index.php?route=') !== false) {
          $href = $this->url->link(str_replace('index.php?route=', '', Journal2Utils::getProperty($item, 'menu.menu_item.url')));
        } else {
          $href = Journal2Utils::getProperty($item, 'menu.menu_item.url');
        }
      ]]></add>
    </operation>
    
  </file>
  
  <file path="system/library/cart/cart.php" error="skip" v="2.3">
  
    <operation error="skip" i="multistore name">
      <search position="before"><![CDATA[$product_data[] = array(]]></search>
      <add position="before"><![CDATA[
      if ($this->config->get('mlseo_enabled') && $product_query->num_rows && $this->config->get('mlseo_multistore') && $this->config->get('config_store_id')) {
        $seoDescription = $this->db->query("SELECT * FROM " . DB_PREFIX . "seo_product_description d WHERE product_id = '" . (int)$product_query->row['product_id'] . "' AND store_id = '".(int) $this->config->get('config_store_id')."' AND language_id = '".(int) $this->config->get('config_language_id')."'")->row;
        
        if (!empty($seoDescription['name'])) {
          $product_query->row['name'] = $seoDescription['name'];
        }
      }
      ]]></add>
    </operation>
 
  </file>
  
  <file path="system/library/cart.php" error="skip" v="2">
  
    <operation error="skip" i="multistore name">
      <search position="before"><![CDATA[$this->data[$key] = array(]]></search>
      <add position="before"><![CDATA[
      if ($this->config->get('mlseo_enabled') && $product_query->num_rows && $this->config->get('mlseo_multistore') && $this->config->get('config_store_id')) {
        $seoDescription = $this->db->query("SELECT * FROM " . DB_PREFIX . "seo_product_description d WHERE product_id = '" . (int)$product_query->row['product_id'] . "' AND store_id = '".(int) $this->config->get('config_store_id')."' AND language_id = '".(int) $this->config->get('config_language_id')."'")->row;
        
        if (!empty($seoDescription['name'])) {
          $product_query->row['name'] = $seoDescription['name'];
        }
      }
      ]]></add>
    </operation>
 
  </file>
  
  <file path="system/library/document.php">
  
    <operation>
      <search position="before"><![CDATA[public function setTitle($title) {]]></search>
      <add position="before"><![CDATA[
        private $seo_meta = '';

        public function addSeoMeta($html) {
          $this->seo_meta .= $html;
        }
        
        public function renderSeoMeta() {
          return $this->seo_meta;
        }
      ]]></add>
    </operation>
    
    <operation error="skip" i="fix OC issue same link cannot be displayed">
      <search position="replace"><![CDATA[$this->links[$href] = array(]]></search>
      <add position="replace"><![CDATA[$this->links[$href.$rel] = array(]]></add>
    </operation>
    
  </file>
  
  <file path="admin/controller/extension/extension/module.php" error="skip">
  
    <operation error="skip">
      <search position="after"><![CDATA[$files = glob(DIR_APPLICATION . 'controller/extension/module/*.php');]]></search>
      <add position="after"><![CDATA[
    if (version_compare(VERSION, '3', '>=')) {
      $files[] = 'complete_seo';
    }
      ]]></add>
    </operation>
    
  </file><file path="admin/controller/extension/extension/module.php" i="fix 2.3 link" error="skip">
  
    <operation error="skip">
      <search position="before" index="0"><![CDATA[$data['extensions'][] = array(]]></search>
      <add position="before" index="0"><![CDATA[
        if ($extension == 'complete_seo') {
          ${'data'}['extensions'][] = array(
            'name'      => (version_compare(VERSION, '3', '>=') ? $this->language->get('extension')->get('heading_title') : $this->language->get('heading_title')),
            'status'    => $this->config->get('mlseo_enabled') ? $this->language->get('text_enabled') : $this->language->get('text_disabled'),
            'module'    => $module_data,
            'install'   => $this->url->link('extension/extension/module/install', (isset($this->session->data['user_token']) ? 'user_token='.$this->session->data['user_token'] : 'token='.$this->session->data['token']) . '&extension=' . $extension, true),
            'uninstall' => $this->url->link('extension/extension/module/uninstall', (isset($this->session->data['user_token']) ? 'user_token='.$this->session->data['user_token'] : 'token='.$this->session->data['token']) . '&extension=' . $extension, true),
            'installed' => in_array($extension, $extensions),
            'edit'      => $this->url->link('module/' . $extension, (isset($this->session->data['user_token']) ? 'user_token='.$this->session->data['user_token'] : 'token='.$this->session->data['token']), true)
          );
          
          continue;
        }
      ]]></add>
    </operation>
    
  </file>
  
  <file path="admin/controller/extension/extension/feed.php" error="skip">
  
    <operation error="skip">
      <search position="after"><![CDATA[$files = glob(DIR_APPLICATION . 'controller/extension/feed/*.php');]]></search>
      <add position="after"><![CDATA[
    if (version_compare(VERSION, '3', '>=')) {
      $files[] = 'advanced_sitemap';
    }
      ]]></add>
    </operation>
    
  </file><file path="admin/controller/extension/extension/feed.php" i="fix 2.3 link" error="skip">
  
    <operation error="skip">
      <search position="before" index="0"><![CDATA[$data['extensions'][] = array(]]></search>
      <add position="before" index="0"><![CDATA[
        if ($extension == 'advanced_sitemap') {
          ${'data'}['extensions'][] = array(
            'name'      => (version_compare(VERSION, '3', '>=') ? $this->language->get('extension')->get('heading_title') : $this->language->get('heading_title')),
            'status'    => $this->config->get($extension . '_status') ? $this->language->get('text_enabled') : $this->language->get('text_disabled'),
            'install'   => $this->url->link('extension/extension/feed/install', (isset($this->session->data['user_token']) ? 'user_token='.$this->session->data['user_token'] : 'token='.$this->session->data['token']) . '&extension=' . $extension, true),
            'uninstall' => $this->url->link('extension/extension/feed/uninstall', (isset($this->session->data['user_token']) ? 'user_token='.$this->session->data['user_token'] : 'token='.$this->session->data['token']) . '&extension=' . $extension, true),
            'installed' => in_array($extension, $extensions),
            'edit'      => $this->url->link('feed/' . $extension, (isset($this->session->data['user_token']) ? 'user_token='.$this->session->data['user_token'] : 'token='.$this->session->data['token']), true)
          );
          
          continue;
        }
      ]]></add>
    </operation>
    
  </file>
  
  <file path="catalog/model/journal2/blog.php" i="fix journal2 blog keyword" error="skip">
  
    <operation error="skip">
      <search position="replace"><![CDATA[if (self::$BLOG_KEYWORD === null) {]]></search>
      <add position="replace"><![CDATA[if (true) {]]></add>
    </operation>
    
    <operation error="skip">
      <search position="replace"><![CDATA[{$this->language_id}]]></search>
      <add position="replace"><![CDATA[{$this->config->get('config_language_id')}]]></add>
    </operation>
    
  </file><file path="catalog/model/journal3/blog.php" i="fix journal3 blog keyword" error="skip">
  
    <operation error="skip">
      <search position="replace"><![CDATA[if (self::$BLOG_KEYWORD === null) {]]></search>
      <add position="replace"><![CDATA[if (true) {]]></add>
    </operation>
    
  </file>
  
  <!-- Analytics -->
  <file path="catalog/controller/checkout/cart.php" error="skip" v="2 - 3">
  
    <operation error="skip">
      <search position="after"><![CDATA[$json['success'] = sprintf($this->language->get('text_success')]]></search>
      <add position="after"><![CDATA[
        // GKD - Enhanced eCommerce Tracking
        $seo_meta = $this->config->get('mlseo_store');
        
        if (!empty($seo_meta[$this->config->get('config_store_id')]['gg_enhanced']) && !empty($seo_meta[$this->config->get('config_store_id')]['analytics'])) {
          $json['success'] .= '<script type="text/javascript">gkdEctTrack(\'add\', '.$this->request->post['product_id'].', \'Add to Cart\')</script>';
        }
      ]]></add>
    </operation>
    
    <operation error="skip">
      <search position="after"><![CDATA[$this->session->data['success'] = $this->language->get('text_remove');]]></search>
      <add position="after"><![CDATA[
        // GKD - Enhanced eCommerce Tracking
        /*
        $seo_meta = $this->config->get('mlseo_store');
        
        if (!empty($seo_meta[$this->config->get('config_store_id')]['gg_enhanced']) && !empty($seo_meta[$this->config->get('config_store_id')]['analytics'])) {
          $json['success'] .= '<script type="text/javascript">gkdEctTrack(\'remove\', '.$this->request->post['product_id'].', \'Remove from Cart\')</script>';
        }
        */
      ]]></add>
    </operation>
    
  </file>
  
  <file path="catalog/controller/account/wishlist.php" error="skip" v="2 - 3">
  
    <operation error="skip">
      <search position="after"><![CDATA[$json['success'] = sprintf($this->language->get('text_success')]]></search>
      <add position="after"><![CDATA[
        // GKD - Enhanced eCommerce Tracking
        $seo_meta = $this->config->get('mlseo_store');
        
        if (!empty($seo_meta[$this->config->get('config_store_id')]['gg_enhanced']) && !empty($seo_meta[$this->config->get('config_store_id')]['analytics'])) {
          $json['success'] .= '<script type="text/javascript">gkdEctTrack(\'add\', '.$this->request->post['product_id'].', \'Add to Wishlist\')</script>';
        }
      ]]></add>
    </operation>
    
  </file>
  
  <file path="catalog/controller/product/compare.php" error="skip" v="2 - 3">
  
    <operation error="skip">
      <search position="after"><![CDATA[$json['success'] = sprintf($this->language->get('text_success')]]></search>
      <add position="after"><![CDATA[
        // GKD - Enhanced eCommerce Tracking
        $seo_meta = $this->config->get('mlseo_store');
        
        if (!empty($seo_meta[$this->config->get('config_store_id')]['gg_enhanced']) && !empty($seo_meta[$this->config->get('config_store_id')]['analytics'])) {
          $json['success'] .= '<script type="text/javascript">gkdEctTrack(\'add\', '.$this->request->post['product_id'].', \'Compare this Product\')</script>';
        }
      ]]></add>
    </operation>
    
  </file>
  
  <file path="catalog/controller/checkout/success.php" error="skip">
  
		<operation error="skip">
			<search position="after"><![CDATA[if (isset($this->session->data['order_id'])) {]]></search>
			<add position="after"><![CDATA[   $this->session->data['ggAnalytics_order_id'] = $this->session->data['order_id'];]]></add>
		</operation>
    
	</file>
  
</modification>