magento2-regenerate_url_rewrites icon indicating copy to clipboard operation
magento2-regenerate_url_rewrites copied to clipboard

Wrong product URL rewrites in Multistore setting

Open mtjweb opened this issue 4 years ago • 2 comments

Describe the bug The generated URL's are generated from the default product name instead of the name in the scope.

Expected behavior Correct URL generated from the product name in the scope.

To Reproduce Use the command "php bin/magento ok:urlrewrites:regenerate" to generate new URL's. Check the products in the frontend, they are useing the default URL rewrite Check the URL-key when editing a product in, there you see the correct URL rewrite Check the url_rewrite table, the URL-keys are not in the table. Just the default URL rewrites.

Magento version 2.3.5-p1 Module version 1.5.6

mtjweb avatar Aug 05 '20 16:08 mtjweb

I had the same problem.

Add setStoreId to categoryCollection

Model/RegenerateCategoryRewrites.php:253 $categoriesCollection->addAttributeToSelect('name') ->setStoreId($storeId)

mvenghaus avatar Aug 18 '20 06:08 mvenghaus

I solved it by adding 2 lines. And before generating, I also had to set the following setting. I don't use the cli command so it was no problem to set the setting.

$this->regenerateCategoryRewrites->regenerateOptions['noRegenUrlKey'] = true;

Here's my patch: https://gist.github.com/mvenghaus/1aba55b6fb6965fadd42c594414c9f88

mvenghaus avatar Sep 14 '20 10:09 mvenghaus