Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to create custom SEO-friendly URLs in OpenCart?
    primarykey
    data
    text
    <p>I would like <a href="http://example.com/index.php?route=checkout/cart" rel="nofollow">http://example.com/index.php?route=checkout/cart</a> to be displayed as <a href="http://example.com/cart" rel="nofollow">http://example.com/cart</a>. Few days ago I found an answer in stackoverflow (http://stackoverflow.com/q/7578055/1236271). And I made the necessary changes in the seo_url file and also updated the database but still it's not working for me. Is there any mistake with my seo_url file? This is my seo_url.php file.</p> <pre><code>&lt;?php class ControllerCommonSeoUrl extends Controller { public function index() { // Add rewrite to url class if ($this-&gt;config-&gt;get('config_seo_url')) { $this-&gt;url-&gt;addRewrite($this); } // Decode URL if (isset($this-&gt;request-&gt;get['_route_'])) { $parts = explode('/', $this-&gt;request-&gt;get['_route_']); foreach ($parts as $part) { $query = $this-&gt;db-&gt;query("SELECT * FROM " . DB_PREFIX . "url_alias WHERE keyword = '" . $this-&gt;db-&gt;escape($part) . "'"); if ($query-&gt;num_rows) { $url = explode('=', $query-&gt;row['query']); if ($url[0] == 'product_id') { $this-&gt;request-&gt;get['product_id'] = $url[1]; } if ($url[0] == 'category_id') { if (!isset($this-&gt;request-&gt;get['path'])) { $this-&gt;request-&gt;get['path'] = $url[1]; } else { $this-&gt;request-&gt;get['path'] .= '_' . $url[1]; } } if ($url[0] == 'manufacturer_id') { $this-&gt;request-&gt;get['manufacturer_id'] = $url[1]; } if ($url[0] == 'information_id') { $this-&gt;request-&gt;get['information_id'] = $url[1]; } } else { $this-&gt;request-&gt;get['route'] = 'error/not_found'; } } if (isset($this-&gt;request-&gt;get['product_id'])) { $this-&gt;request-&gt;get['route'] = 'product/product'; } elseif (isset($this-&gt;request-&gt;get['path'])) { $this-&gt;request-&gt;get['route'] = 'product/category'; } elseif (isset($this-&gt;request-&gt;get['manufacturer_id'])) { $this-&gt;request-&gt;get['route'] = 'product/manufacturer/product'; } elseif (isset($this-&gt;request-&gt;get['information_id'])) { $this-&gt;request-&gt;get['route'] = 'information/information'; } else { $query = $this-&gt;db-&gt;query("SELECT * FROM " . DB_PREFIX . "url_alias WHERE keyword = '" . $this-&gt;db-&gt;escape($this-&gt;request-&gt;get['_route_']) . "'"); if ($query-&gt;num_rows) { $this-&gt;request-&gt;get['route'] = $query-&gt;row['query']; } } if (isset($this-&gt;request-&gt;get['route'])) { return $this-&gt;forward($this-&gt;request-&gt;get['route']); } } } public function rewrite($link) { if ($this-&gt;config-&gt;get('config_seo_url')) { $url_data = parse_url(str_replace('&amp;amp;', '&amp;', $link)); $url = ''; $data = array(); parse_str($url_data['query'], $data); foreach ($data as $key =&gt; $value) { if (isset($data['route'])) { if (($data['route'] == 'product/product' &amp;&amp; $key == 'product_id') || (($data['route'] == 'product/manufacturer/product' || $data['route'] == 'product/product') &amp;&amp; $key == 'manufacturer_id') || ($data['route'] == 'information/information' &amp;&amp; $key == 'information_id')) { $query = $this-&gt;db-&gt;query("SELECT * FROM " . DB_PREFIX . "url_alias WHERE `query` = '" . $this-&gt;db-&gt;escape($key . '=' . (int)$value) . "'"); if ($query-&gt;num_rows) { $url .= '/' . $query-&gt;row['keyword']; unset($data[$key]); } } elseif ($key == 'path') { $categories = explode('_', $value); foreach ($categories as $category) { $query = $this-&gt;db-&gt;query("SELECT * FROM " . DB_PREFIX . "url_alias WHERE `query` = 'category_id=" . (int)$category . "'"); if ($query-&gt;num_rows) { $url .= '/' . $query-&gt;row['keyword']; } } unset($data[$key]); } else { $query = $this-&gt;db-&gt;query("SELECT * FROM " . DB_PREFIX . "url_alias WHERE `query` = '" . $this-&gt;db-&gt;escape($data['route']) . "'"); if ($query-&gt;num_rows) { $url .= '/' . $query-&gt;row['keyword']; unset($data[$key]); } } } } if ($url) { unset($data['route']); $query = ''; if ($data) { foreach ($data as $key =&gt; $value) { $query .= '&amp;' . $key . '=' . $value; } if ($query) { $query = '?' . trim($query, '&amp;'); } } return $url_data['scheme'] . '://' . $url_data['host'] . (isset($url_data['port']) ? ':' . $url_data['port'] : '') . str_replace('/index.php', '', $url_data['path']) . $url . $query; } else { return $link; } } else { return $link; } } } ?&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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