Skip to content

Commit d01f715

Browse files
author
Cari Spruiell
committed
Merge remote-tracking branch 'mainline/develop' into api-sprint-61-pr
2 parents 4aa478f + 720667e commit d01f715

File tree

38 files changed

+793
-557
lines changed

38 files changed

+793
-557
lines changed

app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/checkboxes/tree.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
<?php $_divId = 'tree-div_' . time() ?>
1212
<div id="<?php /* @escapeNotVerified */ echo $_divId ?>" class="tree"></div>
13-
<script id="ie-deferred-loader" defer="defer" src=""></script>
13+
<script id="ie-deferred-loader" defer="defer" src="//:"></script>
1414
<script>
1515
require([
1616
'jquery',

app/code/Magento/Catalog/view/adminhtml/templates/catalog/category/widget/tree.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<?php $_divId = 'tree' . $block->getId() ?>
1212
<div id="<?php /* @escapeNotVerified */ echo $_divId ?>" class="tree"></div>
1313
<!--[if IE]>
14-
<script id="ie-deferred-loader" defer="defer" src=""></script>
14+
<script id="ie-deferred-loader" defer="defer" src="//:"></script>
1515
<![endif]-->
1616
<script>
1717
require(['jquery', "prototype", "extjs/ext-tree-checkbox"], function(jQuery){

app/code/Magento/Catalog/view/adminhtml/templates/catalog/product/attribute/set/main.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
<span class="title"><?php /* @escapeNotVerified */ echo __('Unassigned Attributes') ?></span>
3939
</div>
4040
<div id="tree-div2" class="attribute-set-tree"></div>
41-
<script id="ie-deferred-loader" defer="defer" src=""></script>
41+
<script id="ie-deferred-loader" defer="defer" src="//:"></script>
4242
<script>
4343
define("tree-panel",
4444
[

app/code/Magento/CatalogImportExport/Model/Import/Product.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1963,7 +1963,7 @@ protected function _saveStockItem()
19631963
$productIdsToReindex[] = $row['product_id'];
19641964

19651965
$row['website_id'] = $this->stockConfiguration->getDefaultScopeId();
1966-
$row['stock_id'] = $this->stockRegistry->getStock()->getStockId();
1966+
$row['stock_id'] = $this->stockRegistry->getStock($row['website_id'])->getStockId();
19671967

19681968
$stockItemDo = $this->stockRegistry->getStockItem($row['product_id'], $row['website_id']);
19691969
$existStockData = $stockItemDo->getData();

app/code/Magento/CatalogInventory/Api/StockRegistryInterface.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
interface StockRegistryInterface
1313
{
1414
/**
15-
* @param int|null $stockId
15+
* @param int $scopeId
1616
* @return \Magento\CatalogInventory\Api\Data\StockInterface
1717
*/
18-
public function getStock($stockId = null);
18+
public function getStock($scopeId = null);
1919

2020
/**
2121
* @param int $productId

app/code/Magento/CatalogInventory/Api/StockStatusCriteriaInterface.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,31 +15,31 @@ interface StockStatusCriteriaInterface extends \Magento\Framework\Api\CriteriaIn
1515
* Add Criteria object
1616
*
1717
* @param \Magento\CatalogInventory\Api\StockStatusCriteriaInterface $criteria
18-
* @return void
18+
* @return bool
1919
*/
2020
public function addCriteria(\Magento\CatalogInventory\Api\StockStatusCriteriaInterface $criteria);
2121

2222
/**
2323
* Filter by scope(s)
2424
*
2525
* @param int $scope
26-
* @return void
26+
* @return bool
2727
*/
2828
public function setScopeFilter($scope);
2929

3030
/**
3131
* Add product(s) filter
3232
*
3333
* @param int $products
34-
* @return void
34+
* @return bool
3535
*/
3636
public function setProductsFilter($products);
3737

3838
/**
3939
* Add filter by quantity
4040
*
4141
* @param float $qty
42-
* @return void
42+
* @return bool
4343
*/
4444
public function setQtyFilter($qty);
4545
}

app/code/Magento/CatalogInventory/Helper/Stock.php

Lines changed: 7 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
namespace Magento\CatalogInventory\Helper;
77

88
use Magento\CatalogInventory\Model\Spi\StockRegistryProviderInterface;
9-
use Magento\CatalogInventory\Model\Spi\StockResolverInterface;
109
use Magento\Store\Model\StoreManagerInterface;
1110
use Magento\Framework\App\Config\ScopeConfigInterface;
1211
use Magento\CatalogInventory\Model\ResourceModel\Stock\StatusFactory;
@@ -48,45 +47,36 @@ class Stock
4847
*/
4948
private $stockRegistryProvider;
5049

51-
/**
52-
* @var StockResolverInterface
53-
*/
54-
protected $stockResolver;
55-
5650
/**
5751
* @param StoreManagerInterface $storeManager
5852
* @param ScopeConfigInterface $scopeConfig
5953
* @param StatusFactory $stockStatusFactory
6054
* @param StockRegistryProviderInterface $stockRegistryProvider
61-
* @param StockResolverInterface $stockResolver
6255
*/
6356
public function __construct(
6457
StoreManagerInterface $storeManager,
6558
ScopeConfigInterface $scopeConfig,
6659
StatusFactory $stockStatusFactory,
67-
StockRegistryProviderInterface $stockRegistryProvider,
68-
StockResolverInterface $stockResolver
60+
StockRegistryProviderInterface $stockRegistryProvider
6961
) {
7062
$this->storeManager = $storeManager;
7163
$this->scopeConfig = $scopeConfig;
7264
$this->stockStatusFactory = $stockStatusFactory;
7365
$this->stockRegistryProvider = $stockRegistryProvider;
74-
$this->stockResolver = $stockResolver;
7566
}
7667

7768
/**
7869
* Assign stock status information to product
7970
*
8071
* @param Product $product
81-
* @param int $stockStatus
72+
* @param int $status
8273
* @return void
8374
*/
84-
public function assignStatusToProduct(Product $product, $stockStatus = null)
75+
public function assignStatusToProduct(Product $product, $status = null)
8576
{
86-
if ($stockStatus === null) {
87-
$productId = $product->getId();
88-
$stockId = $this->stockResolver->getStockId($productId, $product->getStore()->getWebsiteId());
89-
$stockStatus = $this->stockRegistryProvider->getStockStatus($productId, $stockId);
77+
if ($status === null) {
78+
$websiteId = $product->getStore()->getWebsiteId();
79+
$stockStatus = $this->stockRegistryProvider->getStockStatus($product->getId(), $websiteId);
9080
$status = $stockStatus->getStockStatus();
9181
}
9282
$product->setIsSalable($status);
@@ -103,8 +93,7 @@ public function addStockStatusToProducts(AbstractCollection $productCollection)
10393
$websiteId = $this->storeManager->getStore($productCollection->getStoreId())->getWebsiteId();
10494
foreach ($productCollection as $product) {
10595
$productId = $product->getId();
106-
$stockId = $this->stockResolver->getStockId($productId, $websiteId);
107-
$stockStatus = $this->stockRegistryProvider->getStockStatus($productId, $stockId);
96+
$stockStatus = $this->stockRegistryProvider->getStockStatus($productId, $websiteId);
10897
$status = $stockStatus->getStockStatus();
10998
$product->setIsSalable($status);
11099
}

app/code/Magento/CatalogInventory/Model/Spi/StockRegistryProviderInterface.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,22 +11,22 @@
1111
interface StockRegistryProviderInterface
1212
{
1313
/**
14-
* @param int|null $stockId
14+
* @param int $scopeId
1515
* @return \Magento\CatalogInventory\Api\Data\StockInterface
1616
*/
17-
public function getStock($stockId);
17+
public function getStock($scopeId);
1818

1919
/**
2020
* @param int $productId
21-
* @param int $stockId
21+
* @param int $scopeId
2222
* @return \Magento\CatalogInventory\Api\Data\StockItemInterface
2323
*/
24-
public function getStockItem($productId, $stockId);
24+
public function getStockItem($productId, $scopeId);
2525

2626
/**
2727
* @param int $productId
28-
* @param int $stockId
28+
* @param int $scopeId
2929
* @return \Magento\CatalogInventory\Api\Data\StockStatusInterface
3030
*/
31-
public function getStockStatus($productId, $stockId);
31+
public function getStockStatus($productId, $scopeId);
3232
}

app/code/Magento/CatalogInventory/Model/Spi/StockResolverInterface.php

Lines changed: 0 additions & 19 deletions
This file was deleted.

app/code/Magento/CatalogInventory/Model/Stock/Item.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ public function getStockId()
177177
{
178178
$stockId = $this->getData(static::STOCK_ID);
179179
if ($stockId === null) {
180-
$stockId = $this->stockRegistry->getStock()->getStockId();
180+
$stockId = $this->stockRegistry->getStock($this->getWebsiteId())->getStockId();
181181
}
182182
return (int) $stockId;
183183
}

0 commit comments

Comments
 (0)