2019-01-25 11:48
浏览 187

Magento 2 URL重写问题:指定商店已存在URL密钥

I am facing this issue while saving a product programmatically on Magento 2.2.5

In any module, if I do $product->save(); OR $this->productRepository->save($product); inside a loop for multiple products. I get:

PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'the-lipstick.html-1' for key 'URL_REWRITE_REQUEST_PATH_STORE_ID' in /home/dev3/www/vendor/magento/zendframework1/library/Zend/Db/Statement/Pdo.php:228

The error is similar to the one described here : https://www.human-element.com/url-key-specified-store-already-exists-magento-2/

Products save fine with admin area login.

Any suggested fixes so far including the ones modifying the core files (DBStorage.php) do not work on 2.2.5.

What I tried so far: 1. Fix from https://www.human-element.com/url-key-specified-store-already-exists-magento-2/ 2. Fix from https://magento.stackexchange.com/questions/210359/magento-2-product-url-rewrite-issue

Please suggest a solution/fix for M 2.2.5

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

3条回答 默认 最新

相关推荐 更多相似问题