Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I am assuming you have a .htaccess file setup and you are already using the SEO built into OpenCart 1.5. If not, here are some pretty good instructions: <a href="http://kevindees.cc/2011/11/adding-seo-friendly-urls-to-opencart/" rel="nofollow">Adding SEO Friendly URL’S to OpenCart</a> by Kevin Dees</p> <p>This is a partial hack, but if all you want to fix is the pagination, it should work.</p> <p>First you need to add 3 lines to the .htaccess file I referenced earlier. After this line:</p> <pre><code>RewriteRule sitemap.xml /index.php?route=feed/google_sitemap </code></pre> <p>Add:</p> <pre><code>RewriteCond %{QUERY_STRING} q=([^&amp;]*) [OR] RewriteCond %{SCRIPT_FILENAME} .*search$ RewriteRule search$ /index.php?route=product/search&amp;filter_name=%1 [L,QSA] </code></pre> <p>So in all that section of the .htaccess file should look like:</p> <pre><code>RewriteBase / RewriteRule sitemap.xml /index.php?route=feed/google_sitemap RewriteCond %{QUERY_STRING} q=([^&amp;]*) [OR] RewriteCond %{SCRIPT_FILENAME} .*search$ RewriteRule search$ /index.php?route=product/search&amp;filter_name=%1 [L,QSA] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA] </code></pre> <p>Next you need to modify the <strong>/catalog/controller/product/search.php</strong> to generate the correct url. I commented out the line that generates the link and added my own 2 lines above it(you'll need replace <em>http://www.site.com</em> with your own info):</p> <pre><code>$pagination = new Pagination(); $pagination-&gt;total = $product_total; $pagination-&gt;page = $page; $pagination-&gt;limit = $limit; $pagination-&gt;text = $this-&gt;language-&gt;get('text_pagination'); $url = preg_replace("/filter_name/","q",$url); $pagination-&gt;url = "http://www.site.com/search?".$url."&amp;page={page}"; //$pagination-&gt;url = $this-&gt;url-&gt;link('product/search', $url . '&amp;page={page}'); $this-&gt;data['pagination'] = $pagination-&gt;render(); </code></pre> <p><strong>Resources:</strong><br> I found some of the basics of RewriteRules from: <a href="http://www.roscripts.com/Pretty_URLs_-_a_guide_to_URL_rewriting-168.html" rel="nofollow">RoScripts.com Pretty URLs - a guide to URL rewriting</a>.<br> Here's an example of how to pull from the query string from a blog comment by Nidaan <a href="http://vikrant_labde.blogspot.com/2008/07/querystring-in-htaccess-match-question.html?showComment=1302329313209#c3513759857163698994" rel="nofollow">here</a>.<br> And finally for everything else regarding apache's mod_rewrite visit: <a href="http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html" rel="nofollow">Apache Module mod_rewrite</a></p> <p>Good Luck! And God Bless!</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload