-
Notifications
You must be signed in to change notification settings - Fork 27
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
feat(21): added Support generating uniq URL keys for same url-keys pr… #25
Conversation
There was a problem hiding this 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) { |
There was a problem hiding this comment.
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 ?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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...
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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?
You are making your change per-bunch ... I think if a URL key is duplicated across 2 bunches, the fix will no longer work |
Referencing to the #21 issue, added support of adding -1, -2 keys to the URL keys in terms of they are duplicated.