View Issue Details

IDProjectCategoryView StatusLast Update
0006562OXID eShop (all versions)1.02. Price calculations (discounts, coupons, additional costs etc.)public2023-01-24 17:44
Status closedResolutionduplicate 
Product Version4.10.0 / 5.3.0 
Target VersionFixed in Version6.2.4 
Summary0006562: Wrong Voucher Calculation - session basket mixing
DescriptionThis bug has been already reported, but has been closed as not reproducable(

It only appears if the voucher calculation is set on percentual and categories or articles are assigned to it.

I could solve the problem by passing the basket object to the oxvoucher model before calculating the voucherdiscount.

I added a function setRealBasket($oBasket) in oxvoucher to set the basket.

In oxbasket::_calcVoucherDiscount() i set the basket before calling $oVoucher->getDiscountValue($dPrice)

In oxvoucher->_getSessionBasketItems() i use this basket for calculation.
TagsNo tags attached.
PHP VersionNot defined
Database VersionNot defined


duplicate of 0006854 resolvedHR Wrong voucher calculation - discount sharing between user's baskets 



2016-12-08 17:10

reporter   ~0011894

Last edited: 2016-12-08 18:32

View 3 revisions

Update: Problem is not solved by passing the basket object to oxvoucher.
We still have orders with the applied discount of an previous order using the same voucher code.

Another series with percentage and assigned articles seems to be calculated correctly. (This series uses unique voucher codes)


2016-12-09 10:16

administrator   ~0011895

Please provide Steps to Reproduce (hopefully with screenshots) to help us reproduce the issue and thereby analyse it.


2016-12-09 10:49


oxordervoucherexception.jpg (534,397 bytes)


2016-12-09 10:58

reporter   ~0011896

Last edited: 2016-12-09 11:00

View 2 revisions

I uploaded a screenshots of the orders with the assigned voucher. The voucher was set to 5% for an assigned group of articles only. The voucher code is the same for the voucherseries. (no unique vouchercodes - this is important)

The red highlited parts are orders with the same voucherdiscount amount, but with wrong calculation for the newer one. - so it seems that the amount is taken by the older order/session ??

We stopped this promotion, because it caused too much trouble, so iam nnot able to produce the error in live situtation. we will try to reproduce this bug in dev and give feedback.


2016-12-09 11:59


voucherdebug.jpg (80,456 bytes)
voucherdebug.jpg (80,456 bytes)


2016-12-09 12:00

reporter   ~0011897

Last edited: 2016-12-09 12:16

View 2 revisions

I´ve been able to reproduce it in stage env.

1. Create voucherseries with percentage discount
2. assign a bunch of articles to it
3. Create vouchers with a single voucher code (e.g. "08154711")
4. open several sessions signin with mutltiple accounts
5. use voucher code to buy articles (assigned to voucherseries)

in my case i left some session with voucher and didn´t finish those orders

As you can see in provided screenshot (voucherdebug.jpg) it took 5 orders till the calculation was wrong.


2016-12-12 11:04

administrator   ~0011898

The issue is not reproducable from our end. Kindly try to reproduce the issue in our Reference sytem :


2017-03-01 15:54

reporter   ~0011987

Last edited: 2017-03-01 16:05

View 2 revisions

This part is the same:
1. Create voucherseries with percentage discount
2. assign a bunch of articles to it
3. Create vouchers with a single voucher code (e.g. "08154711")

The session.gc_maxlifetime should be higher than standard iVoucherTimeout (oxvoucher::_getVoucherTimeout() standard 3*3600 seconds)

2 customers are necessary:
1. customer A assign voucher to basket -> oxreserved will be set on 3*3600 seconds = 3 hours -> Timestamp #1
2. customer A keeps the session alive for 3 or more hours.
3. customer B assigns the same voucher code to the basket 3 hours after {Timestamp #1}.
   As a result the same oxvouchers__oxid will be assigned -> Timestamp #2
4. customer B finishes the order process (oxorderid, oxuserid and oxdiscount will set!)
5. customer A refreshes the basket after {Timestamp #2} (in step 1 ala cart :D ) and get the oxvouchers__oxdiscount from customer B's order.
5. customer A fineshes the order process and saves the discount value from the already used voucher

Hint #1: this is not reproducable in because of the hourly reset
Hint #2: set the oxreserved field in oxvouchers at the oxvoucher from customer A to a lower value or wait 3 hours ;).


possible solution in oxvoucher::checkBasketVoucherAvailability():
      if("0000-00-00" != $this->oxvouchers__oxdateused->value || false == empty($this->oxvouchers__oxorderid->oxvalue)) {
            $oEx = oxNew( 'oxVoucherException' );
            $oEx->setMessage('Do not use expired vouchers');
            throw $oEx;


2023-01-24 17:41

administrator   ~0014992

Last edited: 2023-01-24 17:44

View 2 revisions

Closed because duplicate and resolved in the other bug ticket.