This repository has been archived by the owner on Dec 19, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 154
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3915 from magento-epam/EPAM-PR-47
- Fixed "My Wishlist - quantity input box issue" - [GitHub] Can't use "configurable" as the group name in attribute sets M2.1 #6123
- Loading branch information
Showing
7 changed files
with
128 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -210,4 +210,3 @@ | |
</arguments> | ||
</type> | ||
</config> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Magento\Wishlist\ViewModel; | ||
|
||
use Magento\Catalog\Controller\Adminhtml\Product\Initialization\StockDataFilter; | ||
use Magento\Catalog\Model\Product\Configuration\Item\ItemInterface; | ||
use Magento\CatalogInventory\Model\StockRegistry; | ||
use Magento\Framework\View\Element\Block\ArgumentInterface; | ||
|
||
/** | ||
* ViewModel for Wishlist Cart Block | ||
*/ | ||
class AllowedQuantity implements ArgumentInterface | ||
{ | ||
/** | ||
* @var StockRegistry | ||
*/ | ||
private $stockRegistry; | ||
|
||
/** | ||
* @var ItemInterface | ||
*/ | ||
private $item; | ||
|
||
/** | ||
* @param StockRegistry $stockRegistry | ||
*/ | ||
public function __construct(StockRegistry $stockRegistry) | ||
{ | ||
$this->stockRegistry = $stockRegistry; | ||
} | ||
|
||
/** | ||
* Set product configuration item | ||
* | ||
* @param ItemInterface $item | ||
* @return self | ||
*/ | ||
public function setItem(ItemInterface $item): self | ||
{ | ||
$this->item = $item; | ||
return $this; | ||
} | ||
|
||
/** | ||
* Get product configuration item | ||
* | ||
* @return ItemInterface | ||
*/ | ||
public function getItem(): ItemInterface | ||
{ | ||
return $this->item; | ||
} | ||
|
||
/** | ||
* Get min and max qty for wishlist form. | ||
* | ||
* @return array | ||
*/ | ||
public function getMinMaxQty(): array | ||
{ | ||
$product = $this->getItem()->getProduct(); | ||
$stockItem = $this->stockRegistry->getStockItem($product->getId(), $product->getStore()->getWebsiteId()); | ||
$params = []; | ||
|
||
$params['minAllowed'] = (float)$stockItem->getMinSaleQty(); | ||
if ($stockItem->getMaxSaleQty()) { | ||
$params['maxAllowed'] = (float)$stockItem->getMaxSaleQty(); | ||
} else { | ||
$params['maxAllowed'] = (float)StockDataFilter::MAX_QTY_VALUE; | ||
} | ||
|
||
return $params; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters