How to handle products with variants of variants?

Help for integrating the Laravel package
Forum rules
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Dochr
Posts: 8
Joined: 03 Nov 2021, 17:18

How to handle products with variants of variants?

Post by Dochr » 03 Nov 2021, 20:37

Laravel version: 6.20.35
Aimeos version: 2021.07.6
Php version: 7.4.9
environment: Win

I was looking for a solution on this forum, but did not find an answer.

I want to have several levels of product variants:
Parent: A shirt
Children: Different color versions of a shirt
Grandchildren: Different sizes of a particular color of a shirt

How should I do it?

So far I am able to have only one level:
Parent: A shirt
Children: Different colors and different sizes of a shirt

This is done by having a selection product with variants.
However, when I tried putting a selection product inside selection product, it would not display properly - I can only see children of a parent product, but not grandchildren.


Part of my shop.php file for product import:'

Code: Select all

'controller' => [
		'jobs'=> [
			'product' => [
				'import' => [
					'csv' => [
						'location' => './storage/csv_import',
						'skip-lines' => 1,
						'mapping' => [
							'item' => [
								0 => 'product.code', // product_id
								1 => 'product.label', // UTF-8 encoded text, also used as product name //product_name
								9 => 'product.type', // type of the product, e.g. "default" or "selection"
								3 => 'product.status', // enabled (1) or disabled (0) // in_stock
							],
							'text' => [
								7 => 'text.type', // e.g. "short" for short description //text_type
								2 => 'text.content', // UTF-8 encoded text //description
							],
							'price' => [
								6 => 'price.currencyid', // three letter ISO currency code // currency_id
							],
							'attribute' => [
								11 => 'product.lists.type', // For variant attributes "variant" otherwise "default"
								12 => 'attribute.type', // colour
								5 => 'attribute.code', // colour value
								13 => 'product.lists.type', // For variant attributes "variant"
								14 => 'attribute.type', // size
								4 => 'attribute.code', // size value
							],
							'product' => [
								10 => 'product.code', // for selection - variants separated by newline
							],
							'catalog' => [
								15 => 'catalog.code', // e.g. Unique category code 
								8 => 'catalog.lists.type', // e.g. "promotion" for top seller products //lists_type
							],

Example csv:

Code: Select all

product_id,product_name,description,in_stock,Fashion:size,fa_colours,currency_id,text_type,lists_type,product_type,product.code,product_lists_type,attribute_type,product_lists_type,attribute_type,catalog.code
1122,Red M shirt,Grandchild: Red M shirt,1,M,red,USD,short,default,default,,variant,color,variant,size,home
1133,Red L shirt,Grandchild: Red L shirt,1,L,red,USD,short,default,default,,variant,color,variant,size,home
2222,Blue M shirt,Grandchild: Blue M shirt,1,M,blue,USD,short,default,default,,variant,color,variant,size,home
2233,Blue L shirt,Grandchild: Blue L shirt,1,L,blue,USD,short,default,default,,variant,color,variant,size,home
11,Red shirt,Child: Red shirt,1,,,USD,short,default,select,"1122
1133",default,color,default,size,home
22,Blue Shirt,Child: Blue Shirt,1,,,USD,short,default,select,"2222
2233",default,color,default,size,home
1,Shirt,Parent shirt,1,,,USD,short,default,select,"11
22",default,color,default,size,home

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

Re: How to handle products with variants of variants?

Post by aimeos » 04 Nov 2021, 18:25

Each variant of your selection product must contain all variant attributes, i.e. color and size in your case.
You only need that two levels, not three.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply