[TYPO3-commerce] Basket can contain deleted articles

Franz Koch typo.removeformessage at fx-graefix.de
Tue Sep 25 21:17:04 CEST 2007


Hi guys,

I just figured out, that the basket can contain articles that where 
already deleted (and are possibly also out of stock - didn't check that 
yet).
I noticed it, because I had a session stored basket with some articles 
from a previous visit and did another test with the shop. Then I went to 
the basket and noticed, that my total sum did not match the displayed 
articles - so I had a look in the db and saw, that my basket contained 6 
instead of the displayed 3 articles. Then I noticed, that my customer 
deleted those articles in the backend - but the articles where still 
charged in the total sum of the basket and in the checkout process.

After that I wrote a little check and hooked it in with the hook 
'preAddArticle' I introduced in one of my patches for 
'class.tx_commerce_basic_basket.php'.

What I do? I simply run a little query against the article table if the 
article is still available (with check for the enableFields). If not, I 
simply set the quantity to 0 and everything is fine.


But in general, this should not occur, and I saw that there is some kind 
of failsafe implemented in class.tx_commerce_basket_item.php in the 
init-method. But this failsafe doesn't check for deleted articles, as 
the failsafe itself doesn't do any check for availability and doesn't 
load any data from the db, as it only check if there is in general a 
valid article object.


So I ask you if you also consider this as a bug. Please let me know your 
thougts about that. If you guys also think this is a (major) bug I'll 
post it to bugtracker and provide a patch for it.

--
Kind regards,
Franz Koch


More information about the TYPO3-project-commerce mailing list