View Issue Details

IDProjectCategoryView StatusLast Update
0005298OXID eShop (all versions)1.02. Price calculations (discounts, coupons, additional costs etc.)public2014-03-10 11:57
Reportervanilla thunder Assigned To 
PrioritynormalSeveritymajorReproducibilityalways
Status resolvedResolutionno change required 
Product Version4.7.6 / 5.0.6 
Target Version4.8.5 / 5.1.5 
Summary0005298: oxBasketItem returned by oxBasket after adding article to basket contains wrong price
Descriptionfunction 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 Reproduce1) 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 Informationit drives me crazy :O
TagsNo tags attached.
ThemeBoth
BrowserAll
PHP Versionany
Database Versionany

Activities

Linas Kukulskis

2014-03-10 11:56

reporter   ~0009625

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.