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

feat(21): added Support generating uniq URL keys for same url-keys pr… #25

Closed
wants to merge 2 commits into from
Closed

feat(21): added Support generating uniq URL keys for same url-keys pr… #25

wants to merge 2 commits into from

Conversation

nickshatilo
Copy link

Referencing to the #21 issue, added support of adding -1, -2 keys to the URL keys in terms of they are duplicated.

Copy link

@amenk amenk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made some comments, please check

$occurrences = array_count_values($urlKeys);
$occurrencesIndex = [];

foreach ($urlKeys as $rowIndex => $urlKey) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this really work? I think if a product A and B have the same name / url key I guess it is working. But only if A and B are imported in the same batch.
If A is already in the database, and B is imported now, would it work?

Instead of increasing occurences I would also be okay to use something like the product's SKU ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@amenk Actually... I think it's much better to use SKU here, cause they are unique and the order / being imported or not doesn't matter. Will change that to SKU now, and it will cover all the cases.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually you need to use the URL-sanitized SKU. which causes the problem, that if two SKUs result in the same URL part, again we have to use -1 -2 ...
SKU A = foobar
SKU B = fòòbar
Product names the same
URL A = name-foobar
URL B = name-foobar

hmm...

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@amenk So.. How can we resolve that then?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it possible to use the product-ID at this point?
I mean, it's an edge case of the edge case so it might be good enough for now

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@avstudnitz what do you suggest?

etc/module.xml Show resolved Hide resolved
@amenk
Copy link

amenk commented Nov 8, 2018

You are making your change per-bunch ... I think if a URL key is duplicated across 2 bunches, the fix will no longer work

@sprankhub sprankhub closed this Apr 13, 2021
@sprankhub sprankhub deleted the branch firegento:master April 13, 2021 20:03
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

Successfully merging this pull request may close these issues.

3 participants