View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0005298 | OXID eShop (all versions) | 1.02. Price calculations (discounts, coupons, additional costs etc.) | public | 2013-07-16 11:52 | 2014-03-10 11:57 |
Reporter | vanilla thunder | Assigned To | |||
Priority | normal | Severity | major | Reproducibility | always |
Status | resolved | Resolution | no change required | ||
Product Version | 4.7.6 / 5.0.6 | ||||
Target Version | 4.8.5 / 5.1.5 | ||||
Summary | 0005298: oxBasketItem returned by oxBasket after adding article to basket contains wrong price | ||||
Description | function oxBasket->addToBasket() returns added oxBasketItem Object after adding a product to basket. it contains the data about this product, e.g. article oxid, amount, var select, unit price and total price. But the oxPrice object contains the wrong total price | ||||
Steps To Reproduce | 1) in application/models/oxbasket.php insert this code right before last return (row 490): oxRegistry::getUtils()->writeToLog(print_r($this->_aBasketContents[$sItemId], true), "basketitem.dump"); 2) go to shop frontend and add a random article to basket (you can add amount > 1) 3) look into log/basketitem.dump and you will see, that _oPriceand _oUnitPrice are null. 4) add same article to basket again 5) reload basketitem.dump and in the new dump you will see the oPrice object for the amount of articles you put into you basket in step 2. e.g. you put an amount of 10 products, the first time the price will be null and then you put 50 more products, then the price will be shown for 10 products though the basketitem object contains the right amount | ||||
Additional Information | it drives me crazy :O | ||||
Tags | No tags attached. | ||||
Theme | Both | ||||
Browser | All | ||||
PHP Version | any | ||||
Database Version | any | ||||
|
hi, i would like shortly describe oxBasket, oxBasketItem, and basket recalculation API. oxBasketItem object price would be calculated only after calling oxbasket::calculateBasket(); So if you add something to basket you should call this methods, is better to have separate method to trigger that instead of do recalculation on each amount update in basket or on each article addition. |