Product Import - How to import "selection" products?

Help for integrating the Laravel package
Forum rules
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
mohal_04
Advanced
Posts: 108
Joined: 27 Mar 2018, 05:59

Product Import - How to import "selection" products?

Post by mohal_04 » 09 Aug 2018, 10:35

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!

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

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

Post by aimeos » 10 Aug 2018, 19:21

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",,
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

mohal_04
Advanced
Posts: 108
Joined: 27 Mar 2018, 05:59

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

Post by mohal_04 » 14 Aug 2018, 07:43

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!

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

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

Post by aimeos » 15 Aug 2018, 14:35

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)
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

mohal_04
Advanced
Posts: 108
Joined: 27 Mar 2018, 05:59

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

Post by mohal_04 » 16 Aug 2018, 05:34

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!

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

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

Post by aimeos » 16 Aug 2018, 08:18

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.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

mohal_04
Advanced
Posts: 108
Joined: 27 Mar 2018, 05:59

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

Post by mohal_04 » 16 Aug 2018, 08:48

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! :)

Post Reply