View Issue Details

IDProjectCategoryView StatusLast Update
0007293OXID eShop (all versions)1.03. Basket, checkout processpublic2021-12-06 10:48
ReporterAlpha-Sys Assigned To 
PrioritynormalSeveritymajorReproducibilityalways
Status acknowledgedResolutionopen 
Product Version6.3.1 
Summary0007293: Noticelist and wishlist items are lost with basket reservation enabled
DescriptionNoticelist and wishlist items gets deleted if the setting for basket reservation is active.
Steps To ReproduceActivate basket reservation in private sales settings.
Login in frontend and add an article to the wishlist or the noticelist. Wait until the basket reservation limit is reached. Your noticelist and wishlist articles disappear.
Additional InformationThe problem is in the BasketReservation class. In the function discardUnusedReservations.
This SQL is executed which removes the basketitems:
https://github.com/OXID-eSales/oxideshop_ce/blob/master/source/Application/Model/BasketReservation.php#L316
TagsNo tags attached.
ThemeAll
BrowserAll
PHP VersionAll
Database VersionAll

Activities

QA

2021-12-06 10:48

administrator   ~0013515

Thanks for your report. First we were not able to reproduce the issue, but after some time we figured out an important condition: If you reload the page while having an empty basket and being in basket or checkout process, the behavior was reproducable.

Therefore the steps to reproduce must look like this:
- Enable the setting Master Settings > Core Settings > Settings
Cart expiration.
- For testing purpose, you should set Seconds cart expiration timeout to something small, e.g. 5 seconds.
- Now add a product to your wish list and/or gift registry.
- Then add a product to your basket and go to basket overview.
- Wait until the cart expires.
- Reload the page.
- Your basket is empty. Your wish list and gift registry is still active.
- Wait again the amount of time until the cart would expire again.
- Reload the page.
- Now your wish list and gift registry are empty.

If you never call the basket/checkout page while having an empty basket, this behavior is not seen. The basket will be emptied after expiration, but the wish list and gift registry stay active.

More explanation:
The mentioned line of code truly deletes all entries in oxuserbasketitems, even though they are belonging to the wish list or gift registry. However, the entries in oxuserbaskets with oxtitle = savedbasket and oxtitle = reservations are deleted before. Therefore on the first reload the named method OxidEsales\EshopCommunity\Application\Model\BasketReservation::discardUnusedReservations returns soon due to the condition

if ($reservation->EOF) {
    return;
}

https://github.com/OXID-eSales/oxideshop_ce/blob/4d0b7ffcec290dc784b144cdd90fc268f2b2dab1/source/Application/Model/BasketReservation.php#L290

which is true, since there's no more reservation. No wish list or gift registry items are deleted then. If you're browsing on any other page than basket or checkout, that's not an issue, but if you reload while staying in basket/checkout, a new reservation is inserted to the database. The condition above will be false and no return is called. The method continues with deleting all entries in oxuserbasketitems and therefore clears the wish list and gift registry.

This leaves two questions: First of all, at the given time, I'm not sure why all entries are cleared on the mentioned line

https://github.com/OXID-eSales/oxideshop_ce/blob/4d0b7ffcec290dc784b144cdd90fc268f2b2dab1/source/Application/Model/BasketReservation.php#L316

It seems obvious that there needs to be another condition like oxtitle = reservation or oxtitle = savedbasket. However, there may be a reason for the decision. More investigation from our developers is needed.

The second question is, why a new reservation is inserted while the basket is empty. This may be not an issue for itself, but leads to the given behavior. I can't think of a reason to create an reservation for no items at all.

Adding the second condition to the query might be an easy fix (or quick workaround), but catching and cancel the reservation on an empty cart may be the better solution. As always, the decision is with our Development Team. I acknowledge the report.

[sp]