Post by zugu » Sat Jan 15, 2011 7:29 pm

Hello,

I enabled SEO URLs on my OpenCart 1.4.9.3 installation. I assigned SEO keywords to all categories and to all products. Product URLs now look like this:

Code: Select all

http://mystore.com/category/product
However, product links inside the "Latest Products" module look like this:

Code: Select all

http://mystore.com/product
Is there any way to force these product links to include the product category? I don't want two links for each product in my store. One for each is enough, and I prefer the ones including the category.

Newbie

Posts

Joined
Sat Jan 15, 2011 6:50 pm

Post by Chones » Sat Jan 15, 2011 10:54 pm

You can't, and you shouldn't. A product in the "Latest" box could be in 3 or 4 categories, so how do you choose which category to use in the breadcrumbs.

And don't worry about different URLs for the same product. If you look in the product page meta data you will see a rel=canonical link. That is the only one that will be indexed by the search engines. You won't have any duplicate content.

http://scarletandjones.com/
http://sharpdressedman.co.uk/
http://coffincompany.co.uk/
http://horsesculptures.co.uk/
If I've helped you out, why not buy me a beer? http://craigmurray.me.uk


User avatar
Active Member

Posts

Joined
Wed Mar 24, 2010 9:07 pm
Location - London

Post by misscaprice » Sat Jan 22, 2011 6:52 pm

Is there a way to reverse the canonical
Now it shows both

Code: Select all

www.mysite.com/product-category/product-1
www.mysite.com/product-1
as canonical to

Code: Select all

www.mysite.com/product-1
I want them both to be set canonical to

Code: Select all

www.mysite.com/product-category/product-1
And one more thing: I need the products address output to end at .html, is there any way to do it?
Thanks in advance!

New member

Posts

Joined
Sat Jan 22, 2011 6:47 pm

Post by Chones » Thu Jan 27, 2011 6:53 am

You would need to find which category a product is in and include it in the canonical link. The problem occurs if a product is in more than one category. If you can be sure you will never have a product in more than one category you can try it.

andyspartan has posted a way to get the category ids of the categories a product is in, in your case the one category id, at the bottom of this post:
http://forum.opencart.com/viewtopic.php?t=13347

You'll then need to get the category name via the id, then find a way of adding it to the canonical URL. But hope that gets you started.

Why would you want .html at the end of your URLs? There is no reason to have it. .html is dead - buried by dynamic languages such as PHP.

http://scarletandjones.com/
http://sharpdressedman.co.uk/
http://coffincompany.co.uk/
http://horsesculptures.co.uk/
If I've helped you out, why not buy me a beer? http://craigmurray.me.uk


User avatar
Active Member

Posts

Joined
Wed Mar 24, 2010 9:07 pm
Location - London

Post by misscaprice » Thu Feb 03, 2011 3:31 am

chones, thank you very much for the detailed answer. I assumed .html is better than URLs looking like directories, because there is no .php at the end of the URL. I researched further and you are right, I will not use .html.

I am sure that product will belong to only one product category, but.. I plan to include narrow search - by manufacturer, by product characteristics, by style..
Does this mean that I will not be able to use cannonical for

Code: Select all

www.mysite.com/product-category/product-1
and this is the only possible way:

Code: Select all

www.mysite.com/product-1

New member

Posts

Joined
Sat Jan 22, 2011 6:47 pm

Post by Chones » Thu Feb 03, 2011 5:49 am

No, you can have the category in the canonical url. The canonical url only appears on the product page, so it doesn't matter how you got to that category, by whatever search you used.

But honestly, it'd be much easier just to use the category in the product url.

If you want /product-category/product, just change product to include product-category e.g.

If you want mysite.com/t-shirts/white, you can use mysite.com/white-t-shirt instead

That's just as good for SEO - It may actually be better as it is one less step down the folder tree and page rank gets lost at every stage down the folder tree.

http://scarletandjones.com/
http://sharpdressedman.co.uk/
http://coffincompany.co.uk/
http://horsesculptures.co.uk/
If I've helped you out, why not buy me a beer? http://craigmurray.me.uk


User avatar
Active Member

Posts

Joined
Wed Mar 24, 2010 9:07 pm
Location - London

Post by misscaprice » Sun Feb 13, 2011 6:14 pm

The same clever idea came suddenly to me. Your answer prooved it right, thank you Chones.
I also removed the .html from the pages, no need of them really.

New member

Posts

Joined
Sat Jan 22, 2011 6:47 pm
Who is online

Users browsing this forum: No registered users and 10 guests