Post by Doves76 » Tue Nov 29, 2011 11:10 am

Does anybody have a definitive solution for this, that doesnt mess with the admin ?
I need my homepage to have only one URL www.discreettiger.com.au the problem is when you click on the home link it comes back to http://discreettiger.com.au/index.php?route=common/home.
Running Opencart 1.5.1.3

Newbie

Posts

Joined
Tue Oct 18, 2011 5:17 pm

Post by kdmp » Tue Nov 29, 2011 1:11 pm

One of the easiest ways would be to edit your template file. I am certain there is probably a better fix for this - but it's the only one I can think of right now.
/catalog/view/theme/[your theme]/template/common/header.tpl
Find this line:

Code: Select all

<div class="links"><a href="<?php echo $home; ?>"><?php echo $text_home; ?></a><a href="<?php echo $wishlist; ?>" id="wishlist_total"><?php echo $text_wishlist; ?></a><a href="<?php echo $cart; ?>"><?php echo $text_cart; ?></a><a href="<?php echo $checkout; ?>"><?php echo $text_checkout; ?></a></div>
Change it so it looks like this:
<div class="links"><a href="http://www.discreettiger.com.au"><?php echo $text_home; ?></a><a href="<?php echo $wishlist; ?>" id="wishlist_total"><?php echo $text_wishlist; ?></a><a href="<?php echo $cart; ?>"><?php echo $text_cart; ?></a><a href="<?php echo $checkout; ?>"><?php echo $text_checkout; ?></a></div>
Hope this helps you for now

Kevin Davidson
Purolator Shipping Module
Canpar Shipping Module
VQMod - Paypal Transaction ID to Payment Details


Active Member

Posts

Joined
Thu Jun 04, 2009 10:40 am
Location - Ontario, Canada

Post by wolfsteritory » Tue Nov 29, 2011 3:59 pm

problem appears if somebody have a multi store with the same theme , i was thinking of href="/index.php "

im still searching for a better solution as i manage about 30 stores from the same control pannel

Here Are Your Options :
1st Option: Web3DesignStudio
More Options ? - What More Do You Need ? !


User avatar
New member

Posts

Joined
Sun Feb 01, 2009 2:08 am

Post by Doves76 » Thu Dec 01, 2011 10:26 am

Thanks for the help, problem solved...

Newbie

Posts

Joined
Tue Oct 18, 2011 5:17 pm

Post by werepair » Thu Dec 01, 2011 2:59 pm

Doves76 wrote:Thanks for the help, problem solved...
i use this vQmod attached. if you use it you will need to install vQmod if you dont have it already installed. no core files are modified.

Best regards

Attachments

No Common Home


User avatar
Active Member

Posts

Joined
Sat May 28, 2011 2:54 pm
Location - United Kingdom

Post by rwalker » Sat Dec 24, 2011 7:02 am

Thank you. Just what I was looking for.

Discount Golf Clubs and Golf Equipment - Powered by Opencart


New member

Posts

Joined
Fri Jul 01, 2011 8:14 am

Post by Mazert » Fri Feb 03, 2012 10:08 pm

Does that mod change every "home" link?

I used kdmp instructions but put "/" instead of full web address.
Changed the logo link in header.tpl to "/" as well <div id="logo"><a href="/">

But there's some more home links that need to be changed.

New member

Posts

Joined
Fri Nov 25, 2011 10:48 pm

Post by innuoluke » Mon Jun 18, 2012 4:22 pm

werepair wrote:
Doves76 wrote:Thanks for the help, problem solved...
i use this vQmod attached. if you use it you will need to install vQmod if you dont have it already installed. no core files are modified.

Best regards
Thanks for this :) Appears to do just what was needed!

Web developer for Cotswold Web Services / Innuo Ltd
Need help with your Opencart website? Give us a call to see how we can help.


Newbie

Posts

Joined
Sat Jun 18, 2011 4:36 pm

Post by Alex28 » Sun Sep 16, 2012 5:51 pm

To date I've not been able to remove index.php?route=common/home Is anyone willing to help me with this ???

Newbie

Posts

Joined
Thu Jan 12, 2012 11:08 pm

Post by Alex28 » Wed Sep 19, 2012 5:16 pm

Hi guys I would love some help with this issue I am not confident enough to tackle this myself.
I notice some of you have acheived this ,will pay if I have to ;)

Newbie

Posts

Joined
Thu Jan 12, 2012 11:08 pm

Post by Avvici » Thu Sep 20, 2012 3:05 pm

Come on guy's the free fix is here:

User avatar
Expert Member

Posts

Joined
Tue Apr 05, 2011 12:09 pm
Location - Asheville, NC

Post by nyomanmusdina » Wed Oct 10, 2012 2:35 pm

I'm having exactly the same problem. The SEOR url for products work well. But since I moved the store to subfolder
it changed like this

from
http://baligoodjewelry.com/bali-silver- ... -of-pearls
to
http://baligoodjewelry.com/storeindex.p ... -of-pearls

how to get rid that storeindex.php.

Please kindly advise.

Thank you

Nyoman BGC
Your Balinese Fellow
http://www.baligoodjewelry.com


User avatar
New member

Posts

Joined
Fri Sep 02, 2011 9:06 am
Location - Bali, Indonesia

Post by Axansh » Wed Oct 10, 2012 3:28 pm

HI,
For that you have to change your .htaccess file.

Just backup your .htaccess file and and upload this code.

# SEO URL Settings
RewriteEngine On
RewriteBase /Your_sub_directory_name/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]

Hope it works.

Thanks and Best Regards,
Axansh Sheth

Our Opencart Module
All in ONE SEO |
Multi-purpose pop |
Restaurant theme |
Store time save module


User avatar
Active Member

Posts

Joined
Mon Feb 06, 2012 3:07 pm

Post by rkaartikeyan » Mon Nov 19, 2012 5:58 am

/catalog/controller/common/seo_url.php

Open the file and replace the below code

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_'])) {
			$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'] = '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/info';
			} elseif (isset($this->request->get['information_id'])) {
				$this->request->get['route'] = 'information/information';
			}else {
				$this->request->get['route'] = $this->request->get['_route_'];
			}
			
			if (isset($this->request->get['route'])) {
				return $this->forward($this->request->get['route']);
			}
		}
	}
	
	public function rewrite($link) {
		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/info' || $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]);
					}else {
						$url .= '/'.$value;
					}
				}
			}
			
			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 . $query;
			} else {
				return $link;
			}
		} else {
			return $link;
		}		
	}	
}
?>

Newbie

Posts

Joined
Mon Nov 19, 2012 5:55 am

Post by Rappuzzi » Fri Dec 14, 2012 9:06 am

rkaartikeyan wrote:/catalog/controller/common/seo_url.php

Open the file and replace the below code

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_'])) {
			$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'] = '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/info';
			} elseif (isset($this->request->get['information_id'])) {
				$this->request->get['route'] = 'information/information';
			}else {
				$this->request->get['route'] = $this->request->get['_route_'];
			}
			
			if (isset($this->request->get['route'])) {
				return $this->forward($this->request->get['route']);
			}
		}
	}
	
	public function rewrite($link) {
		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/info' || $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]);
					}else {
						$url .= '/'.$value;
					}
				}
			}
			
			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 . $query;
			} else {
				return $link;
			}
		} else {
			return $link;
		}		
	}	
}
?>
yep.
I replaced this now with many assumed fixes and none of them works, except, I get a nice 404 error.

We may have just to keep living with the SEO Unfriendly opencart and forget about SEO. Unfortunately most people nowadays like to be Green, SEO Friendly, etc., So I wonder why opencart cannot follow some "positive" trends. Hm?

I spent now an entire day and night and tried endless "assumed" solutions and now I am about to give up.

Some things just Can't Be Done and it all looks like geting opencart to display SEO friendly URL's - that is just one of those things you better forget they exist when deciding on working with opencart. -)

Newbie

Posts

Joined
Wed Jun 27, 2012 7:22 am

Post by Rappuzzi » Fri Dec 14, 2012 9:35 am

avvici wrote:Come on guy's the free fix is here:
jg_no_common_home.xml
... and why do you assume there is a CDATA in that php file?
And besides,
even if I use the plain "if" clause, there is none of that you are searching for with you xml!

Common guy's, (and why guy's and not guys? - another fix?) - you all seem to work with a thousand different files, everyone hacks a little around and then assumes the rest of the world just has the same hack.

HELLOOOO ... we are talking about the "core" opencart files here and if "You" happen to work with any of your own hacks, then "PLEASE" mention it! It's not facebook here. It's suppose to be a place where people really are suppose to follow some constructive ideas. (well, least that's my silly assumption)

And no, I don't want to open another ticket because "clear thinking" is really right! A search should do! But it appears, all it does is it delivers none-working, "pretenting to be" solutions which only end up in trowing more errors.

So can anyone just stick to some basics here and point towards some solution that is not just some other partial talk to entertain, but really "Is" a solution - and a complete solution! ?

Please?

Thank you all so much.

Newbie

Posts

Joined
Wed Jun 27, 2012 7:22 am

Post by Rappuzzi » Fri Dec 14, 2012 11:16 am

I found the solution (problem) myself.
(after endless searching and changing search terms over and over)

For anyone with the same problem - Be warned "opencart has a .htaccess problem"
this may help solve your problem;
http://www.sitefixit.com/scripts/openca ... encart.php
it solved my problem partially but only works if your shop is installed in the root.
Just make sure:
you replace RewriteBase /shop/
with your own URL for example example.com, hence - RewriteBase /example.com/

However, as soon as you have a second shop installed (e.g. in a subdomain;
replacing the above with RewriteBase /example.com/sub/
or
RewriteBase /sub.example.com/
SEO friendly URL's won't work and you'll get the ugly URL's again.

I still try to find a solution to that I will post it here, too

Good luck to all.

Newbie

Posts

Joined
Wed Jun 27, 2012 7:22 am

Post by LaurenceLord » Wed Oct 23, 2013 3:12 am

avvici -arvixe- wrote:Come on guy's the free fix is here:
[url=http://forum.opencart.com/download/file.php?id=8403]jg_no_common_home.xml[/url]
This fix worked for me! ...Like a treat

It took me a few moments to figure out how to use vQMod but after reading this article I got it working: http://code.google.com/p/vqmod/wiki/Install_OpenCart

Thanks very much OpenCart community!
Especially
@werepair
@avvici

8)

PS. How do you do @ mentions?
.

Laurence Lord
Creative Developer

http://laurencelord.co.uk


Newbie

Posts

Joined
Mon Sep 16, 2013 9:32 pm
Location - London, UK

Post by mkp007 » Tue Nov 19, 2013 6:54 am

The vqmod worked great (xml code is below for reference). Now I'm wondering if we can do the same to the links such as "contact us", "returns", "specials" etc?

Would this be handled in the same PHP file?

To be honest, I'm a bit confused with how the code works. I get that this mod searches for "if ($url) {" but I don't understand what it is replacing it with and why this works. Anyone have any insight for me?

Code: Select all

<modification>
	<id>No Common Home</id>
	<version>1.5.x</version>
	<vqmver>1.0.8</vqmver>
	<author>Jay Gilford - jay@jaygilford.com</author>
	<file name="catalog/controller/common/seo_url.php">
		<operation>
			<search position="replace"><![CDATA[
			if ($url) {
			]]></search>
			<add><![CDATA[
			if ($url || (isset($data['route']) && $data['route'] == 'common/home') ) {
			]]></add>
		</operation>
	</file>
</modification>

Vorticy, Inc.
Opencart 1.5.6.4, MySQL 5.1.73-5, PHP 5.3.3-46, Plesk v12.0.18, OS CentOS 6


New member

Posts

Joined
Fri May 10, 2013 12:56 am

Post by LaurenceLord » Tue Nov 19, 2013 8:28 pm

mkp007 wrote:Now I'm wondering if we can do the same to the links such as "contact us", "returns", "specials" etc?
I'm pretty sure you can achieve this by enabling "Use SEO Keywords". Do this via the admin screens:
SYSTEM>SETTINGS> edit your chosen shop > SERVER>"Use SEO Keywords">YES

You may also need to add a keyword for each of the pages, which you probably know are under:
CATALOG>INFORMATION

Hope this helps,
Laurence

Laurence Lord
Creative Developer

http://laurencelord.co.uk


Newbie

Posts

Joined
Mon Sep 16, 2013 9:32 pm
Location - London, UK
Who is online

Users browsing this forum: No registered users and 66 guests