Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SEO URL - Categories #2384

Closed
mrtwister76 opened this issue Nov 29, 2014 · 5 comments
Closed

SEO URL - Categories #2384

mrtwister76 opened this issue Nov 29, 2014 · 5 comments

Comments

@mrtwister76
Copy link

Hi,

The way in which SEO URL's are created for category listings has an issue which I believe needs addressing. The problem may also affect other areas, but I haven't yet come across any yet.

If we take two category SEO URL example routes below:

/jackets/men
/hats/men

Lets say the categories above have the following category ID's in the database:

jackets = 1
(jackets/) men = 2
hats = 3
(hats/) men = 4

The above routes are passed to the seo_url.php script which then explodes the URL into separate categories parts (e.g. array(jackets, men).

It then iterates through each part in the array and searches the url_alias table in the database on the 'keyword' field for a matching entry.

So for /jackets/men, it first searches for jackets and gets the 'category_id=1', after which it searches for an entry for 'men' and get the first matching entry 'category_id=2'. It then uses category 2 to form a SQL query to find products in that category and display the results.

Now we go to /hats/men. The script searches for the keyword 'hats' in the table, which returns ID 3, then it searches again for 'men' which again returns category 2, as this is the first match in the table. However, the category we wanted was 4!

There are two issues here:

  1. With the existing structures, we are doing unnecessary searches on the url_alias table. There is no need to search for any category other than the last keyword, and more importantly:
  2. The wrong SQL query is often formed when categories have the same SEO keyword, which is very possible when categories are nested,a s they often are in the real world.

IMHO I think that it would be better to have a flatter structure and simply have entries in the url_alias table that correspond directly to the route in question.

For example:
/hats/men => category_id=4

Alternatively, keeping the existing system would mean tracking the parent of an alias in the url_alias table as well to ensure that the category structure doesn't get broken.

@mrtwister76 mrtwister76 changed the title SEO URL Categories SEO URL - Categories Nov 29, 2014
@mrtwister76
Copy link
Author

Hi Daniel,

Has this been resolved recently?
I was still seeing the issue on the latest master before posting the issue report :(

Thanks

@osworx
Copy link
Contributor

osworx commented Nov 30, 2014

While i know that the current generation of SEO URLs is not perfect, why not using (e.g.) jackets-men (or jackets_men) as keyword?

@mrtwister76
Copy link
Author

Hi osworx,

Thanks for your input, I understand there are ways around the issue :)

I have raised the issue in order to bring it to the attention of the dev team so it can be looked at ;)

It is an issue that I believe will cause much confusion with OC users and can be addressed from a technical standpoint.

The issue effectively means that users can't have a duplicate seo keyword at any level in their category structure, which is not a restriction that most will find acceptable, especially in today’s SEO driven environment.

An additional issue is that there is no warning that a duplicate situation exists, so store owners will be totally unaware that their category listings aren't showing correctly.

I know of no other shopping cart available, that places this kind of restriction on the URL structure.
A table with direct URI to alias mapping would work fine and, for the average store, reduce database queries, as only one MySQL lookup would be required.

Iteratively constructing the URLs would be OK, but if using this method, the application must maintain the category structure, otherwise the results effectively become 'luck of the draw'.

Cheers

@mrtwister76
Copy link
Author

Hi danielkerr,

I'm at a loss as to why this issue has been closed.
Could you provide clarification?

Thanks

@hayden-t
Copy link
Contributor

hayden-t commented Sep 25, 2023

this doesnt have to be a problem, there is no need for categories of different paths to have unique keyword !!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants