aimeos / ai-controller-jobs

Aimeos e-commerce job controllers
https://aimeos.org
GNU Lesser General Public License v3.0
112 stars 17 forks source link

CSV import cannot import attributes #37

Closed Ameeko closed 2 years ago

Ameeko commented 2 years ago

CSV Import cannot import attribute columns

With this mapping, none of the products will be imported:

. . . 'price' => [ 11 => 'price.currencyid', 12 => 'price.quantity', 13 => 'price.value', 14 => 'price.taxrate', ], 'attribute' => [ 15 => 'attribute.code', 16 => 'attribute.type', 17 => 'attribute.code', 18 => 'attribute.type', ], 'property' => [ 19 => 'product.property.value', 20 => 'product.property.type', 21 => 'product.property.value', 22 => 'product.property.type', 23 => 'product.property.value', 24 => 'product.property.type', ], . . .

This error message appears in the log for all products: Unable to import product: Invalid type "Size" (attribute) Unable to import product: Invalid type "Type" (attribute)

With this mapping, all products are imported without error:

. . . 'price' => [ 11 => 'price.currencyid', 12 => 'price.quantity', 13 => 'price.value', 14 => 'price.taxrate', ], 'property' => [ 15 => 'product.property.value', 16 => 'product.property.type', 17 => 'product.property.value', 18 => 'product.property.type', 19 => 'product.property.value', 20 => 'product.property.type', 21 => 'product.property.value', 22 => 'product.property.type', 23 => 'product.property.value', 24 => 'product.property.type',

] . . .

But in this case, columns 15-18 will be properties.

Where's my fault?

15-18 colums data example:

Column15: '48' Column16: 'Size' Column17: 'MTB' Column18: 'Type'

Import command:

php artisan aimeos:jobs product/import/csv default

aimeos commented 2 years ago

You need to create the allowed/used attribute types first before you import the products.

Ameeko commented 2 years ago

Thanks for the reply! In the documentation I found "if an attribute doesn't exist, it will be created automatically" https://aimeos.org/docs/latest/cronjobs/product-csv-import/#attribute Maybe I misunderstood something. I'll try what you suggested. Thanks for the help.

aimeos commented 2 years ago

Attributes will be created automatically but not attribute types.