Open
Description
Describe the bug
During product import the exception PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'braga-de-talle-alto-grazia-3.html-15' for key 'URL_REWRITE_REQUEST_PATH_STORE_ID' in /Users/wagnert/Workspace_Idea/techdivision/import-cli-simple/vendor/techdivision/import/src/Actions/Processors/AbstractBaseProcessor.php:220
will be thrown
To Reproduce
Steps to reproduce the issue:
- Magento 2.3.5/2.4.0 Instanz, either Community orCommerce, is available in directory
<magento-install-dir>
- The import base directory has been created with
mkdir <magento-install-dir>/var/importexport
- The master branch has been cloned with
git clone [email protected]:techdivision/import-cli-simple.git
into the directory<import-cli-simple-dir>
- The dependencies has been installed with
cd <import-cli-simple-dir> && composer install
- Change back to the Magento install directory by entering the command
cd <magento-install-dir>
- Extract the ZIP archive with the three CSV files with the command
unzip import-product-url-rewrite.zip var/tmp
- Run the first import by invoking the command
cp <magento-install-dir>/var/tmp/product-import_20201009-161909_01.csv var/importexport && import-simple import:create:ok-file && import-simple import:products
which should result in a DB state
- Run the second import by invoking the command
cp <magento-install-dir>/var/tmp/product-import_20201009-161909_02.csv var/importexport && import-simple import:create:ok-file && import-simple import:products
which should result in a DB state
- Run the third import by invoking the command
cp <magento-install-dir>/var/tmp/product-import_20201009-161909_03.csv var/importexport && import-simple import:create:ok-file && import-simple import:products
which will fail with the exception
and should result in the DB state
Artefacts
Expected behavior
The expected result has to be defined.
Additional context
The problem results out of the following facts:
- The first import creates a product with the SKU
24-MB01
and the URL keyjoust-duffle-bag
and creates an URL rewrite therefore - The second import updates the URL key to
joust-duffle-bag-s
because the product name changes and creates a 301 redirect forjoust-duffle-bag
tojoust-duffle-bag-s
- The third import creates a new product with the SKU
24-MB02
that uses the old URL keyjoust-duffle-bag
(because it'll be created from the name) but fails when the importer tries to create the URL rewrites because an URL rewrite with therequest_path: 'joust-duffle-bag'
andstore_id: 0
already exists as 301 for the product of SKU24-MB01
Metadata
Metadata
Assignees
Labels
No labels