View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0004680 | OXID eShop (all versions) | 1.02. Price calculations (discounts, coupons, additional costs etc.) | public | 2012-11-02 12:34 | 2012-12-07 15:07 |
Reporter | aggrosoft | Assigned To | |||
Priority | normal | Severity | major | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Product Version | 4.6.5 revision 49955 | ||||
Fixed in Version | 4.6.6 revision 54646 | ||||
Summary | 0004680: Discount recalculation fails on basket refresh | ||||
Description | If you are working with a single basket item and a list of discounts the calcuation might fail. The discount is calculated in the first place, calculations after that are skipped. | ||||
Steps To Reproduce | - Create product with price 10€ - Create 3 discount rules: 6% from 100 to 199 € 9% from 200 to 299 € 12% from 300 to 99999 € - Be sure the rules are assigned to the products category or directly to the product - Put product into cart - Set amount to 15 - Rule 6% works - Set amount to 25 - Rule 9% is ignored - Set amount to 36 - Rule 12% is ignored It does work with multiple different items in cart! I tracked the issue down, it works with a little patch. The problem is that in oxDiscountList::getBasketItemDiscounts calling $this->_getList( $oUser ) does NOT reset the iterator. The foreach will not go through all items and will stop after the first one. | ||||
Additional Information | Using $this->_getList( $oUser )->getArray() is a workaround for the issue (which is done in getBasketDiscounts already): public function getBasketItemDiscounts( $oArticle, $oBasket, $oUser = null ) { $aList = array(); $oList = $this->_getList( $oUser )->getArray(); foreach ( $oList as $oDiscount ) { if ( $oDiscount->isForBasketItem( $oArticle ) && $oDiscount->isForBasketAmount( $oBasket ) ) { $aList[$oDiscount->getId()] = $oDiscount; } } return $aList; } | ||||
Tags | Discount | ||||
Theme | Both | ||||
Browser | All | ||||
PHP Version | any | ||||
Database Version | any | ||||