Skip to content

Commit

Permalink
商品在庫テーブルにレコードが存在しなかった場合にエラーで止まる fix
Browse files Browse the repository at this point in the history
  • Loading branch information
watarukashii committed Apr 8, 2022
1 parent 91a9761 commit 98ca18a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/Eccube/Controller/Admin/Product/CsvImportController.php
Original file line number Diff line number Diff line change
Expand Up @@ -1385,6 +1385,13 @@ protected function updateProductClass($row, Product $Product, ProductClass $Prod

$ProductStock = $ProductClass->getProductStock();

// 在庫テーブルに存在しない場合、新規作成
if (!$ProductStock instanceof ProductStock) {
$ProductStock = new ProductStock();
$ProductClass->setProductStock($ProductStock);
$ProductStock->setProductClass($ProductClass);
}

if (!$ProductClass->isStockUnlimited()) {
$ProductStock->setStock($ProductClass->getStock());
} else {
Expand Down

0 comments on commit 98ca18a

Please sign in to comment.