CSV Product Import not working

How to configure and adapt Aimeos based shops as developer
Forum rules
Always add your Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Innonic
Posts: 43
Joined: 24 Nov 2015, 21:03

Re: CSV Product Import not working

Post by Innonic » 09 Oct 2017, 11:19

aimeos wrote:We've updated the product CSV file and the required mapping in the Wiki:
https://aimeos.org/docs/Developers/Cont ... lt_mapping
Thank you for this information. I updated my mapping and the CSV but I keep getting this error:

Code: Select all

Not imported: Array(    
[0] => job_csv_test
[1] => job csv test product
[2] => default
[3] => 1
)

Not imported: Array(
[0] => job_csv_test2
[1] => job csv test 2. product
[2] => select
[3] => 1
)
What is that message supposed to tell me except there's no import?

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

Re: CSV Product Import not working

Post by aimeos » 10 Oct 2017, 10:16

Your mapping is still not correct for the example file. You need exactly the same mapping as described in the documentation: https://aimeos.org/docs/Developers/Cont ... lt_mapping

Also, make sure that you've configured https://aimeos.org/docs/Configuration/C ... skip-lines with value "1" to skip the first line as stated in the docs because in the example file this is the header line.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Innonic
Posts: 43
Joined: 24 Nov 2015, 21:03

Re: CSV Product Import not working

Post by Innonic » 10 Oct 2017, 12:09

I wrote, that I adapted the mapping:

Code: Select all

plugin.tx_aimeos {
settings {
controller.jobs.product.import.csv {
location = [...]/fileadmin/import
mapping {
item {
0 = product.code
1 = product.label
2 = product.type
3 = product.status
}
text {
4 = text.type
5 = text.content
6 = text.type
7 = text.content
}
media {
8 = media.url
}
price {
9 = price.currencyid
10 = price.quantity
11 = price.value
12 = price.taxrate
}
attribute {
13 = attribute.code
14 = attribute.type
}
product {
15 = product.code
16 = product.lists.type
}
property {
17 = product.property.value
18 = product.property.type
}
catalog {
19 = catalog.code
20 = catalog.lists.type
}
}
}
}
}
And from the beginning on, I deleted the first line in the CSV, which means I don't have to skip it. This is my complete CSV:

Code: Select all

"job_csv_test","job csv test product","default",1,"short","short description","long","long description","[...]/fileadmin/import_img/spice-2546147.jpg","EUR",1,"10.00","20.00","import-test","size",,,"1.50","package-weight","home","promotion"
"job_csv_test2","job csv test 2. product","select",1,"short","short selection description","long","long selection description","[...]/fileadmin/import_img/spice-2546147.jpg","EUR",1,"10.00","20.00",,,"job_csv_test","default","1.50","package-weight",,
So these two reasons are not responsible or did I do something wrong here?

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

Re: CSV Product Import not working

Post by aimeos » 10 Oct 2017, 20:11

Hm, both look OK and I ran a successful CSV file import with the same mapping and file (dev-master in my case).
Are the "Not imported: Array( ... )" messages the only error in the madmin_log table?
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Innonic
Posts: 43
Joined: 24 Nov 2015, 21:03

Re: CSV Product Import not working

Post by Innonic » 10 Oct 2017, 21:03

Yes, these are the only error messages after running the import task.

Maybe, as additional info:
I'm using Typo3 6.2.15 and Aimeos 16.10.5.
Could I have a problem with these versions?

I see, there's an update. Do I have to run it? Can I do that without any risk?

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

Re: CSV Product Import not working

Post by aimeos » 11 Oct 2017, 22:38

TYPO3 6.2.15 is extremely old and there's no support any more for this version. You should upgrade nevertheless to avoid security breaches. For updating Aimeos it depends how much you customized the shop. Version 2017.x has some incompatible changes to 2016.10.5 so your required time may vary.

We've tried to import the two CSV lines using your mapping. It worked, even if the logs contain the two "Not imported" messages ...
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

vishal_thakur
Posts: 13
Joined: 28 Jul 2021, 11:59

Re: CSV Product Import not working

Post by vishal_thakur » 28 Jul 2021, 12:44

Innonic wrote: 05 Oct 2017, 20:09 After reading through this and other threads again and again I came to the conclusion that it MUST be the path that is wrong. So I checked with my provider and indeed, for the cronjobs I had to use an absolute path I hadn't tried yet.
I'm so sorry for bothering you with that, but I had no clue. The experience is growing and hopefully I won't bother you again with such dumb stuff.

So I got a step further and now I get at least some error messages like:

Code: Select all

Unable to import product with code "job_csv_test": No type item for "product/import-test" in "attribute/type" found
Unable to import product with code "job_csv_test2": Executing statement "
			INSERT INTO "mshop_price" (
				"siteid", "typeid", "currencyid", "domain", "label",
				"quantity", "value", "costs", "rebate", "taxrate", "status",
				"mtime", "editor", "ctime"
			) VALUES (
				1, '3', NULL, 'product', ' 10.00', 1, '10.00', '0.00', '0.00', '20.00', 1, '2017-10-05 22:20:04', 'scheduler', '2017-10-05 22:20:04'
			)
		" failed: SQLSTATE[23000]: Integrity constraint violation: 1048 Column 'currencyid' cannot be null
Shouldn't that work with your example file? Maybe I can figure out the problem myself now, but your help would be appreciated.

can i know, how you are importing the product from csv file?
for example ::
here is my csv file location : aimeos-project/tmp/products-import-example.csv
do we need to execute any controller function to import this file?
here is the screenshot where i have execute command ==>
php aimeos1/tmp/products-import-example.csv aimeos:jobs "product/import/csv"
in server : https://prnt.sc/1h2dhw1

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

Re: CSV Product Import not working

Post by aimeos » 29 Jul 2021, 05:23

Required configuration in your ./config/shop.php:

Code: Select all

'controller' => [
	'jobs' => [
		'product' => [
			'import' => [
				'csv' => [
					'location' => basepath( 'tmp' )
				]
			]
		]
	]
],
See here for reference:
- https://aimeos.org/docs/2021.x/config/c ... /#location
- https://aimeos.org/docs/2021.x/cronjobs ... and-format

Command you need to execute:

Code: Select all

php artisan aimeos:jobs "product/import/csv"
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

vishal_thakur
Posts: 13
Joined: 28 Jul 2021, 11:59

Re: CSV Product Import not working

Post by vishal_thakur » 29 Jul 2021, 06:14

after adding file location in ./config/shop.php file
i'm getting this error : Could not open input file: aimeos:jobs
https://prnt.sc/1hgvass

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

Re: CSV Product Import not working

Post by aimeos » 29 Jul 2021, 06:33

Sorry, the correct command is:

Code: Select all

php artisan aimeos:jobs "product/import/csv"
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply