View Issue Details

IDProjectCategoryView StatusLast Update
0005070OXID eShop (all versions)1.02. Price calculations (discounts, coupons, additional costs etc.)public2014-03-04 11:29
Reportergpayer Assigned To 
PrioritynormalSeveritymajorReproducibilityalways
Status resolvedResolutionno change required 
Product Version4.7.4 / 5.0.4 revision 57063 
Summary0005070: Amount is ignored in oxArticle::getPrice() (and methods called from there)
DescriptionIf you use oxArticle::getPrice($dAmount = 1) with $dAmount > 1, then this value will be ignored, it will always return the same as getPrice(1).

Unfortunately this bug cannot be fixed easily (e.g. by using $dPrice * $dAmount in getBasePrice()), because this bug is worked around in other place, e.g. while putting articles into the basket.

One such workaround is in "oxBasketItem::setPrice", where the given price (although coming from getBasePrice(N) with N > 1 (via getBasketPrice)) is multiplied with N once more.

There are probably more (e.g. in discount calculation code paths).
Steps To ReproduceUse both

$article->getPrice()

and

$article->getPrice(10)

in a module or a template (with $article being an oxArticle object).
Additional InformationPlease add an unit test, testing oxArticles::getPrice(N) with N > 1.
TagsNo tags attached.
ThemeBoth
BrowserAll
PHP Versionany
Database Versionany

Activities

tadas

2013-04-16 14:25

reporter   ~0008615

Reminder sent to: gpayer

getPrice() gets base article price, and if amount parameter is set, it looks for a possible price reduction, which can be added in admin settings(Administer Products->Products->Stock) with Scale Prices. Amount from and to defines range, and getPrice( amount ) that fits into one of these ranges will return modified unit price. So, in essence getPrice doesn't return total price in this case.