Skip to content

Commit a0be69b

Browse files
committed
Fixing the Products grid with default values on multi stores
1 parent 10f900e commit a0be69b

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

app/code/Magento/Catalog/Ui/DataProvider/Product/ProductDataProvider.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
use Magento\Catalog\Model\ResourceModel\Product\CollectionFactory;
99
use Magento\Framework\App\ObjectManager;
10+
use Magento\Store\Model\Store;
1011
use Magento\Ui\DataProvider\Modifier\ModifierInterface;
1112
use Magento\Ui\DataProvider\Modifier\PoolInterface;
1213

@@ -67,6 +68,7 @@ public function __construct(
6768
$this->addFieldStrategies = $addFieldStrategies;
6869
$this->addFilterStrategies = $addFilterStrategies;
6970
$this->modifiersPool = $modifiersPool ?: ObjectManager::getInstance()->get(PoolInterface::class);
71+
$this->setDefaultStoreToCollection();
7072
}
7173

7274
/**
@@ -140,4 +142,12 @@ public function getMeta()
140142

141143
return $meta;
142144
}
145+
146+
/**
147+
* Filter the product collection by Default Store if no filter is applied
148+
*/
149+
private function setDefaultStoreToCollection()
150+
{
151+
$this->getCollection()->setStoreId(Store::DEFAULT_STORE_ID);
152+
}
143153
}

0 commit comments

Comments
 (0)