Discount when 2 or more products from specific categorie are added

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!
Doggiefield
Posts: 18
Joined: 13 May 2020, 13:07

Discount when 2 or more products from specific categorie are added

Post by Doggiefield » 31 Mar 2021, 22:01

Hi,

I would like to apply discount only when 2 or more products from a specific category are added.
There are 2 way's (that I can think of) to approach this

1) Add default discount to the product
When the customer adds the product to the basket he will get a notification to add another product from that category to the basket.
2) Use products without discount
When a customer adds a minimum of 2 (different) products from a specific category; a discount on those products is applied

How can I achieve this?

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

Re: Discount when 2 or more products from specific categorie are added

Post by aimeos » 02 Apr 2021, 17:26

In the current dev-master version, there's a new rule system to apply price changes depending on arbitrary conditions which makes it much easier to achieve what you want.

For 2020.10 LTS, the easiest way is to create a basket plugin, that adds the discount if two different products of the same category are in the basket:
https://aimeos.org/docs/latest/provider ... t-plugins/
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

createanet
Posts: 72
Joined: 22 Mar 2021, 16:56

Re: Discount when 2 or more products from specific categorie are added

Post by createanet » 02 Apr 2021, 18:19

@ameos

What would be the advantage of using the basket plugin over the controller?

I read somewhere that it was advised certain things should not be done in the plugin but in the controller (basket specific).

I have created similar functionality as OP by decorating the basket controller and apply/remove a coupon of a type percent.

How would the discount look when applying it via the plugin approach?

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

Re: Discount when 2 or more products from specific categorie are added

Post by aimeos » 06 Apr 2021, 15:05

Adding features using a decorator for the basket controller or extending the basket controller is easier to understand but limited in what you can react to. On the other side, a basket plugin can react on any event even not related to something the basket controller cares about but event systems are hard to debug.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply