View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0005841 | OXID eShop (all versions) | 1.02. Price calculations (discounts, coupons, additional costs etc.) | public | 2014-07-31 15:11 | 2014-08-01 08:29 |
Reporter | euroxid | Assigned To | |||
Priority | normal | Severity | major | Reproducibility | always |
Status | closed | Resolution | duplicate | ||
Summary | 0005841: oxvoucher__oxcalculateonec still allows multiple calculations | ||||
Description | If you set a voucherseries to be valid with only specific articles, and set them to be calculated only once, the voucher value can still get reduced multiple times. | ||||
Steps To Reproduce | Backend: - Make a voucher series with an absolute value of e.g. 10€ - assign some articles - set all "usable with" options to NO - check the "calculate once" box. Frontend: - Add 2 distinct articles - Insert voucher code - See 20€ reduced | ||||
Additional Information | Reason: ------- If the voucherseries has assigned articles, the voucher value is calculated by oxvoucher::_getProductDiscoutValue(). This is the code: foreach ( $aBasketItems as $aBasketItem ) { $oDiscountPrice->setPrice($aBasketItem['discount']); $oProductPrice->setPrice($aBasketItem['price']); // Individual voucher is not multiplied by article amount if (!$oSerie->oxvoucherseries__oxcalculateonce->value) { $oDiscountPrice->multiply($aBasketItem['amount']); $oProductPrice->multiply($aBasketItem['amount']); } $oVoucherPrice->add($oDiscountPrice->getBruttoPrice()); $oProductTotal->add($oProductPrice->getBruttoPrice()); } As you can see, calculateonce makes sure that the vouched doesn´t get applied multiple times if you buy the same article with a 1+ amount. But it does not stop the calculation for every single distinct article. ********* Solution: ********* Right before closing the foreach loop, add these lines: // Be sure that an absolute, once-to-be calculated voucher only applies for the first article if ($oSerie->oxvoucherseries__oxcalculateonce->value && 'absolute' ==$oSerie->oxvoucherseries__oxcalculateonce->value) { break; } | ||||
Tags | No tags attached. | ||||
Theme | Azure | ||||
Browser | All | ||||
PHP Version | any | ||||
Database Version | any | ||||
duplicate of | 0005162 | resolved | Linas Kukulskis | Coupon calculation is not correkt, when articles are assigned and |