When creating products in Magento 1 the url was created from the product name, and if there were duplicate product names M1 would add a numerical suffix to the end of the URL.
Since it seems this is no longer the case in Magento 2, how do I deal with products with the same name having duplicate URLs and causing an error?
Thanks
Best Answer
Found 2 solutions for that:
url_rewrite
. You can write UpgradeData script for this solution.(Make sure you took the database backup)The second one: Remove the duplication data when saving category. This data is throw in method doReplace($urls) in \vendor\magento\module-url-rewrite\Model\Storage\DbStorage.php file.
After debugging, I found out $data variable has a duplicate record. If you want this method to work without any errors. Rewrite this method above to:
If you want to get more details. Please, read comment in
https://github.com/magento/magento2/issues/7298
Hope this will help you.