How To Avoid A Url Mess? How To Fix?

On a clean install we added many products all with unique names. All urls have this syntaxt:

domain.com/en/product-name.html

For some reason there is a products with a different structure:

domain.com/en/product-name-en.html

This products has an unique names. Though there is a category with the same name.



Because my CS-Cart3 install became one big mess with many very screwy urls, I am not running any languages yet. First I want to make sure that all products have a logical url.

So there can be no url conflicts. The url mess that cs-cart3 created is also the reason why we are entering thousands of products into a fresh install instead of just importing. I want to get it right this time.



How do I find out what the cause of this is?

And how do I fix this?

Usually CS-Cart adds “-en” to the product name if you try to create two products with the same seo name.

It 'should' work that way. But same as with my cs-cart3 install all products are unique in name and no seo name is entered.

Is there anyway I can trace the issue in the database?

Can a product name conflict with a category name?

in addons>seo try removing check box “show language in url”

You can still import all products from your old install…just change the seo name to what you want in the .csv





John

[quote name='P-Pharma' timestamp='1411608961' post='192823']

It 'should' work that way. But same as with my cs-cart3 install all products are unique in name and no seo name is entered.

Is there anyway I can trace the issue in the database?

Can a product name conflict with a category name?

[/quote]



Check the cscart_seo_names table to find the duplicated URLs. The type column means the object type: p - products, c - categories, e.t.c.

[quote name='johnbol1' timestamp='1411617305' post='192824']

in addons>seo try removing check box “show language in url”

[/quote]

Doesn't that remove the domain.com/en/ part of the url?

Yes, a Page Name, Category Name and Product Name can all end up with the same SEO URL, so there needs to be some way to make them unique: add language at the end like “-en”

To find the objects that are named the same run this query:

[sql]SELECT * FROM cscart_seo_names WHERE name LIKE '%product-name%'[/sql]

You have to change the value between the percent signs to ONLY what the two (or more) URLs have in common.



You may also want to look in the redirects table here:

[sql]SELECT * FROM cscart_seo_redirects WHERE src LIKE '%product-name%'[/sql]

A big pain it is. The logic to prevent duplicate urls does not evaluate the complete url but looks at every single component and starts throwing in language suffixes or numbers. This ought to be re-engineered.



See my comments here

[quote name='Paul John' timestamp='1411655369' post='192855']

A big pain it is. The logic to prevent duplicate urls does not evaluate the complete url but looks at every single component and starts throwing in language suffixes or numbers. This ought to be re-engineered.



See my comments here

[/quote]

I completely agree. Its not just a big pain. Its a serious SEO disadvantage with far reaching effects. A URL mess is poison for SEO, SE influx and sales. The medicine is much more poisonous than the cure here. It is the single most problematic aspect of CS-Cart. I honestly was considering to abandon CS-Cart because of this, but thankfully @ecomlabs posted the code that needs to be removed.