http://stackoverflow.com/q/7578055/961455
Apply the patch and add to the existing url_alias table
Code: Select all
INSERT INTO `url_alias` (`url_alias_id`, `query`, `keyword`) VALUES (NULL, 'checkout/cart', 'cart');
Code: Select all
INSERT INTO `url_alias` (`url_alias_id`, `query`, `keyword`) VALUES (NULL, 'checkout/cart', 'cart');
Patch to catalog/controller/common/seo_url.php
Code: Select all
Index: catalog/controller/common/seo_url.php
===================================================================
--- catalog/controller/common/seo_url.php (old)
+++ catalog/controller/common/seo_url.php (new)
@@ -18,23 +18,17 @@
if ($url[0] == 'product_id') {
$this->request->get['product_id'] = $url[1];
- }
-
- if ($url[0] == 'category_id') {
+ } elseif ($url[0] == 'category_id') {
if (!isset($this->request->get['path'])) {
$this->request->get['path'] = $url[1];
} else {
$this->request->get['path'] .= '_' . $url[1];
}
- }
-
- if ($url[0] == 'manufacturer_id') {
+ } elseif ($url[0] == 'manufacturer_id') {
$this->request->get['manufacturer_id'] = $url[1];
+ } elseif ($url[0] == 'information_id') {
+ $this->request->get['information_id'] = $url[1];
}
-
- if ($url[0] == 'information_id') {
- $this->request->get['information_id'] = $url[1];
- }
} else {
$this->request->get['route'] = 'error/not_found';
}
@@ -48,7 +42,12 @@
$this->request->get['route'] = 'product/manufacturer/product';
} elseif (isset($this->request->get['information_id'])) {
$this->request->get['route'] = 'information/information';
- }
+ } else {
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "url_alias WHERE keyword = '" . $this->db->escape($this->request->get['_route_']) . "'");
+ if ($query->num_rows) {
+ $this->request->get['route'] = $query->row['query'];
+ }
+ }
if (isset($this->request->get['route'])) {
return $this->forward($this->request->get['route']);
@@ -88,7 +87,15 @@
}
unset($data[$key]);
- }
+ } else {
+ $query = $this->db->query("SELECT * FROM " . DB_PREFIX . "url_alias WHERE `query` = '" . $this->db->escape($data['route']) . "'");
+
+ if ($query->num_rows) {
+ $url .= '/' . $query->row['keyword'];
+
+ unset($data[$key]);
+ }
+ }
}
}
Code: Select all
INSERT INTO `url_alias` (`url_alias_id`, `query`, `keyword`) VALUES
(NULL, 'common/home', ''),
(NULL, 'checkout/cart', 'cart'),
(NULL, 'checkout/checkout', 'checkout'),
(NULL, 'account/account', 'myaccount'),
(NULL, 'account/login', 'login'),
(NULL, 'account/forgotten', 'forgot'),
(NULL, 'account/register', 'register'),
(NULL, 'account/order', 'order-history'),
(NULL, 'account/return', 'returns'),
(NULL, 'account/transaction', 'transactions'),
(NULL, 'account/voucher', 'gift-voucher'),
(NULL, 'account/wishlist', 'wishlist'),
(NULL, 'account/download', 'downloads'),
(NULL, 'account/newsletter', 'newsletter'),
(NULL, 'product/search', 'search'),
(NULL, 'product/special', 'specials'),
(NULL, 'product/manufacturer', 'brands'),
(NULL, 'affiliate/account', 'affiliates'),
(NULL, 'information/sitemap', 'sitemap');
Patched seo url file:
/catalog/controller/common/seo_url.php
Users browsing this forum: No registered users and 128 guests