Skip to content

Commit 3d864bb

Browse files
authored
Fix category is not saved in right store view
1 parent b164dec commit 3d864bb

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Model/Import/Categories.php

+5
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,10 @@ public function execute(array $data): void
5050
*/
5151
private function processStore(int $storeId, array $rows): void
5252
{
53+
$currentStore = $this->storeManager->getStore();
54+
$this->storeManager->setCurrentStore($storeId);
5355
$collection = $this->createCollection($storeId, array_column($rows, 'category_code'));
56+
5457
try {
5558
foreach ($rows as $row) {
5659
$category = $collection->getItemByColumnValue('category_code', $row['category_code'])
@@ -72,6 +75,8 @@ private function processStore(int $storeId, array $rows): void
7275
$e->getMessage()]
7376
)
7477
);
78+
} finally {
79+
$this->storeManager->setCurrentStore($currentStore);
7580
}
7681
}
7782

0 commit comments

Comments
 (0)