about rebate

Help for integrating the Laravel package
Forum rules
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
User avatar
giorgimetivishvili
Posts: 4
Joined: 30 Mar 2021, 10:48

about rebate

Post by giorgimetivishvili » 07 Apr 2021, 14:13

Laravel: ^8.0
aimeos-laravel: ~2020.10
PHP: 7.4
Server: Apache Debian

Hello, i have 2 questions:

1. how to show rebate on cart mini and standard pages? (just calculate them by my self?) but when i get $this->getProducts() it has actual price but price.rebate is 0 for product, so how to show rebates in cart?
2. what happens if i have product in cart and from admin i change price for it? does price changes or does validation fails during checkout?

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

Re: about rebate

Post by aimeos » 09 Apr 2021, 07:21

giorgimetivishvili wrote: 07 Apr 2021, 14:13 1. how to show rebate on cart mini and standard pages? (just calculate them by my self?) but when i get $this->getProducts() it has actual price but price.rebate is 0 for product, so how to show rebates in cart?
The rebates shown in the product list and detail view are not available any more in the basket because they are only for "informational" purpose and not saved in the order. Instead, the price.rebate value in the basket are used for discounts related to coupons or other "real" discounts.

To show the original product rebates, you have to load the products for all order products in the basket but this slows down the basket operations. Another option is to extend the copyFrom() method in order product item class and store the rebate as additional property using:

Code: Select all

$orderProduct->set( '_rebate', $price->getRebate() )
https://github.com/aimeos/aimeos-core/b ... #L622-L643

Then, you can get the original rebate in the frontend using

Code: Select all

$orderProduct->get( '_rebate', 0 )
giorgimetivishvili wrote: 07 Apr 2021, 14:13 2. what happens if i have product in cart and from admin i change price for it? does price changes or does validation fails during checkout?
Depends on your setup. By default, the ProductPrice plugin will change the price automatically and inform the customer in the checkout summary page.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

User avatar
giorgimetivishvili
Posts: 4
Joined: 30 Mar 2021, 10:48

Re: about rebate

Post by giorgimetivishvili » 09 Apr 2021, 14:43

thanks for reply :) i'll try out and let you know

Post Reply