Page 1 of 1

Product Import - How to import "selection" products?

Posted: 09 Aug 2018, 10:35
by mohal_04
PHP: 7.1.18
Laravel: 5.6
Aimeos: 2018.04

Hi,

I followed "Import products from CSV" link (given below) and imported all products. Link:

https://aimeos.org/docs/Developers/Cont ... s_from_CSV

But it turned out that I am dealing with Parent-child products, which are "Selection" products in Aimeos (I think). So, the question is, how I import products (of all types), choose product type, and associate child products?

I know I can set "product.type" key in "item" array to "selection" but how choose which products are "variants?" This has to be done during CSV read.

Code: Select all

'item' => array(
		0 => 'product.code', // e.g. unique EAN code
		1 => 'product.label', // UTF-8 encoded text, also used as product name
		2 => 'product.type', // type of the product, e.g. "default" or "selection"
		3 => 'product.status', // enabled (1) or disabled (0)
	),
Please, help!

Thanks!

Re: Product Import - How to import "selection" products?

Posted: 10 Aug 2018, 19:21
by aimeos
The default mapping listed here contains the "product" section (line 27):
https://aimeos.org/docs/Developers/Cont ... lt_mapping

If the "product.lists.type" is "default", all values (separated by new line) in the column for "product.code" are the articles that belong the to selection product. The articles must be imported before the selection product to make this work. The example file linked in the documentation contains an example (2nd line is an article, 3rd line is a selection product -> see column with label "subproduct code"):

Code: Select all

"item code","item label","item type","item status","text type","text content","text type","text content","media url","price currencyid","price quantity","price value","price tax rate","attribute code","attribute type","subproduct code","product list type","property value","property type","catalog code","catalog list type"
"job_csv_test","job csv test product","default",1,"short","short description","long","long description","path/to/image.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","path/to/image2.jpg","EUR",1,"10.00","20.00",,,"job_csv_test","default","1.50","package-weight",,

Re: Product Import - How to import "selection" products?

Posted: 14 Aug 2018, 07:43
by mohal_04
aimeos wrote:The default mapping listed here contains the "product" section (line 27):
https://aimeos.org/docs/Developers/Cont ... lt_mapping

If the "product.lists.type" is "default", all values (separated by new line) in the column for "product.code" are the articles that belong the to selection product. The articles must be imported before the selection product to make this work. The example file linked in the documentation contains an example (2nd line is an article, 3rd line is a selection product -> see column with label "subproduct code"):

Code: Select all

"item code","item label","item type","item status","text type","text content","text type","text content","media url","price currencyid","price quantity","price value","price tax rate","attribute code","attribute type","subproduct code","product list type","property value","property type","catalog code","catalog list type"
"job_csv_test","job csv test product","default",1,"short","short description","long","long description","path/to/image.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","path/to/image2.jpg","EUR",1,"10.00","20.00",,,"job_csv_test","default","1.50","package-weight",,
Hi,

Thanks for the help! It worked. But it should be little advanced. For example if child products comes after parent product then this should work. Anyhow, I have another question. If you go to Import Product via CSV documentation, it has a section on Media:

https://aimeos.org/docs/Developers/Cont ... _CSV#Media

Now if I have more than 1 media URLs then how I shall tackle that in CSV?

Please, reply!

Thanks!

Re: Product Import - How to import "selection" products?

Posted: 15 Aug 2018, 14:35
by aimeos
The articles must come first because you need them to be added to your database so you can access their ID which needs to be associated to your selection product.

You can add several media URLs by listing them in the same field of the CSV separated by new lines (\n)

Re: Product Import - How to import "selection" products?

Posted: 16 Aug 2018, 05:34
by mohal_04
aimeos wrote:The articles must come first because you need them to be added to your database so you can access their ID which needs to be associated to your selection product.

You can add several media URLs by listing them in the same field of the CSV separated by new lines (\n)
Hi,

Yes yes, I totally understand the hierarchy. Child products have to be added before Parent product but we can have product cache/temp table to store Parent products in this scenario until their children are not added. Well, let us drop this argument. You guys are experts.

Anyhow, I love the idea for multiple images and how I can separate them with "New line." Now, I shall go one step further. Is there a way I can store media images locally while importing products?

Please, reply!

Thanks!

Re: Product Import - How to import "selection" products?

Posted: 16 Aug 2018, 08:18
by aimeos
mohal_04 wrote: Anyhow, I love the idea for multiple images and how I can separate them with "New line." Now, I shall go one step further. Is there a way I can store media images locally while importing products?
That's up to you. The CSV file only contains relative URLs to the images and you can store the images on you local server for sure. The easiest way ist to store them somewhere in your ./<app>/public/ directory.

Re: Product Import - How to import "selection" products?

Posted: 16 Aug 2018, 08:48
by mohal_04
aimeos wrote:
mohal_04 wrote: Anyhow, I love the idea for multiple images and how I can separate them with "New line." Now, I shall go one step further. Is there a way I can store media images locally while importing products?
That's up to you. The CSV file only contains relative URLs to the images and you can store the images on you local server for sure. The easiest way ist to store them somewhere in your ./<app>/public/ directory.
OK thanks! :)