Configure mix of products

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!
ditsbroefs
Posts: 2
Joined: 23 Aug 2019, 15:22

Configure mix of products

Post by ditsbroefs » 23 Aug 2019, 15:34

Sure this question must have been asked before, but I could not find it.

I would like to create a product '250 gr of customer selected nuts'. These selection of nuts might be cashews, almonds, and peanuts. The customer should be able to chose for instance 100 gr cashews, 50 gr almonds, and 100 gr peanuts. The price the customer pays is calculated based on the price per gram of the individual components in the mix. The customer may freely chose how much of what, as long as the total weight is 250 gram.

I might then also define a product '500 gr of customer selected nuts' and another product '250 gr of almonds'.

What is the best way to go about?

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

Re: Configure mix of products

Post by aimeos » 24 Aug 2019, 10:30

Use a default article and add custom attributes for all nuts the customer can choose from. These custom attributes can have their own price if the nuts are from different price categories.

Customers can already enter arbitrary quantities for configurable attributes (maybe define 25g steps that are added):
https://github.com/aimeos/ai-client-htm ... d.php#L119

Add some Javascript that enforces a sum ob 250g.That can be configurable if you add a key/value pair (total: 250) in the config table of the product detail view for that product (retrieve with: $productItem->getConfigValue('total');). If you want to be one the save side, write a basket plugin that checks if the quantity is correct when putting the configured product into the basket:
https://aimeos.org/docs/Developers/Libr ... et_plugins
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

ditsbroefs
Posts: 2
Joined: 23 Aug 2019, 15:22

Re: Configure mix of products

Post by ditsbroefs » 24 Aug 2019, 10:46

Wonderful! Thank you, I will try that.

Post Reply