Post by Johnathan » Fri Aug 26, 2011 10:42 pm

IN:

Code: Select all

1.4.x: /catalog/model/tool/seo_url.php
1.5.x: /catalog/controller/common/seo_url.php
REPLACE THE FIRST INSTANCE OF:

Code: Select all

$url .= '/' . $query->row['keyword']; 
WITH:

Code: Select all

$url = '/' . $query->row['keyword']; 
If you want sub-categories to not show their parent categories in the URL, then replace both instances of that line with the replacement.

More tutorials are available at OpenCartX.com/tutorials

Image Image Image Image Image


User avatar
Administrator

Posts

Joined
Fri Dec 18, 2009 3:08 am


Post by uksitebuilder » Sat Aug 27, 2011 5:00 am

Only issue I found is that it kills the breadcrumbs to a degree

User avatar
Guru Member

Posts

Joined
Thu Jun 09, 2011 11:37 pm
Location - United Kindgom

Post by Johnathan » Sat Aug 27, 2011 7:57 am

Yes, that's a downside. You could get around it by including the breadcrumbs in a cookie or some other session data, but I don't know how easy (or convenient) that would be to do. If anyone has a better suggestion, I'm all ears.

Image Image Image Image Image


User avatar
Administrator

Posts

Joined
Fri Dec 18, 2009 3:08 am


Post by Gloyns » Mon Sep 19, 2011 2:45 pm

Johnathan, this is awesome :) Thank you so much. I'd much rather just add the manufacturer to the product name anyway and have a nice clean URL which isn't duplicated throughout the site, E.g. delboyselectronics.co.uk/sony-bravia-42gz8gfh/ rather than delboyselectronics.co.uk/sony/bravia-42gz8gfh, that way you can your branded keywords into the URL and provide a good user experience.

http://www.gloyns.com


Newbie

Posts

Joined
Sat May 21, 2011 7:01 am
Location - Melbourne, Australia

Post by DragonJ » Fri Mar 02, 2012 10:43 am

I'm using this mod and it's working good. I was wondering if anyone has come up with a solution to the now-missing/incomplete breadcrumbs.

My store is awesomely powered by OpenCart 1.5.5.1.


User avatar
Active Member

Posts

Joined
Sun Jan 29, 2012 4:49 pm

Post by DragonJ » Sat Mar 03, 2012 2:11 am

FOLLOW UP: A developer made a vQmod for me today (Breadcrumbs Everywhere) and it works spot on for adding a breadcrumb. Of course if your product is in multiple categories, it's limited to showing only the first category, but that was expected. It still does the job I need it to.

http://www.opencart.com/index.php?route ... on_id=5241

My store is awesomely powered by OpenCart 1.5.5.1.


User avatar
Active Member

Posts

Joined
Sun Jan 29, 2012 4:49 pm

Post by expanism » Wed Mar 21, 2012 11:09 pm

Johnathan wrote:IN:

Code: Select all

1.4.x: /catalog/model/tool/seo_url.php
1.5.x: /catalog/controller/common/seo_url.php
REPLACE THE FIRST INSTANCE OF:

Code: Select all

$url .= '/' . $query->row['keyword']; 
WITH:

Code: Select all

$url = '/' . $query->row['keyword']; 
If you want sub-categories to not show their parent categories in the URL, then replace both instances of that line with the replacement.
Wow that simple, so working this way we can remove canonical url from product page, what do you think?

New member

Posts

Joined
Fri Sep 30, 2011 8:43 pm

Post by Johnathan » Thu Mar 22, 2012 6:24 am

Unless the canonical URL is causing you problems, I would just leave it in.

Image Image Image Image Image


User avatar
Administrator

Posts

Joined
Fri Dec 18, 2009 3:08 am


Post by dunks » Tue Apr 17, 2012 5:56 pm

this is SUPER AWESOME !! :banana:

What effect on google crawl??

Ingat Gadget, Ingat DroidLime https://www.droidlime.com/


User avatar
Active Member

Posts

Joined
Wed Apr 20, 2011 1:19 pm
Location - Jakarta - Indonesia

Post by CrysTim » Sun Oct 07, 2012 8:59 am

Johnathan wrote:IN:

Code: Select all

1.4.x: /catalog/model/tool/seo_url.php
1.5.x: /catalog/controller/common/seo_url.php
REPLACE THE FIRST INSTANCE OF:

Code: Select all

$url .= '/' . $query->row['keyword'];
WITH:

Code: Select all

$url = '/' . $query->row['keyword'];
If you want sub-categories to not show their parent categories in the URL, then replace both instances of that line with the replacement.
Not working for me :(
I have:
- Opencart 1.5.4
- www.shop.com/category/subcategory link working
- www.shop.com/product link working
- no vqmods or seo module installed....

Can somebody help me? On wich version that code worked?

New member

Posts

Joined
Sun Oct 07, 2012 8:28 am

Post by vtdoan » Sat Oct 13, 2012 12:18 pm

CrysTim wrote:
Johnathan wrote:IN:

Code: Select all

1.4.x: /catalog/model/tool/seo_url.php
1.5.x: /catalog/controller/common/seo_url.php
REPLACE THE FIRST INSTANCE OF:

Code: Select all

$url .= '/' . $query->row['keyword'];
WITH:

Code: Select all

$url = '/' . $query->row['keyword'];
If you want sub-categories to not show their parent categories in the URL, then replace both instances of that line with the replacement.
Not working for me :(
I have:
- Opencart 1.5.4
- http://www.shop.com/category/subcategory link working
- http://www.shop.com/product link working
- no vqmods or seo module installed....

Can somebody help me? On wich version that code worked?
Try this:
IN:

Code: Select all

catalog\controller\product\category.php
Replace:

Code: Select all

'href'        => $this->url->link('product/product', 'path=' . $this->request->get['path'] . '&product_id=' . $result['product_id']) 
With:

Code: Select all

'href'        => $this->url->link('product/product',  'product_id=' . $result['product_id']) 
hope this helps you :)
Last edited by Johnathan on Mon Oct 15, 2012 5:24 am, edited 1 time in total.
Reason: Fixed [code] tags

Newbie

Posts

Joined
Sat Oct 13, 2012 12:10 pm

Post by cwswebdesign » Mon Jun 24, 2013 6:44 am

I've done this to remove all category names from the actual product page link and it works on the site but I'm seeing the following in the error log:

2013-06-23 10:45:24 - PHP Warning: explode() expects parameter 2 to be string, array given in /home/----------/public_html/----------/vqmod/vqcache/vq2-catalog_controller_common_seo_url.php on line 129
2013-06-23 10:45:24 - PHP Warning: Invalid argument supplied for foreach() in /home/----------/public_html/----------/vqmod/vqcache/vq2-catalog_controller_common_seo_url.php on line 131
2013-06-23 10:45:25 - PHP Warning: explode() expects parameter 2 to be string, array given in /home/----------/public_html/----------/vqmod/vqcache/vq2-catalog_controller_common_seo_url.php on line 129
2013-06-23 10:45:25 - PHP Warning: Invalid argument supplied for foreach() in /home/---------/public_html/----------/vqmod/vqcache/vq2-catalog_controller_common_seo_url.php on line 131
2013-06-23 11:32:26 - PHP Notice: Undefined index: query in /home/---------/public_html/----------/vqmod/vqcache/vq2-catalog_controller_common_seo_url.php on line 43
2013-06-23 11:32:26 - PHP Notice: Undefined offset: 1 in /home/---------/public_html/----------/vqmod/vqcache/vq2-catalog_controller_common_seo_url.php on line 49

Any thoughts? This is using v1.5.5.1

DL

This account is inactive. Look for us under the name 'EvolveWebHosting' and contact us under that username.

Thanks!


User avatar
Active Member

Posts

Joined
Sun Dec 11, 2011 12:26 am
Location - USA

Post by krisbolleter » Tue Oct 15, 2013 4:50 am

Hey There!

So I have gotten this to work on my sub-category pages, however my question is, how can I now add the parent category directory back into the product page specific URL (ie:

Parent Category URL: ../parent-category
Sub-Category URL: ../sub-category
Product URL : ../parent-category/product-url

)

any help would be greatly appreciated! :)

Newbie

Posts

Joined
Wed Oct 09, 2013 6:48 am

Post by RedHighHeels » Fri Apr 11, 2014 2:03 am

LOL all i had to do is remove a dot. wasted 3h on this .. no information about this problem at all. someone should write a xml for this and sell it im sure people will buy it :)

The best online shop to shop for High Heels


Newbie

Posts

Joined
Thu Nov 07, 2013 11:37 pm


Post by ncwsolution » Sun Nov 02, 2014 3:17 pm

excellent post and superb following with great answers, thanks Johnathan

User avatar
Newbie

Posts

Joined
Sun Nov 02, 2014 2:04 pm
Location - Pakistan

Post by mmjy » Tue Jan 27, 2015 4:17 pm

I was wondering if this solution help SEO and rankings, and avoid duplicate content from search engines?

Newbie

Posts

Joined
Tue Jan 20, 2015 6:58 pm

Post by Johnathan » Tue Jan 27, 2015 11:02 pm

Unlikely -- OpenCart includes canonical tags, so it shouldn't be indexing duplicate content for product pages.

Image Image Image Image Image


User avatar
Administrator

Posts

Joined
Fri Dec 18, 2009 3:08 am


Post by nicoletaradu » Wed Feb 04, 2015 6:23 pm

Thank you so much it works!! for my opencart website
http://www.magneticmarket.ro

Newbie

Posts

Joined
Wed Feb 04, 2015 6:21 pm

Post by PBVLLP » Tue Sep 15, 2015 9:11 pm

Hello All,

We are finding a strange issue - when we delete duplicate product record [erroneously created in the first place] the url alias table is not automatically updated - this table retains the url alias for the product record already deleted.

is this a normal opencart known defect? is there any fix for this?

The issue is since duplicate seo key word is retained, it gives product not found error when customer tries to visit a product page from a cateogry>product listing page.

thanks for guidance.

Newbie

Posts

Joined
Fri Jan 30, 2015 10:40 pm

Post by kazihaha » Thu Oct 01, 2015 5:05 pm

Johnathan wrote:IN:

Code: Select all

1.4.x: /catalog/model/tool/seo_url.php
1.5.x: /catalog/controller/common/seo_url.php
REPLACE THE FIRST INSTANCE OF:

Code: Select all

$url .= '/' . $query->row['keyword'];
WITH:

Code: Select all

$url = '/' . $query->row['keyword'];
If you want sub-categories to not show their parent categories in the URL, then replace both instances of that line with the replacement.

More tutorials are available at OpenCartX.com/tutorials
not work for my opencart 2.0.3.1, I still see
localhost/journal/may-photocopy/canon/canon-ir-2002n.html -> when I access "may-photocopy", then "canon", then "canon-ir-2002"
http://localhost/journal/canon-ir-2002n.html -> when I access this "canon-ir-2002n" from the home page.

Please help me.

https://sieuthithietbivanphong.com


New member

Posts

Joined
Wed Sep 23, 2015 2:13 pm
Who is online

Users browsing this forum: No registered users and 15 guests