Coupon Customize Decorator

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!
tommy.developer
Posts: 8
Joined: 25 Aug 2021, 02:56

Coupon Customize Decorator

Post by tommy.developer » 30 Sep 2021, 08:01

Hi,
Good day!,
Is there any way I can create a customize decorator?
Image
  • I need a voucher for specific customer only
  • I need a decorator for basket minimum total value to use the voucher
  • I also need a decorator that has maximum discount value

example:
basket has total value of 500 USD with a voucher discount of 10% the discount will be 50 USD.
but I want a decorator that will limit the given rebate to 30 USD maximum only



can u give me an idea?
or better if you have a documentation and sample on how to add new voucher decorator?

thanks .

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

Re: Coupon Customize Decorator

Post by aimeos » 30 Sep 2021, 08:21

Unfortunately, there's no documentation for that part yet but you can use the existing decorators as examples. The one that fits best is the Category decorator because you have to implement the "calcPrice()" method and limit the returned price by the value from your configuration:
https://github.com/aimeos/aimeos-core/b ... tegory.php

If you create a pull request in the aimeos/aimeos-core repository, we are happy to merge your code! :-)
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

tommy.developer
Posts: 8
Joined: 25 Aug 2021, 02:56

Re: Coupon Customize Decorator

Post by tommy.developer » 30 Sep 2021, 09:21

seems like i need to add in aimeos core,
Is there a way to add it on aimeos extension?

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

Re: Coupon Customize Decorator

Post by aimeos » 01 Oct 2021, 15:03

Yes, you can put it in ./lib/custom/src/MShop/Coupon/Provider/Decorator/ of your own extension.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

Post Reply