Import from csv

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!
wenotine
Posts: 10
Joined: 17 Sep 2016, 15:17

Import from csv

Post by wenotine » 04 Oct 2016, 10:43

Dear Aimeos support, thank you for your excelent job, right now, we need You again :)

We have our csv, where the products are different by size or by color.
---------------------------------------------------------------------
Product code label color size
118391-56 4 Bourke vibrant green 2 size XL
118391-56 5 Bourke vibrant green 2 size XXL
118391-57 4 Bourke pirate black 2 size XL
118391-57 5 Bourke pirate black 2 size XXL
--------------------------------------------------------------------
We use this import:

'mapping'=> array(
'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)

),
'text' => array(
4 => 'text.languageid',
5 => 'text.type', // e.g. "short" for short description
6 => 'text.content', // UTF-8 encoded text
7 => 'text.languageid',
8 => 'text.type', // e.g. "short" for short description
9 => 'text.content', // UTF-8 encoded text
10 => 'text.languageid',
11 => 'text.type', // e.g. "long" for long description
12=> 'text.content', // UTF-8 encoded text
),
'media' => array(
13 => 'media.url', // relative URL of the product image on the server
),
'price' => array(

14 => 'price.currencyid',
15 => 'price.quantity', // the quantity the price is valid from (for block pricing)
16 => 'price.value', // price with decimals separated by a dot, no thousand separator
17 => 'price.rebate',
18 => 'price.taxrate', // tax rate with decimals separated by a dot
),
'stock' => array(
19 => 'product.stock.stocklevel',
20 => 'product.stock.warehouse',
// 2 => 'product.stock.warehouseid',
// 3 => 'product.stock.dateback',
),
'catalog' => array(
21 => 'catalog.code', // e.g. Unique category code
// 21 => 'catalog.list.type', // e.g. "promotion" for top seller products
),
'attribute' => array(
22 => 'attribute.typeid',
23 => 'attribute.type',
24 => 'attribute.code',
25 => 'attribute.label',
26 => 'attribute.position',
27 => 'attribute.status',
28 => 'attribute.typeid',
29 => 'attribute.type',
30 => 'attribute.code',
31 => 'attribute.label',

),
)
--------------------------------------------------------------------
My question is:

How can we have a base product and plus four variant?

- we need a base product with short and long description, price etc. (No. zero line in the csv)
- and we need 4 variants
first variant: color: vibrant green, size: XL
second: variant: color: vibrant green, size: XXL
third: variant: color: pirate black, size: XL
fourth: variant: color: pirate black, size: XXL

Please let me know what to do.

Thank you

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

Re: Import from csv

Post by aimeos » 04 Oct 2016, 16:20

First, add a product line with product item type "selection" to your CSV file and add the texts too. Then, add four product list of type "default" (articles) to the CSV file, which also contains the variant attributes. Configure your mapping to assign the attributes with product.list.type "variant" and to assign the articles to the selection product via the unique product.code for the selection product.

In your mapping, you need for the "attribute" section a column for the product.list.type (value: "variant") and another section named "product" with the product code of the selection product the article belongs to. Remove the "attribute.typeid" column and it's mapping because you already have "attribute.type".
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

George Horvath
Posts: 11
Joined: 01 Oct 2016, 10:54

Re: Import from csv

Post by George Horvath » 05 Oct 2016, 10:13

aimeos wrote:First, add a product line with product item type "selection" to your CSV file and add the texts too. Then, add four product list of type "default" (articles) to the CSV file, which also contains the variant attributes. Configure your mapping to assign the attributes with product.list.type "variant" and to assign the articles to the selection product via the unique product.code for the selection product.

In your mapping, you need for the "attribute" section a column for the product.list.type (value: "variant") and another section named "product" with the product code of the selection product the article belongs to. Remove the "attribute.typeid" column and it's mapping because you already have "attribute.type".
Hi mr Aimeos!
Thanks for answer!
Wwe modified our mapping by your advice like this:

Code: Select all

'mapping'=> array(
                        '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)
                                
                              
                        ),
                        'text' => array(
                                4 => 'text.languageid',
                                5 => 'text.type', // e.g. "short" for short description
                                6 => 'text.content', // UTF-8 encoded text
                                7 => 'text.languageid',
                                8 => 'text.type', // e.g. "short" for short description
                                9 => 'text.content', // UTF-8 encoded text
                                10 => 'text.languageid',
                                11 => 'text.type', // e.g. "long" for long description
                                12=> 'text.content', // UTF-8 encoded text
                        ),
                        'media' => array(
                                13 => 'media.url', // relative URL of the product image on the server
                        ),
                        'price' => array(
                                
                                14 => 'price.currencyid',   
                                15 => 'price.quantity', // the quantity the price is valid from (for block pricing)
                                16 => 'price.value', // price with decimals separated by a dot, no thousand separator
                                17 => 'price.rebate',
                                18 => 'price.taxrate', // tax rate with decimals separated by a dot                           
                        ),
                        'stock' => array(
                                19 => 'product.stock.stocklevel',
                                20 => 'product.stock.warehouse',
                        ),
                        'catalog' => array(
                                21 => 'catalog.code', // e.g. Unique category code
                        ),
                        'attribute' => array(
                               
                                22 => 'attribute.type',
                                23 => 'attribute.code',
                                24 => 'attribute.label',
                                25 => 'attribute.position',
                                26 => 'attribute.status',

                                27 => 'attribute.type',
                                28 => 'attribute.code',
                                29 => 'attribute.label',
                                30 => 'product.list.type',//variant?
                        ),
                        'product' => array(
                                
                                31 => 'product.code', // e.g. EAN code of another product                             
                        ),
                    )
And the modified csv is:
(there are a select product in the first line with texts and main parameters and price, and 2 variant for now with different size types with same color attributes and different stock levels)

Code: Select all

"118391-298756",Bourke,select,1,hu,name,Bourke,hu,short,"Fundango, 100% poliészter vízálló, lélegző alapanyagú levehető kapucnis kabát hegesztett varratokkal a kritikus helyeken. Laminált zsebfedős zsebekkel, belső zsebbel, szemüveg tartó zsebbel, hófogóval. Szellőző kialakítással. Cipzárral rögzíthető a nadrágokhoz.",hu,long,"Fundango, 100% poliészter vízálló, lélegző alapanyagú levehető kapucnis kabát hegesztett varratokkal a kritikus helyeken. Laminált zsebfedős zsebekkel, belső zsebbel, szemüveg tartó zsebbel, hófogóval. Szellőző kialakítással. Cipzárral rögzíthető a nadrágokhoz.",http://www.dockyard.hu/media/catalog/product/1/Q/1QL102_538_1_1.jpg,HUF,1,19990,17000,27,,default,m-coats,,,,,,,,
"118391-298756 2","Bourke green",default,1,hu,name,"Bourke green",,,,,,,,,,,,,4,default,m-coats,color,538,"vibrant green",size,XXL,XXL,variant,"118391-298756"
"118391-298756 3","Bourke green",default,1,hu,name,"Bourke green",,,,,,,,,,,,,2,default,m-coats,color,538,"vibrant green",size,XL,XL,variant,"118391-298756"
Unfortunatelly this doent work: the selection product done (we can see in admin too) but its stopping on 2nd line with error while importing and there inst any other product or variation.

We tried to delete the name and label from variants but doesnt work too (name can be same too but somehow we have to different them in the admin)
My question is aour mapping are good? and what we had wrong on the csv file?

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

Re: Import from csv

Post by aimeos » 05 Oct 2016, 21:45

What's the error that occurs?
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

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

Re: Import from csv

Post by aimeos » 05 Oct 2016, 21:54

Position 25 and 26 of your mapping are definitively wrong according to your CSV file:

Code: Select all

25 => 'attribute.position',
26 => 'attribute.status',
If color is also something that can have different values, then there should be a "variant" column and a product.lists.type mapping too.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

George Horvath
Posts: 11
Joined: 01 Oct 2016, 10:54

Re: Import from csv

Post by George Horvath » 07 Oct 2016, 14:18

aimeos wrote:Position 25 and 26 of your mapping are definitively wrong according to your CSV file:

Code: Select all

25 => 'attribute.position',
26 => 'attribute.status',
If color is also something that can have different values, then there should be a "variant" column and a product.lists.type mapping too.

Hi thank you for answer!
-we get steps forward but we have question to finish our importer.

Our modified mapping is here:

Code: Select all

'mapping' => array(
                            'item' => array(
                                0 => 'product.list.type',//variant?  
                                1 => 'product.code', // e.g. unique product code from erp
                                2 => 'product.label', // UTF-8 encoded text, also used as product name (common in variants)
                                3 => 'product.type', // type of the product, e.g. "default" or "selection" 
                                4 => 'product.status', // enabled (1) or disabled (0)
                            ),
                            'text' => array(
                                5 => 'text.languageid',//(common in variants)
                                6 => 'text.type', // e.g. "short" for short description(common in variants)
                                7 => 'text.content', // UTF-8 encoded text(common in variants)
                                8 => 'text.languageid',//(common in variants)
                                9 => 'text.type', // e.g. "short" for short description(common in variants)
                                10 => 'text.content', // UTF-8 encoded text(common in variants)
                                11 => 'text.languageid',//(common in variants)
                                12 => 'text.type', // e.g. "long" for long description(common in variants)
                                13 => 'text.content', // UTF-8 encoded text(common in variants)
                            ),
                            'media' => array(
                                14 => 'media.url', // relative URL of the product image on the server
                            ),
                            'price' => array(
                                15 => 'price.currencyid',//(common in variants)
                                16 => 'price.quantity', // the quantity the price is valid from (for block pricing)(common in variants)
                                17 => 'price.value', // price with decimals separated by a dot, no thousand separator (common in variants)
                                18 => 'price.rebate',// (common in variants)
                                19 => 'price.taxrate', // tax rate with decimals separated by a dot  (common in variants)                          
                            ),
                            'stock' => array(
                                20 => 'product.stock.stocklevel', // (various in variants)
                                21 => 'product.stock.warehouse', //(common in variants)
                            ),
                            'attribute' => array(
                                22 => 'product.list.type',//variant?  
                                23 => 'attribute.type',//(common in variants)
                                24 => 'attribute.code',// (various in variants)
                                25 => 'attribute.label',// (various in variants)
                                //25 => 'attribute.position',
                                // 26 => 'attribute.status',
                                26 => 'product.list.type', //variant?    
                                27 => 'attribute.type',//(common in variants)
                                28 => 'attribute.code',// (various in variants)
                                29 => 'attribute.label',// (various in variants)
                            ),
                            'product' => array(
                                30 => 'product.list.type', //variant?  
                                31 => 'product.code', // e.g. EAN code of another product                             
                            ),
                            'catalog' => array(
                                32 => 'catalog.code',//(common in variants) 
                                33 => 'catalog.code',//(common in variants)
                                34 => 'catalog.code',//(common in variants)
                                35 => 'catalog.code',//(common in variants)
                                36 => 'catalog.code',//(common in variants)
                                37 => 'catalog.code',//(common in variants)
                            ),
                            'property' => array(
                                38 => 'product.property.type',//anyagosszetetel//(common in variants)
                                39 => 'product.property.value',//(common in variants)
                                40 => 'product.property.type',//cikkszam//(common in variants)
                                41 => 'product.property.value',   //(common in variants)                           
                        ),
                        )
and our csv file is(simplified data):

Code: Select all

,1QL102,Bourke,select,1,hu,name,Bourke,hu,short,"short text",hu,long,"long product text",path/to/image1.jpg,HUF,1,19990,17000,27,,default,,,,,,,,,,,man,1-si-es-snowboard-kabat,,,,,anyagosszetetel,"100% poliészter",cikkszam,1QL102
,118391-298756-4,Bourke,default,1,,,,,,,,,,path/to/image2.jpg,,,,,,3,default,variant,color,538,"vibrant green",variant,size,XL,XL,,1QL102,,,,,,,,,,
,118391-298756-5,Bourke,default,1,,,,,,,,,,path/to/image3.jpg,,,,,,4,default,variant,color,538,"vibrant green",variant,size,XXL,XXL,,1QL102,,,,,,,,,,
,118391-298757-4,Bourke,default,1,,,,,,,,,,path/to/image4.jpg,,,,,,9,default,variant,color,893,"pirate black",variant,size,XL,XL,,1QL102,,,,,,,,,,
after import products like this:
Image

So the products are in the database but products dosnt have connections to selection product.

From the other way The selection product doesnt have any variations.

I think i misunderstood something.
As you can see in the csv I tried to create a selection product in the first line how You said before, then i trying to import 3 lines with 3 variation of the selection product what was in the first line.

How can I fix this issue?

Second question is how can I add a variation to any existing selection product to the catalog by csvImport?
Attachments
csv imported products in extadm screenshot1
csv imported products in extadm screenshot1
csvimp1.jpg (179.44 KiB) Viewed 5128 times

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

Re: Import from csv

Post by aimeos » 07 Oct 2016, 15:20

You should remove the first column and the first entry in the mapping (product.lists.type) because it's wrong there. You main problem is column 30 because it contains no value. Either you remove the column and it's mapping or you fill it with the value "default".
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

michal.fehér
Posts: 44
Joined: 05 Feb 2018, 09:57

Re: Import from csv

Post by michal.fehér » 19 Feb 2018, 18:23

I am having the same problem.

What me and Goerge were trying to accomplish is to
1. define a selection (unique ID "SEL123")
2. define all articles (default products) and link these articles with previously defined selection by mentioning a unique ID where these articles belongs to ("SEL123" in this case)

your examples use different logic. you first define all the articles and then you define selection and list all the article IDs that belongs to this selection.

and what I think is closer to the "real world" is what we are trying to do. usually you want to link children to the parent by providing parentID to all children. and not providing all children ID in one parent.

can you give us example how can we get this to work?

thanks.

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

Re: Import from csv

Post by aimeos » 19 Feb 2018, 22:51

You would have to implement a new import processor, e.g. named "selection" that is similar to the existing "product" one but does the reverse: Not linking articles to a selection product but looking up the selection product and create a link to the current article.

https://github.com/aimeos/ai-controller ... andard.php
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

michal.fehér
Posts: 44
Joined: 05 Feb 2018, 09:57

Re: Import from csv

Post by michal.fehér » 20 Feb 2018, 15:41

Thanks for the suggestion, I did and it works now.

Post Reply