Hi,
Webmaster Tools is telling me that I have duplicate titles & descriptions for my subcategories.
What I want to do is to have a canonical tag for the subcategories so that the right path will be as follows:
www.mysite.com/main-category/subcategory
Instead of:
www.mysite.com/subcategory
Right now both URL versions have a rel="canonical", which is creating duplicates and confusing Google...
My product & main-category pages are all fine with their full path, thanks to a module I found. But I can't seem to find a solution for the subcategories even after searching the forums & Google for hours...
Any help would be greatly appreciated!
I'm using OC 1.5.4.1
www.gadecosmetics.ca
Thanks,
Benny
Webmaster Tools is telling me that I have duplicate titles & descriptions for my subcategories.
What I want to do is to have a canonical tag for the subcategories so that the right path will be as follows:
www.mysite.com/main-category/subcategory
Instead of:
www.mysite.com/subcategory
Right now both URL versions have a rel="canonical", which is creating duplicates and confusing Google...
My product & main-category pages are all fine with their full path, thanks to a module I found. But I can't seem to find a solution for the subcategories even after searching the forums & Google for hours...
Any help would be greatly appreciated!
I'm using OC 1.5.4.1
www.gadecosmetics.ca
Thanks,
Benny
I'm a bit confused here...
Why would you want to put rel=canoncial to sub-categories instead of to the products?
...BUT there is a module for here, that tackles canonical categories and brands. It's a PAID MOD though
In my case I'm putting rel=canonical to
Why would you want to put rel=canoncial to sub-categories instead of to the products?
...BUT there is a module for here, that tackles canonical categories and brands. It's a PAID MOD though
In my case I'm putting rel=canonical to
Code: Select all
mystore.com/product_1
Code: Select all
<link href="http://mystore.com/parent-category/sub-category/product_1" rel="canonical" />
Hi Cosmicx,
Thanks for replying, and sorry in advance for this long reply..
Maybe I wasn't clear enough so I'll try it again:
1) My products and parent-categories all have their full path canonicals in working order, for example:
Has this canonical path:
This is exactly what I want for subcategories as well, since a subcategory page could also be manually accessed through
This creates duplicated content according to WMT, so I want the subcategory canonical to be:
For some reason, both subcategory paths (domain/parent-category/subcategory & domain/subcategory) have their own canonical tag, which is bad..
2) Lastly, when checking Google's Structured Data testing tool, I never see the subcategory as a breadcrumb. That leads me to believe that the subcategories are not defined properly in my code; example:
I hope that clears any confusions..
So, is there a way to properly define a subcategory as a subcategory, or worst case scenario, to manually add the right canonical to each subcategory page?
Forgot to note that I'm using a custom theme called Mrcarter.
Here's my Category.tpl code, if that helps:
Thanks!
Thanks for replying, and sorry in advance for this long reply..
Maybe I wasn't clear enough so I'll try it again:
1) My products and parent-categories all have their full path canonicals in working order, for example:
Code: Select all
mydomain.com/product
Code: Select all
mydomain.com/parent-category/subcategory/product
Code: Select all
mydomain.com/subcategory
Code: Select all
mydomain.com/parent-category/subcategory
2) Lastly, when checking Google's Structured Data testing tool, I never see the subcategory as a breadcrumb. That leads me to believe that the subcategories are not defined properly in my code; example:
Code: Select all
This URL tested on the testing tool:
http://www.gadecosmetics.ca/eye-makeup/eyeliners/Idyllic-Long-Lasting-Eyeliner
Eyeliner: Idyllic Long Lasting - GA-DE Cosmetics Canada
gadecosmetics.ca › Eyes › Idyllic Long Lasting Eyeliner
CA$14.00 - In stock
The excerpt from the page will show up here. The reason we can't show text from your webpage is because the text depends on the query the user types.
So, is there a way to properly define a subcategory as a subcategory, or worst case scenario, to manually add the right canonical to each subcategory page?
Forgot to note that I'm using a custom theme called Mrcarter.
Here's my Category.tpl code, if that helps:
Code: Select all
<div id="box-category-area">
<div class="box">
<div class="box-heading"><span class="category"><?php echo $heading_title; ?></span></div>
<div class="box-content">
<div class="box-category">
<ul>
<?php foreach ($categories as $category) { ?>
<li>
<?php if ($category['category_id'] == $category_id) { ?>
<a href="<?php echo $category['href']; ?>" class="active"><?php echo $category['name']; ?></a>
<?php } else { ?>
<a href="<?php echo $category['href']; ?>"><?php echo $category['name']; ?></a>
<?php } ?>
<?php if ($category['children']) { ?>
<ul>
<?php foreach ($category['children'] as $child) { ?>
<li>
<?php if ($child['category_id'] == $child_id) { ?>
<a href="<?php echo $child['href']; ?>" class="active"><?php echo $child['name']; ?></a>
<?php } else { ?>
<a href="<?php echo $child['href']; ?>"><?php echo $child['name']; ?></a>
<?php } ?>
</li>
<?php } ?>
</ul>
<?php } ?>
</li>
<?php } ?>
</ul>
</div>
</div>
</div>
</div>
I understand and share your concerns about duplicate pages being indexed. SEO can be approached many ways and by default OpenCart is pretty weak at it. I made a post about this a while back, for instance:
website.com/category/manufacturer/subcategory/product/whatever/anything/product
is somehow considered a valid url and will not throw a 404 which is what you'd expect.
I did quite an extensive mod to my site and it now only routes and accepts single level urls but maintains a full breadcrumb throughout. see the results here:
envirotechgreenhouse.com
This eliminates all duplicate URLs, throws a 404 for nonvalid ones, and sets a logical canonical for everything. It could also be easily amended to set the canonical to full path as you requested. If you like I can sell you the code. Inbox me or send me an email to billynoah@zuma-design.com.
website.com/category/manufacturer/subcategory/product/whatever/anything/product
is somehow considered a valid url and will not throw a 404 which is what you'd expect.
I did quite an extensive mod to my site and it now only routes and accepts single level urls but maintains a full breadcrumb throughout. see the results here:
envirotechgreenhouse.com
This eliminates all duplicate URLs, throws a 404 for nonvalid ones, and sets a logical canonical for everything. It could also be easily amended to set the canonical to full path as you requested. If you like I can sell you the code. Inbox me or send me an email to billynoah@zuma-design.com.
Hi Billy and thank you for your response..
While I appreciate your kind offer, I am looking for free alternatives at the moment. I sure it's probably a very simple fix, but unfortunately I'm not skilled enough to fix it on my own.
If there's no easy solution to it, then I will probably do as you did and have every page as a single level URL (probably also better for SEO purposes as every page is closer to root)..
So if anyone knows of a quick fix, I'd really appreciate it!
Thanks again
While I appreciate your kind offer, I am looking for free alternatives at the moment. I sure it's probably a very simple fix, but unfortunately I'm not skilled enough to fix it on my own.
If there's no easy solution to it, then I will probably do as you did and have every page as a single level URL (probably also better for SEO purposes as every page is closer to root)..
So if anyone knows of a quick fix, I'd really appreciate it!
Thanks again
You can find some helpful posts from this thread.
...you may also read back to page 1 of the thread and look for applicable solutions.
It's not a quick fix... but it may help you out.
...you may also read back to page 1 of the thread and look for applicable solutions.
It's not a quick fix... but it may help you out.
Yes I saw that post a while back (been trying to solve it for weeks)..
I believe I tried everything that was mentioned there, with no success..
I even tried combining the xml from that post along with with other ones, but that didn't work either..
I attached it if you want to take a look. Also tried to PM scd1982 since he claimed he fixed it, but no response yet.. his code didn't work either..
I think I found a way to have a single canonical for the subcategory as a top-level, meaning that both /parent/subcategory & /subcategory, would have /subcategory as the canonical link, but I want it to be the exact opposite
Please take a look at the attached xml and maybe you'd be able to point me to where I went wrong..
Edit: Just noticed that my subcategories don't show as breadcrumbs when clicking on a product from homepage... so much trouble..
I guess that explains why the Structured Data tool isn't displaying the subcategories as breadcrumbs...
Thanks again!
I believe I tried everything that was mentioned there, with no success..
I even tried combining the xml from that post along with with other ones, but that didn't work either..
I attached it if you want to take a look. Also tried to PM scd1982 since he claimed he fixed it, but no response yet.. his code didn't work either..
I think I found a way to have a single canonical for the subcategory as a top-level, meaning that both /parent/subcategory & /subcategory, would have /subcategory as the canonical link, but I want it to be the exact opposite

Please take a look at the attached xml and maybe you'd be able to point me to where I went wrong..
Edit: Just noticed that my subcategories don't show as breadcrumbs when clicking on a product from homepage... so much trouble..

I guess that explains why the Structured Data tool isn't displaying the subcategories as breadcrumbs...
Thanks again!
yeah, if you go to single level urls your breadcrumbs will change accordingly and you need to rewrite the breadcrumb code. trust me i've been through it all and tried a million ways. it can be done but you just need to dig into the php & tpl files which generate the pages. it took me days to sort it all out, which is why i offered my help but i can't do it for free. either way, there are extensions that can help you deal with this if you don't want to pay for someone's time. it's going to cost you no matter how you lok at it, either in time or in money. if you have the time and the knowledge then go for it.
HI I wondered if you could help with my issue as its similar, i think. My website is set with different pull down menus at the top and you can find the same product by going either through product type (i.e. lunch bag) or via manufacturer name such as Tyrrell Katz this is showing in my SEO tool as duplicate content as it ends up at the same product but has different URL paths.
THis is showing at duplicate content which i think google doesn't like. How can i sort this please, i am not techy, willing to pay to get help if not a lot.
example
http://gigglemonsters.co.uk/Gifts-for-K ... encil-Case
http://gigglemonsters.co.uk/Childrens-P ... encil-Case
ends up same place but diff path.
thanks so much
THis is showing at duplicate content which i think google doesn't like. How can i sort this please, i am not techy, willing to pay to get help if not a lot.
example
http://gigglemonsters.co.uk/Gifts-for-K ... encil-Case
http://gigglemonsters.co.uk/Childrens-P ... encil-Case
ends up same place but diff path.
thanks so much
Kids accessories gifts shop
http://www.gigglemonsters.co.uk
But, it also keep the parent/subcategory/ format in the product url's canonical that I didn't want.
So, for this what I have to do?
So, for this what I have to do?
Thanks & Regards
Diwakar
SEO Freelancer Delhi - India
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<modification>
<name><![CDATA[Duplicate Content Fix]]></name>
<code><![CDATA[duplicate_content_fix]]></code>
<version><![CDATA[1.0]]></version>
<author><![CDATA[iSenseLabs]]></author>
<link><![CDATA[https://isenselabs.com]]></link>
<file path="catalog/controller/product/category.php">
<operation>
<search><![CDATA[$category_info = $this->model_catalog_category->getCategory($category_id);]]></search>
<add position="before"><![CDATA[
$this->session->data['last.entered.category'] = $category_id;
]]></add>
</operation>
</file>
<file path="catalog/controller/*/seo_url.php">
<operation>
<search><![CDATA[public function index() {]]></search>
<add position="before"><![CDATA[
public function findParentPath($category_id) {
$found_path = array($category_id);
do {
$category_result = $this->db->query("SELECT * FROM " . DB_PREFIX . "category WHERE category_id = '" . $category_id . "'");
$category_id = (int)$category_result->row['parent_id'];
if ($category_id > 0 && !in_array($category_id, $found_path)) {
array_unshift($found_path, $category_id);
}
} while ($category_id != 0);
return $found_path;
}
]]></add>
</operation>
<operation>
<search><![CDATA[parse_str($url_info['query'], $data);]]></search>
<add position="after"><![CDATA[
$has_product_id = false;
$has_path = false;
foreach ($data as $query_key => $query_value) {
if ($query_key == 'product_id' && !empty($data['route']) && $data['route'] == 'product/product') {
$has_product_id = $query_value;
unset($data['product_id']); // We will set it later, because we need product_id to be after path.
}
if ($query_key == 'path') {
$has_path = true;
}
}
// Calculate full path
$parent_categories_paths = array();
if ($has_product_id !== false) {
// Unset path and manufacturer_id because there is a product_id
unset($data['path']);
unset($data['manufacturer_id']);
} else if ($has_path) {
// Find the true path based on the last category_id
$path_parts = explode('_', $data['path']);
$category_id = $path_parts[count($path_parts) - 1];
$parent_categories_paths[] = $this->findParentPath($category_id);
}
if (!empty($parent_categories_paths)) {
$last_entered_category = !empty($this->session->data['last.entered.category']) ? (int)$this->session->data['last.entered.category'] : 0;
$data['path'] = implode('_', $parent_categories_paths[0]);
$has_path = true;
foreach ($parent_categories_paths as $parent_categories_path_candidate) {
if (in_array($last_entered_category, $parent_categories_path_candidate)) {
$data['path'] = implode('_', $parent_categories_path_candidate);
break;
}
}
}
if ($has_product_id !== false) {
$data['product_id'] = $has_product_id;
}
]]></add>
</operation>
</file>
</modification>
Who is online
Users browsing this forum: Google [Bot] and 43 guests