Skip to content

Commit

Permalink
fix EC-CUBE#125 親カテゴリIDの処理漏れを修正。非推奨メソッドの利用を回避。
Browse files Browse the repository at this point in the history
  • Loading branch information
seasoftjapan committed Feb 16, 2024
1 parent 6e70fb9 commit 5dacb7e
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions data/class/helper/SC_Helper_DB.php
Original file line number Diff line number Diff line change
Expand Up @@ -837,12 +837,15 @@ public function sfCountCategory($objQuery = NULL, $is_force_all_count = false, $
}
}

// 差分があったIDとその親カテゴリID
$arrTgtCategoryId = $arrNotExistsProductCategoryId;

foreach ($arrNotExistsProductCategoryId as $category_id) {
$objQuery->delete('dtb_category_count', 'category_id = ?', array($category_id));
}

// 差分があったIDとその親カテゴリID
$arrTgtCategoryId = $arrNotExistsProductCategoryId;
$arrParentID = self::sfGetParentsArray('dtb_category', 'parent_category_id', 'category_id', $category_id);
$arrTgtCategoryId = array_merge($arrTgtCategoryId, $arrParentID);
}

// dtb_category_countの更新 差分のあったカテゴリだけ更新する。
foreach ($arrNew as $category_id => $count) {
Expand All @@ -855,7 +858,7 @@ public function sfCountCategory($objQuery = NULL, $is_force_all_count = false, $
$sqlval['category_id'] = $category_id;
$objQuery->insert('dtb_category_count', $sqlval);
}
$arrParentID = $this->sfGetParents('dtb_category', 'parent_category_id', 'category_id', $category_id);
$arrParentID = self::sfGetParentsArray('dtb_category', 'parent_category_id', 'category_id', $category_id);
$arrTgtCategoryId = array_merge($arrTgtCategoryId, $arrParentID);
}
$arrTgtCategoryId = array_unique($arrTgtCategoryId);
Expand Down

0 comments on commit 5dacb7e

Please sign in to comment.