title: Opencart SEO URL for product filters
body: <p>I recently got a chance to work on Opencart and I got a custom-made theme (Pav foodstore).
  I am trying to implement auto-seo URLs in my project. For doing so, I downloaded a very good extension from Navneet Singh for auto-seo URLs. The problem is, it doesn't come with SEO URLs for product filters. Tried a few modifications, but I can't seem to get it working right.</p>
  
  <p>Following is the VQmod xml file code :</p>
  
  <pre><code>    &lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;modification&gt;
      &lt;id&gt;CUSTOM CHANGES DONE BY NAVNEET SINGH&lt;/id&gt;
      &lt;version&gt;1&lt;/version&gt;
      &lt;vqmver&gt;1.0.0&lt;/vqmver&gt;
      &lt;author&gt;NAVNEET SINGH&lt;/author&gt;
      &lt;!-- SEO URLS --&gt;
      &lt;file error="abort" name="system/library/response.php"&gt;
          &lt;operation&gt;
              &lt;search position="after"&gt;&lt;![CDATA[ 
                  public function output() {
              ]]&gt;&lt;/search&gt;
              &lt;add&gt;&lt;![CDATA[  
              if ($this-&gt;output) {
                  // REPLACE URLS WITH SEO URLS
                  function my_repl($value) {
                      if( defined(ENT_COMPAT) &amp;&amp; defined(ENT_HTML401) &amp;&amp;     defined(ENT_IGNORE) ) {
                          $val=str_replace(" ","-",strtolower(trim(strtr(html_entity_decode(strip_tags($value),ENT_COMPAT|ENT_HTML401|ENT_IGNORE,"UTF-8"),"`~!@#$%^&amp;*()-_=+\\|[{]};:'\",&lt;.&gt;/?","                                "))));
                      return rawurlencode($val); }
                  elseif( defined(ENT_COMPAT) &amp;&amp; defined(ENT_IGNORE) ) {
                  $val=str_replace(" ","-",strtolower(trim(strtr(html_entity_decode(strip_tags($value),ENT_COMPAT|ENT_IGNORE,"UTF-8"),"`~!@#$%^&amp;*()-_=+\\|[{]};:'\",&lt;.&gt;/?","                                "))));
                      return rawurlencode($val); }
                  else {
                  $val=str_replace(" ","-",strtolower(trim(strtr(html_entity_decode(strip_tags($value),ENT_COMPAT,"UTF-8"),"`~!@#$%^&amp;*()-_=+\\|[{]};:'\",&lt;.&gt;/?","                                "))));
                      return rawurlencode($val); }
              }
              function my_preg_replace($m1) {
                  if($m1[1]=='information/information') $p2 = 'i';
                  elseif($m1[1]=='product/category') $p2 = 'c';
                  elseif($m1[1]=='product/category' &amp;&amp; $m1[2]=='filter') $p2 = 'f';
                  elseif($m1[1]=='product/manufacturer/info') $p2 = 'm';
                  elseif($m1[1]=='product/product' &amp;&amp; $m1[2]=='product_id') $p2 = 'pp';
                  elseif($m1[1]=='product/product' &amp;&amp; $m1[2]=='manufacturer_id') $p2 = 'pm';
                  elseif($m1[1]=='product/product' &amp;&amp; $m1[2]=='path') $p2 = 'pc';
                  else return;
  
                  // IF IMG TAG, USE IMG ALT TEXT IN SEO URL; ELSE, USE ANCHOR TEXT IN SEO URL
                  if($p2=='i' || $p2=='c' || $p2=='m' || $p2=='pp') {
                      if( preg_match( '#&lt;img.*alt="([^"]*)"#iUs', $m1[4], $m2 ) )
                          $u1 = my_repl($m2[1]);
                      else
                          $u1 = my_repl($m1[4]);
                      return $p2 . trim($m1[3]) . "-" . $u1 . '"&gt;' . $m1[4] . "&lt;/a&gt;";
                  }
                  elseif($p2=='pc') {
                      if( preg_match( '#&lt;img.*alt="([^"]*)"#iUs', $m1[5], $m2 ) )
                          $u1 = my_repl($m2[1]);
                      else
                          $u1 = my_repl($m1[5]);
                      return $p2 . trim($m1[4]) . "-c" . trim($m1[3]) . "-" . $u1 . '"&gt;' . $m1[5] . "&lt;/a&gt;";
                  }
                  elseif($p2=='pm') {
                      if( preg_match( '#&lt;img.*alt="([^"]*)"#iUs', $m1[5], $m2 ) )
                          $u1 = my_repl($m2[1]);
                      else
                          $u1 = my_repl($m1[5]);
                      return $p2 . trim($m1[4]) . "-m" . trim($m1[3]) . "-" . $u1 . '"&gt;' . $m1[5] . "&lt;/a&gt;";
                  }
              }
              // PATTERNS TO SEARCH FOR SEO URL REPLACEMENT
              $p1s = array(
              "#index\.php\?route\=(product/category)&amp;amp;(path)=([0-9_]+?)\"&gt;(.*)&lt;/a&gt;#iUs",
              "#index\.php\?route\=(product/category)&amp;amp;(path)=([0-9_]+?)&amp;amp;filter=([0-9]+?)\"&gt;(.*)&lt;/a&gt;#iUs",
              "#index\.php\?route\=(product/manufacturer/info)&amp;amp;(manufacturer_id)=([0-9]+?)\"&gt;(.*)&lt;/a&gt;#iUs",
              "#index\.php\?route\=(information/information)&amp;amp;(information_id)=([0-9]+?)\"&gt;(.*)&lt;/a&gt;#iUs",
              "#index\.php\?route\=(product/product)&amp;amp;(product_id)=([0-9]+?)[^\"]*\"&gt;(.*)&lt;/a&gt;#iUs",
              "#index\.php\?route\=(product/product)&amp;amp;(path)=([0-9_]+?)&amp;amp;product_id=([0-9]+?)\"&gt;(.*)&lt;/a&gt;#iUs",
              "#index\.php\?route\=(product/product)&amp;amp;(manufacturer_id)=([0-9]+?)&amp;amp;product_id=([0-9]+?)\"&gt;(.*)&lt;/a&gt;#iUs",
              );
              $this-&gt;output = preg_replace_callback( $p1s, "my_preg_replace", $this-&gt;output );
          }
          ]]&gt;&lt;/add&gt;
      &lt;/operation&gt;
  &lt;/file&gt;
  </code></pre>
  
  <p></p>
  
  <p>And this is my .htaccess code block :</p>
  
  <pre><code>RewriteEngine On
  RewriteRule ^i([0-9]+)-(.*)$ index.php?route=information/information&amp;information_id=$1 [L]
  RewriteRule ^c([0-9_]+)-(.*)$ index.php?route=product/category&amp;path=$1 [L]
  RewriteRule ^c([0-9_]+)-f([0-9_]+)-(.*)$ index.php?route=product/category&amp;path=$2&amp;filter=$1 [L]
  RewriteRule ^m([0-9]+)-(.*)$ index.php?route=product/manufacturer/info&amp;manufacturer_id=$1 [L]
  RewriteRule ^pp([0-9]+)-(.*)$ index.php?route=product/product&amp;product_id=$1 [L]
  RewriteRule ^pm([0-9]+)-m([0-9]+)-(.*)$ index.php?route=product/product&amp;manufacturer_id=$2&amp;product_id=$1 [L]
  RewriteRule ^pc([0-9]+)-c([0-9_]+)-(.*)$ index.php?route=product/product&amp;path=$2&amp;product_id=$1 [L]
  </code></pre>
  
  <p>Any help would be appreciated.</p>