Page 1 of 1

Products relationship

Posted: 16 Nov 2017, 00:38
by techgeekh
I have created two product types "bike" and "bike_part", and I have linked them together using the "Suggested products".

For example a bike can have many bike parts and a bike part can belong to many bikes.

Is there a way that I can add a "quantity" field to the relationship ?

For example a bike can have 2 of the same part but others have only 1.

Also I have another question concerning images. Is there a way that I can have different media groups/types connected to 1 product ( in this case bike ) ?

For example for a bike, I want to add images displaying the bike in one group and other images displaying specification sheet images in another group.

Re: Products relationship

Posted: 16 Nov 2017, 21:26
by aimeos
techgeekh wrote: Is there a way that I can add a "quantity" field to the relationship ?
There's a "config" property in each relationship where you can add a "['quantity' => 2]" value. This would have no consequences as long as you don't use that value while rendering the suggested products using an adapted template. Also, you are not able to manage this value in the simple mode admin interface yet - the input fields still are missing. In expert mode, you can manage that value.
techgeekh wrote: Also I have another question concerning images. Is there a way that I can have different media groups/types connected to 1 product ( in this case bike ) ?

For example for a bike, I want to add images displaying the bike in one group and other images displaying specification sheet images in another group.
Yes, add a new media type, e.g. "sheets" and assign that type to your sheet images. In the frontend template, you can get the images by type with:

Code: Select all

$product->getRefItems( 'media', 'sheets', 'default' )
The last value is the list type where you and use different types for the same media type if you need.