View Issue Details

IDProjectCategoryView StatusLast Update
0006657OXID eShop (all versions)1.02. Price calculations (discounts, coupons, additional costs etc.)public2024-04-03 11:33
Reportervanilla thunder Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status confirmedResolutionopen 
Product Version4.10.2 / 5.3.2 
Summary0006657: Product and category coupon's value calculated from article's basket price instead of actual basketitem price
Descriptioncategory and product coupons take product's original price for calculating discount value instead of getting the actual basketitem price, which could be alredy reduced.
You get the biggest side effect when combining discounts and coupons at same time, e.g. you offer 33% discount for a product "buy 3, pay 2" and also 10% for particular products or categories. When bots discount and coupon are valid for the product in your basket, both discount and coupon values are calculated with the original undiscounted price.
Steps To Reproduce1) product X costs 300€
2) crate 100 € discount for product X
3) crate 10% coupon test666
4) add X to basket
5) you see: product X - 200€ ([del]300€[/del])
6) enter coupon code test666
7) coupon value is calculated based on 200€ price -> 20€
8) assign product xor its category to the coupon series
9) recalculate basket
10) coupon discoutn value is calculated based on product's original price 300€ -> 30€
Additional Informationcompare functions:
oxVoucher::_getGenericDiscoutValue
oxVoucher::_getCategoryDiscoutValue
oxVoucher::_getProductDiscoutValue

_getGenericDiscoutValue uses passed $dPrice from oxBasketitem for discount values calcultion

_getCategoryDiscoutValue and _getProductDiscoutValue get array of basket items from function _getSessionBasketItems (inside _getBasketItems), but it contains prices from $oArticle->getBasketPrice(...), which are undiscounted.
Using $oBasketItem->getUnitPrice()->getPrice() instead, would give the current price of the basket item


here is my fix approach:

$aItems[$iCount] = array(
    'oxid' => $oArticle->getId(),
    //'price' => $oArticle->getBasketPrice($oBasketItem->getAmount(), $oBasketItem->getSelList(), $oBasket)->getPrice(),
    'price' => $oBasketItem->getUnitPrice()->getPrice(),
    //'discount' => $oDiscount->getAbsValue($oArticle->getBasketPrice($oBasketItem->getAmount(), $oBasketItem->getSelList(), $oBasket)->getPrice()),
    'discount' => $oDiscount->getAbsValue($oBasketItem->getUnitPrice()->getPrice()),
    'amount' => $oBasketItem->getAmount(),
);
TagsNo tags attached.
Attached Files
01.PNG (95,247 bytes)   
01.PNG (95,247 bytes)   
02.PNG (96,718 bytes)   
02.PNG (96,718 bytes)   
demoshop.PNG (100,299 bytes)   
demoshop.PNG (100,299 bytes)   
discount.JPG (105,470 bytes)   
discount.JPG (105,470 bytes)   
ThemeNot defined
BrowserNot defined
PHP VersionNot defined
Database VersionNot defined

Activities

QA

2017-06-28 16:02

administrator   ~0012164

i tried to reproduce on https://demoshop.oxid-esales.com/professional-edition/
but the coupon discount value is calculated not on the product's original price 300€ -> 30€, but on the discounted price 200€ -> 20€.

see Screenshot

vanilla thunder

2017-06-28 16:13

reporter   ~0012165

Last edited: 2017-06-28 16:14

i guess, you forgot to assign trapez ion or it's category to the coupon series (step 8).
i configured right now everything as described, not sure how often demoshop resets.
(i added demoshop.PNG screenshot)

[email protected]

2018-10-19 12:38

reporter   ~0012647

Haben den gleichen Fehler bei einer CE 4.9.5:

Produkt hat Preis von 53,95€

In Oxid ist ein Rabatt eingestellt von 5% , Einkaufsmenge 1-99999, Artikelzuordnung zu diesem Produkt

Der Gutschein hat einen Rabatt von 10% und der Gutschein ist diesem Produkt zugeordnet.

Der Warenkorb stellt nun die Position korrekt mit 51,25€ dar. Füge ich nun den Gutschein hinzu werden nicht 5,13€ angezogen sondern 5,40€ also 10% vom ursprünglichen Artikelpreis.

Lässt man nun beim Gutschein die Artikelzuordnung weg, dann wird korrekterweise 5,13€ für den Gutschein abgezogen.

FibreFoX

2018-10-19 19:59

reporter   ~0012650

@[email protected] you should rewrite that in english, as the whole bug-tracker is english, otherwise you risk you comment getting ignored.

QA

2018-10-22 08:40

administrator   ~0012651

Last edited: 2018-10-22 08:41

Reproduced and translated what [email protected] wrote in PE / EE 6.1.0:

Have the same error with a CE 4.9.5:
Product has price of 53,95€
In Oxid a discount of 5% is set, purchase quantity 1-99999, article assignment to this product.
The voucher has a discount of 10% and the voucher is assigned to this product.
The shopping cart now shows the position correctly with 51,25€. If I now add the voucher are not attracted 5.13€ but 5.40€ so 10% of the original article price.
If you omit the article allocation now with the voucher, then correctly 5.13€ is deducted for the voucher.

SvenBrunk

2024-04-03 11:33

administrator   ~0016705

Verified in Apex / OXID 7.0