Page 1 of 1

Product attributes

Posted: 05 Oct 2017, 09:09
by Bfr
Hello,

I want to import products from my other database, I have a lot of product to import and these products all have different options categories, each containing a lot of options.
I suppose I have to create "attribute type" for each category but the problem is the translation because attribute type translation are stored in files based on the "code". Is there an other way to do it? Or should I add texts in "attribute type"?

Thanks in advance for your help,

Bernard

Re: Product attributes

Posted: 05 Oct 2017, 17:57
by aimeos
The only way to translate the attribute types are the i18n translations - either in the config or in a Gettext po/mo file. How many attribute type (not attributes) do you have and are they highly dynamic or stay they for a longer time. Can you tell us what these attribute types are for?

We've thought about adding a mshop_attribute_type_i18n table which can contain translations for types in highly dynamic environments but nobody has required this up to now.

Re: Product attributes

Posted: 06 Oct 2017, 09:36
by Bfr
We have 5000 products and a lot of them have different "att type", for example a pen will have :
- color of the clip
- color of the barrel
- color of part1
- color of ink
a t-shirt will have
- color of collar
- color of body
- color of sleeve
- size
- material

And each product have their own types. I don't know if the po/mo file will have good performance if it contains 5000 key maybe you can tell me. I will also have to create new products and types and update existing everyday from my other database It wont be easy to update only the modified one with po/mo files.

Re: Product attributes

Posted: 06 Oct 2017, 11:00
by aimeos
Performance of Gettext mo files isn't a problem because they can be cached in APC if you enable that. But in your case it makes sense to use a translation table to for the attribute types if those values change more or less every day.

Are you interested in creating a patch to implement that? We would help you and tell you what should be done to get this working.

Re: Product attributes

Posted: 08 Oct 2017, 10:36
by Bfr
Yes I’m interested, how can I proceed? Should I do it in aimeos-core project ?

Re: Product attributes

Posted: 08 Oct 2017, 15:44
by aimeos
Yes, aimeos-core in an own branch would be the best place.

At first, we need to add the required table in https://github.com/aimeos/aimeos-core/b ... ribute.php. I would suggest that layout:

Code: Select all

		'mshop_attribute_type_i18n' => function ( \Doctrine\DBAL\Schema\Schema $schema ) {

			$table = $schema->createTable( 'mshop_attribute_type_i18n' );

			$table->addColumn( 'parentid', 'integer', [] );
			$table->addColumn( 'langid', 'string', ['length' => 5] );
			$table->addColumn( 'label', 'string', ['length' => 255] );

			$table->addUniqueIndex( ['parentid', 'langid'], 'unq_msatttyin_pid_langid' );

			return $schema;
		},
We could join this table in the SQL statement used in searchItems() of the attribute type manager. In the attribute manager, we can use it to populate the "attribute.typename" property of the item. For management, we would need two more SQL statements in the attribute type manager to delete and insert langid/name pairs. The type item would need a getNames() and setNames( array $pairs ) method.

What do you think?