-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ENGCOM-3611: Set view models as shareable by default #18541
- Merge Pull Request #18541 from thomas-kl1/magento2:patch/layout-block-argument-shareable - Merged commits: 1. 9a7f3e6 2. 415288f 3. 32f2813 4. 02d475c 5. 3959725
- Loading branch information
Showing
4 changed files
with
562 additions
and
23 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
55 changes: 55 additions & 0 deletions
55
...Magento/Sales/Block/Adminhtml/Order/Create/Search/Grid/DataProvider/ProductCollection.php
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,55 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Magento\Sales\Block\Adminhtml\Order\Create\Search\Grid\DataProvider; | ||
|
||
use Magento\Catalog\Model\ResourceModel\Product\CollectionFactory as ProductCollectionFactory; | ||
use Magento\Catalog\Model\ResourceModel\Product\Collection; | ||
use Magento\Store\Model\Store; | ||
|
||
/** | ||
* Prepares product collection for the grid | ||
*/ | ||
class ProductCollection | ||
{ | ||
/** | ||
* @var ProductCollectionFactory | ||
*/ | ||
private $collectionFactory; | ||
|
||
/** | ||
* @param ProductCollectionFactory $collectionFactory | ||
*/ | ||
public function __construct( | ||
ProductCollectionFactory $collectionFactory | ||
) { | ||
$this->collectionFactory = $collectionFactory; | ||
} | ||
|
||
/** | ||
* Provide products collection filtered with store | ||
* | ||
* @param Store $store | ||
* @return Collection | ||
*/ | ||
public function getCollectionForStore(Store $store):Collection | ||
{ | ||
/** @var Collection $collection */ | ||
$collection = $this->collectionFactory->create(); | ||
|
||
$collection->setStore($store); | ||
$collection->addAttributeToSelect( | ||
'gift_message_available' | ||
); | ||
$collection->addAttributeToSelect( | ||
'sku' | ||
); | ||
$collection->addStoreFilter(); | ||
|
||
return $collection; | ||
} | ||
} |
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
Oops, something went wrong.