0
votes

I'm building an e-commerce based on Opencart and I'm now working on SEO optimization.
My problem is that the featured products in homepage generates wrong urls for products detail.

For example, if I have a "Category A" with a product "Shoe", if I navigate inside the category list, and then click on the product, it's all correct, the url become

http://myshop.com/category-a/shoe

but, if I enable the "featured module" and put it in homepage, with the same product, and I click on it, the URL become

http://myshop.com/shoe

missing the "category-a" part.

How can I fix it?

1
This is a well known issue - opencart.com/index.php?route=extension/extension/… fixes itJay Gilford

1 Answers

1
votes

In your category controller the product urls are generated like:

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

which has the category_id in path.

In featured module controller the product urls are generated like:

$this->url->link('product/product', 'product_id=' . $product_info['product_id'])

which doesn't have the category_id. So the category name will be missing in the seo url.

A product may have more than one categories, so the category_id is avoided in featured module. If needed, you can update the featured module urls as in the category controller.