Hey guys!
First little publicly given mod of opencart 1.5.x from myself, yet to submit it.
What happens is basically, instead of having www.example.com/index.php?route=common/home....etc, it'll take advantage of htrewrite if you have seo turned on. so instead you get www.example.com/common/home.php, or .htm, or .asp, or .jpg (not recommend!)
Granted, it has very little real seo effect on serach engines, but it looks a lot nicer.
You seo keywords will still work is they're set, if there isn't anything set, then it'll be parentcat.php?product_id=xx
Works on cart, account area and check area. works on the information pages too. example.com/information.htm?information_id=xx
Its merely prof of concept at the moment but you can see it working here - I've yet to change the homepage, it's mainly set up so my friend can get used to the admin before we get a 'live' site up with a nice domain. I've also set the page extension to .asp, seemed like a fun thing to do at the time.
The Link: http://www.braceletmania.smifis.co.uk/
First little publicly given mod of opencart 1.5.x from myself, yet to submit it.
What happens is basically, instead of having www.example.com/index.php?route=common/home....etc, it'll take advantage of htrewrite if you have seo turned on. so instead you get www.example.com/common/home.php, or .htm, or .asp, or .jpg (not recommend!)
Granted, it has very little real seo effect on serach engines, but it looks a lot nicer.
You seo keywords will still work is they're set, if there isn't anything set, then it'll be parentcat.php?product_id=xx
Works on cart, account area and check area. works on the information pages too. example.com/information.htm?information_id=xx
Its merely prof of concept at the moment but you can see it working here - I've yet to change the homepage, it's mainly set up so my friend can get used to the admin before we get a 'live' site up with a nice domain. I've also set the page extension to .asp, seemed like a fun thing to do at the time.
The Link: http://www.braceletmania.smifis.co.uk/
Already mentioned in the forum a few times on how to achieve this and already an extension available to do this too - see my sig
I haven't seen anything mentioned nor have i been able to find any extensions. none of yours offer this basic function standalone.
I'm not asking how to do it, Just asking what people think of it. I'll release it as a free extension when i get round to submitting it.
Do you have an example site for you extension though? some of them look interesting
I'm not asking how to do it, Just asking what people think of it. I'll release it as a free extension when i get round to submitting it.
Do you have an example site for you extension though? some of them look interesting
*root*/catalog/controller/common/seo.php
Code: Select all
<?php
class ControllerCommonSeoUrl extends Controller {
public function index() {
// Add rewrite to url class
if ($this->config->get('config_seo_url')) {
$this->url->addRewrite($this);
}
// Decode URL
if (isset($this->request->get['_route_'])) {
$this->request->get['_route_'] = substr($this->request->get['_route_'], 0, -4);
$parts = explode('/', $this->request->get['_route_']);
foreach ($parts as $part) {
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "url_alias WHERE keyword = '" . $this->db->escape($part) . "'");
if ($query->num_rows) {
$url = explode('=', $query->row['query']);
if ($url[0] == 'product_id') {
$this->request->get['product_id'] = $url[1];
}
if ($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') {
$this->request->get['manufacturer_id'] = $url[1];
}
if ($url[0] == 'information_id') {
$this->request->get['information_id'] = $url[1];
}
} else {
$this->request->get['route'] = $this->request->get['_route_'];
// $this->request->get['route'] = 'error/not_found';
}
}
if (isset($this->request->get['product_id'])) {
$this->request->get['route'] = 'product/product';
} elseif (isset($this->request->get['path'])) {
$this->request->get['route'] = 'product/category';
} elseif (isset($this->request->get['manufacturer_id'])) {
$this->request->get['route'] = 'product/manufacturer/product';
} elseif (isset($this->request->get['information_id'])) {
$this->request->get['route'] = 'information/information';
}
if (isset($this->request->get['route'])) {
return $this->forward($this->request->get['route']);
}
}
}
public function rewrite($link) {
$prefix = '.asp';
if ($this->config->get('config_seo_url')) {
$url_data = parse_url(str_replace('&', '&', $link));
$url = '';
$data = array();
parse_str($url_data['query'], $data);
foreach ($data as $key => $value) {
if (isset($data['route'])) {
if (($data['route'] == 'product/product' && $key == 'product_id') || (($data['route'] == 'product/manufacturer/product' || $data['route'] == 'product/product') && $key == 'manufacturer_id') || ($data['route'] == 'information/information' && $key == 'information_id')) {
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "url_alias WHERE `query` = '" . $this->db->escape($key . '=' . (int)$value) . "'");
if ($query->num_rows) {
$url .= '/' . $query->row['keyword'];
unset($data[$key]);
}
} elseif ($key == 'path') {
$categories = explode('_', $value);
foreach ($categories as $category) {
$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "url_alias WHERE `query` = 'category_id=" . (int)$category . "'");
if ($query->num_rows) {
$url .= '/' . $query->row['keyword'];
}
}
unset($data[$key]);
}
}
}
if ($url) {
unset($data['route']);
$query = '';
if ($data) {
foreach ($data as $key => $value) {
$query .= '&' . $key . '=' . $value;
}
if ($query) {
$query = '?' . trim($query, '&');
}
}
return $url_data['scheme'] . '://' . $url_data['host'] . (isset($url_data['port']) ? ':' . $url_data['port'] : '') . str_replace('/index.php', '', $url_data['path']) . $url . $prefix . $query;
// keywords found.
} else {
$url_data = parse_url(str_replace('&', '&', $link));
$data = array();
parse_str($url_data['query'], $data);
// $url = '/'.implode('/',array_unique(explode('/',$data['route'])));
$url = '/' . $data['route'];
unset($data['route']);
$query = '';
if ($data) {
foreach ($data as $key => $value) {
$query .= '&' . $key . '=' . $value;
}
if ($query) {
$query = '?' . trim($query, '&');
}
}
unset($data);
return $url_data['scheme'] . '://' . $url_data['host'] . (isset($url_data['port']) ? ':' . $url_data['port'] : '') . $url . $prefix . $query;
// return $link; // No seo keywords found in the db.
}
} else {
return $link; //SEO Turned off
}
}
}
?>
HI Mate,
Just a couple of things
Sitewise Prety URLs
Did you mean Sitewide Pretty URLs ?
Why .asp as the default ? Surely .htm or .html or no extension at all makes more sense ?
Just a couple of things
Sitewise Prety URLs
Did you mean Sitewide Pretty URLs ?
Why .asp as the default ? Surely .htm or .html or no extension at all makes more sense ?
I figured once a website has been branded and templated, they tend to not look like opencart with a few new colors. having a .asp extension will confuse any potential hacks or con artist trying to break into the system.
And yes, Spelling mistake,
And yes, Spelling mistake,
I also have done something like that. and here is my demo site, http://www.uusign.com.
using the category name ,product name as the SEO URL if the SEO keyword is blank when you added or edited them.
also all the link like account/account,common/home rewrite to home, account,ect (could be config).
using the category name ,product name as the SEO URL if the SEO keyword is blank when you added or edited them.
also all the link like account/account,common/home rewrite to home, account,ect (could be config).
Opencart Developer
- http://www.cnopencart.com opencart中文站
hi
after i replace the seo url, my page doesnt change any remain the same as url: /product-id14
even i insert keyword in categorise and product data tab, also is a same
how to show it as www.domain.com/computer/HP2002
categorise product name
much appreciate your help
after i replace the seo url, my page doesnt change any remain the same as url: /product-id14
even i insert keyword in categorise and product data tab, also is a same
how to show it as www.domain.com/computer/HP2002
categorise product name
much appreciate your help
if you have a url-alias key set for both the product and category then you will get an url like www.example.com/cat/cat.../prod
if you dont, you will just have www.example.com/prod or example.com/product?product_id=xx
if you dont, you will just have www.example.com/prod or example.com/product?product_id=xx
hi smifis,
sorry for my poor english. could you guide me step by step how to change it
from
example.com/dir/index.php?route=product/product&path=20&product_id=29
to
example.com/dir/hp2000 <- direct link to product name
.
i had done upload all the file into root
what is the next ? go to where modify it?
sorry for my poor english. could you guide me step by step how to change it
from
example.com/dir/index.php?route=product/product&path=20&product_id=29
to
example.com/dir/hp2000 <- direct link to product name
.
i had done upload all the file into root
what is the next ? go to where modify it?
In the admin interface, for the description for each product there should be a box titled alias_url, this is where you put in hp2000,
my script primarily deal with pages which dont have this filled in so you end up with product.php?product_id=2
my script primarily deal with pages which dont have this filled in so you end up with product.php?product_id=2
hi smifis,smifis wrote:In the admin interface, for the description for each product there should be a box titled alias_url, this is where you put in hp2000,
my script primarily deal with pages which dont have this filled in so you end up with product.php?product_id=2
my page only have this but do not have alias_url
1.product name
2.meta tag description
3.meta tag keyword
4.description
5.product tag
where is go wrong???
Who is online
Users browsing this forum: KhubaibKhan and 299 guests