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)
#6350 by Nelson Martins
05 Jul 2018, 17:33
Hello,

I'm building an online store which will sell machine parts - these will be the products.
But I need to relate products (parts) with multiple machines to which those parts apply.
A product can relate to multiple machines.
So should I create a different Model to define a machine and then relate Product and Machine via some kind of HasMany relationship between them?
It would have to be possible to change the Product admin interface and create a way of creating those multiple associations.
What would be needed to do this? Is there a some easier way to acomplish this in Aimeos?

thanks!
#6368 by aimeos
06 Jul 2018, 11:28
Just a quick thought: Add your machines as category nodes that can have relationships to many machine parts, e.g.

- Root category
|- Production
|- Machine 1 -> part 1, part 2, part 3
|- Machine 2 -> part 4, part 3, part 5

You can add Texts, Images and as many machine parts (products) to your "Machine X" category and also add relationships to other domains (e.g. Suppliers, etc.)
#6374 by Nelson Martins
06 Jul 2018, 12:35
Hello,
thanks for your reply!

the thing is that a Machine has to be defined by this 3 fields:
- Brand (should be a taxonomy of terms)
- Series (text field)
- Model (text field)

We're talking about thousands of machine parts (products) associated with thousands of Machines (categories) ...
Even if there is a chance of having that kind of metadata on a category, would it make sense to have this kind of structure built into Categories?
#6378 by aimeos
06 Jul 2018, 14:02
I still think so. It doesn't matter how many parts (articles) you associate to a product (category). The only thing you should take care of is to avoid adding all your products (categories) below the root category node. This would be a lot data to load. Instead, group your products (leaf categories) in a category tree with at least two or more levels, e.g.

Root category
- Group 1
-- Machine 1
-- Machine 2
- Group 2
-- ...

or even

Root category
- Group 1
-- Sub-group 1
--- Machine 1
--- Machine 2
-- Sub-group 2
--- Machine 3
- Group 2
-- Sub-group 3
--- ...

The rest of your data can be added to your products (leaf categories) without problems.
#6458 by aimeos
16 Jul 2018, 17:22
#6459 by Nelson Martins
16 Jul 2018, 18:00
Ok, those are examples on how to get info from the categories, and that's all right.

I think the question remains in terms of backoffice - how can we have, besides, for instance, the fields in the Basic tab:
- Status
- Code
- Label
- URL target

...those other custom fields I've mentioned before:

- Brand (should be a taxonomy of terms)
- Series (text field)
- Model (text field)

I've noticed 'Options' can be created on the fly, but that's not the idea, these would have to be fixed fields (and displaying only on the admin pages of some specific categories).