|
3 | 3 | * Copyright © Magento, Inc. All rights reserved.
|
4 | 4 | * See COPYING.txt for license details.
|
5 | 5 | */
|
| 6 | +declare(strict_types=1); |
| 7 | + |
6 | 8 | namespace Magento\Checkout\Controller\Sidebar;
|
7 | 9 |
|
8 | 10 | use Magento\Checkout\Model\Cart\RequestQuantityProcessor;
|
|
12 | 14 | use Magento\Framework\App\RequestInterface;
|
13 | 15 | use Magento\Framework\App\Response\Http;
|
14 | 16 | use Magento\Framework\App\ResponseInterface;
|
15 |
| -use Magento\Framework\Exception\InputException; |
16 | 17 | use Magento\Framework\Exception\LocalizedException;
|
17 | 18 | use Magento\Framework\Json\Helper\Data;
|
18 | 19 | use Psr\Log\LoggerInterface;
|
@@ -83,13 +84,13 @@ public function __construct(
|
83 | 84 | public function execute()
|
84 | 85 | {
|
85 | 86 | $itemId = (int)$this->request->getParam('item_id');
|
86 |
| - $itemQty = $this->request->getParam('item_qty'); |
| 87 | + $itemQty = (int)$this->request->getParam('item_qty'); |
87 | 88 |
|
88 |
| - if (!is_numeric($itemQty) || ($itemQty <=0)) { |
89 |
| - $e = new InputException(__('A non-numeric value found')) ; |
90 |
| - return $this->jsonResponse($e->getMessage()); |
| 89 | + if ($itemQty <= 0) { |
| 90 | + return $this->jsonResponse(__('A non-numeric value found')); |
91 | 91 | }
|
92 | 92 | $itemQty = $this->quantityProcessor->prepareQuantity($itemQty);
|
| 93 | + |
93 | 94 | try {
|
94 | 95 | $this->sidebar->checkQuoteItem($itemId);
|
95 | 96 | $this->sidebar->updateQuoteItem($itemId, $itemQty);
|
|
0 commit comments