View Issue Details

IDProjectCategoryView StatusLast Update
0004631OXID eShop (all versions)1.02. Price calculations (discounts, coupons, additional costs etc.)public2014-03-04 11:28
Reportermsubotovic Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionunable to reproduce 
Product Version4.2.0 revision 23610 
Target Version4.8.3 / 5.1.3 
Summary0004631: Discount quantity and purchase price filters are working incorrectly
DescriptionThere are issues in oxDiscount class, isForBasketAmount and isForAmount methods:

1) It looks like the discount filter uses logical OR, but not logical AND method (oxDiscount::isForBasketAmount):

if ( $blForBasketItem ) {
                if ( $this->oxdiscount__oxprice->value ) {
                    if ( ( $oPrice = $oBasketArticle->getPrice() ) ) {
                        $dAmount += $oPrice->getBruttoPrice() * $oBasketItem->getAmount();
                    }
                } elseif ( $this->oxdiscount__oxamount->value ) {
                    $dAmount += $oBasketItem->getAmount();
                }
            }

2) When the price AND quantity filters are set (both) and basket price passes the price filter it is being compared with "oxamount" value (oxDiscount::isForAmount):

$blIs = true;
        if ( $this->oxdiscount__oxprice->value &&
            ( $dAmount < $this->oxdiscount__oxprice->value || $dAmount > $this->oxdiscount__oxpriceto->value ) ) {
            $blIs = false;
        } elseif ( $this->oxdiscount__oxamount->value &&
            ( $dAmount < $this->oxdiscount__oxamount->value || $dAmount > $this->oxdiscount__oxamountto->value ) ) {
            $blIs = false;
        }
Steps To Reproduce1. Go to Admin -> Shop Settings -> Discounts
2. Create new discount with any type (abs, % or itm)
4. Set "Quantity" filter - From: 1, To: 10
5. Set "Purchase Price" filter - From: 1, To: 1000
6. Click "Save"
7. Go to "Products" tab and assign some article with price greater than 1 and less than 1000
7. Go to front-end page
8. Find article that match the discount
9. Add article to basket
10. Observe that the discount has not been applied
TagsDiscount
Attached Files
Screenshot.png (24,978 bytes)   
Screenshot.png (24,978 bytes)   
ThemeBoth
BrowserAll
PHP Versionany
Database Versionany

Relationships

related to 0004689 confirmedHR Discount to assigned product with defined quantity range works incorrect 

Activities

svetlana

2014-01-28 15:32

reporter   ~0009447

On 5.0 and 5.1 there is no such bug anymore.