Product CSV Import - Error when update a product

Questions around the TYPO3 integration and plugins
Forum rules
Always add your TYPO3, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Moritz
Advanced
Posts: 153
Joined: 07 Nov 2018, 14:05

Product CSV Import - Error when update a product

Post by Moritz » 12 Jan 2023, 11:04

When I want to update an existing product via the CSV import I get the following error.

import_error.png
import_error.png (16 KiB) Viewed 12684 times
Ubuntu 22.04.01
PHP 7.4.30
Typo3 v11.5.21 LTS
Aimeos web shop 22.10.4-pre3

User avatar
aimeos
Administrator
Posts: 7866
Joined: 01 Jan 1970, 00:00

Re: Product CSV Import - Error when update a product

Post by aimeos » 13 Jan 2023, 11:01

Seems like you've added a category twice to a product
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Moritz
Advanced
Posts: 153
Joined: 07 Nov 2018, 14:05

Re: Product CSV Import - Error when update a product

Post by Moritz » 16 Jan 2023, 08:24

The product in my screenshot with code "MC_8_038876" already exists.
Is it then correct that the category is inserted again in mshop_product_list via INSERT?
Ubuntu 22.04.01
PHP 7.4.30
Typo3 v11.5.21 LTS
Aimeos web shop 22.10.4-pre3

User avatar
aimeos
Administrator
Posts: 7866
Joined: 01 Jan 1970, 00:00

Re: Product CSV Import - Error when update a product

Post by aimeos » 17 Jan 2023, 15:28

If the product is already in the database, it should be updated only including adding/replacing catalog relations. The "catalog" domain is fetched by the product importer:
https://github.com/aimeos/ai-controller ... er.php#L10
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Moritz
Advanced
Posts: 153
Joined: 07 Nov 2018, 14:05

Re: Product CSV Import - Error when update a product

Post by Moritz » 18 Jan 2023, 10:04

I've debugged the import.
Here is the $listItem that throws the exception.
The ID is set to null.
In the next line when you call $listManager->save() the Exception occurs.
Attachments
copy_created.png
copy_created.png (110.88 KiB) Viewed 12624 times
Ubuntu 22.04.01
PHP 7.4.30
Typo3 v11.5.21 LTS
Aimeos web shop 22.10.4-pre3

User avatar
aimeos
Administrator
Posts: 7866
Joined: 01 Jan 1970, 00:00

Re: Product CSV Import - Error when update a product

Post by aimeos » 18 Jan 2023, 10:16

What is the ID of the product item and the parent ID of the list item in your case?
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Moritz
Advanced
Posts: 153
Joined: 07 Nov 2018, 14:05

Re: Product CSV Import - Error when update a product

Post by Moritz » 18 Jan 2023, 10:20

IDs.png
IDs.png (2.69 KiB) Viewed 12619 times
Ubuntu 22.04.01
PHP 7.4.30
Typo3 v11.5.21 LTS
Aimeos web shop 22.10.4-pre3

User avatar
aimeos
Administrator
Posts: 7866
Joined: 01 Jan 1970, 00:00

Re: Product CSV Import - Error when update a product

Post by aimeos » 18 Jan 2023, 10:31

The root cause of the problem is probably in these lines because a new list item seems to be created instead of the existing one reused:
https://github.com/aimeos/ai-controller ... #L136-L137

Please check if the product item fetched from the database contains list items for the catalog relations at all.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Moritz
Advanced
Posts: 153
Joined: 07 Nov 2018, 14:05

Re: Product CSV Import - Error when update a product

Post by Moritz » 18 Jan 2023, 11:13

Seems to be missing.

missing_catalog.png
missing_catalog.png (96.95 KiB) Viewed 12612 times
Ubuntu 22.04.01
PHP 7.4.30
Typo3 v11.5.21 LTS
Aimeos web shop 22.10.4-pre3

User avatar
aimeos
Administrator
Posts: 7866
Joined: 01 Jan 1970, 00:00

Re: Product CSV Import - Error when update a product

Post by aimeos » 19 Jan 2023, 13:53

Did you overwrite this setting somewhere?
https://github.com/aimeos/ai-controller ... php#L3-L20

When using TypoScript, overwriting of the keys is enough to overwrite all child settings.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply