@@ -324,14 +324,15 @@ public function cancelPayPalPayment()
324
324
exit ;
325
325
}
326
326
327
- protected function addToBasket ($ qty = 1 ): void
327
+ protected function addToBasket (): void
328
328
{
329
329
$ basket = Registry::getSession ()->getBasket ();
330
330
$ utilsView = Registry::getUtilsView ();
331
331
$ aSel = Registry::getRequest ()->getRequestParameter ('sel ' );
332
+ $ qty = (double )Registry::getRequest ()->getRequestParameter ('amountToBasket ' ) ?? 0 ;
332
333
if ($ aid = (string )Registry::getRequest ()->getRequestEscapedParameter ('aid ' )) {
333
334
try {
334
- if (!$ this ->itemExists ($ basket , $ aid )) {
335
+ if (!$ this ->itemExists ($ basket , $ aid, $ qty )) {
335
336
$ basket ->addToBasket ($ aid , $ qty , $ aSel );
336
337
$ basket ->isNewItemAdded ();
337
338
}
@@ -605,15 +606,15 @@ public function createApplepayOrder()
605
606
$ this ->outputJson ($ response );
606
607
}
607
608
608
- private function itemExists (?Basket $ basket , ?string $ articleOxid ): bool
609
+ private function itemExists (?Basket $ basket , ?string $ articleOxid, ? int $ amountToBasket ): bool
609
610
{
610
611
if ($ basket === null ) {
611
612
return false ;
612
613
}
613
614
614
615
$ basketContents = $ basket ->getContents ();
615
616
foreach ($ basketContents as $ basketItem ) {
616
- if ($ basketItem ->getProductId () === $ articleOxid ) {
617
+ if ($ basketItem ->getProductId () === $ articleOxid && $ basketItem -> getAmount () === $ amountToBasket ) {
617
618
return true ;
618
619
}
619
620
}
0 commit comments