Magento 2 extension which add feature of regenerating a url rewrites of products/categories
Academic Free License v3.0
430
stars
118
forks
source link
Duplicate error on multi-store sites with same category trees #109
Closed
nige-one closed 4 years ago
I found a bug when regenerating URLs on a multi-store instance. In https://github.com/olegkoval/magento2-regenerate_url_rewrites/blob/8bc3974be85bc6cb6d44002f41810a986f9e9045/Console/Command/RegenerateUrlRewritesCategoryAbstract.php#L187 you build a query to avoid problematic ->setStoreId (didn't test that). On multi-site setups this leads to a multi-row result, while the following https://github.com/olegkoval/magento2-regenerate_url_rewrites/blob/8bc3974be85bc6cb6d44002f41810a986f9e9045/Console/Command/RegenerateUrlRewritesCategoryAbstract.php#L189 will only return the first found entry. This means that url rewrites can already exist if two stores belong to the same website.
By changing this from https://github.com/olegkoval/magento2-regenerate_url_rewrites/blob/8bc3974be85bc6cb6d44002f41810a986f9e9045/Console/Command/RegenerateUrlRewritesCategoryAbstract.php#L187
to
it works fine.
Thanks for your great module!