How to call createRebateProducts() method in basket plugin
Forum rules
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
How to call createRebateProducts() method in basket plugin
Hi, I want to automaticly add a coupon code according to basket products total amount.
e.g.
When the total amount reach 100$, a coupon code with 10% off will be applied automaticly,
and when the total amount reach 200$, a coupon code with 20$ off will be appiled automaticly etc.
so the customer do not to need enter the code manually in this way. Is that possible?
I have created a basket pulgin that registered with "addProduct.after", "deleteProduct.after"
however a litter confused with how to add the specific coupon code in the update() method.
Maybe some codes like:
$rebate = $this->getConfigValue('hanscoupon.rebate', 0);
$products = $this->createRebateProducts($base, 'demo-rebate', $rebate);
$base->setCoupon($this->getCode(), $products);
I wonder how to call the createRebateProducts() within a basket plugin update() method?
Please give me some advices, thanks.
e.g.
When the total amount reach 100$, a coupon code with 10% off will be applied automaticly,
and when the total amount reach 200$, a coupon code with 20$ off will be appiled automaticly etc.
so the customer do not to need enter the code manually in this way. Is that possible?
I have created a basket pulgin that registered with "addProduct.after", "deleteProduct.after"
however a litter confused with how to add the specific coupon code in the update() method.
Maybe some codes like:
$rebate = $this->getConfigValue('hanscoupon.rebate', 0);
$products = $this->createRebateProducts($base, 'demo-rebate', $rebate);
$base->setCoupon($this->getCode(), $products);
I wonder how to call the createRebateProducts() within a basket plugin update() method?
Please give me some advices, thanks.

Re: How to call createRebateProducts() method in basket plugin
You can't use createRebateProducts() in basket plugins because that method is only available in coupon providers.
The easiest way would be to create a coupon (e.g. code "10%") with "Percent" coupon provider and 10% discount and implement a basket plugin that always adds that coupon code to the basket with addCoupon() when a product is added and the coupon code haven't been added yet.
The easiest way would be to create a coupon (e.g. code "10%") with "Percent" coupon provider and 10% discount and implement a basket plugin that always adds that coupon code to the basket with addCoupon() when a product is added and the coupon code haven't been added yet.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos,
give us a star
If you like Aimeos,

Re: How to call createRebateProducts() method in basket plugin
OK, I will try with the addCoupon() method, thank you very much!