} $new_color_str = implode(",", $color_arr); $productMgr->updateColor($product_id, $new_color_str); $productMgr->deleteColorOptionalCodeByProductColor($product_id, $photo_type); $return = []; $return['status'] = 'success'; echo json_encode($return); } elseif ($operation === "updateColor") { $product_id = addslashes(filter_input(INPUT_POST, 'product_id')); $new_color = addslashes(filter_input(INPUT_POST, 'new_color')); $old_color = addslashes(filter_input(INPUT_POST, 'old_color')); $color_str = $productMgr->getColor($product_id); $new_color_str = str_replace($old_color, $new_color, $color_str); $productMgr->updateColor($product_id, $new_color_str); $productMgr->updateColorInOptionalCodeTable($product_id, $new_color, $old_color); $photoMgr->updateColorInPhotoTable($product_id, $new_color, $old_color); $return = []; $return['status'] = 'success'; echo json_encode($return); } elseif ($operation === "updateColorSymbolCode") { $product_id = addslashes(filter_input(INPUT_POST, 'product_id')); $color = addslashes(filter_input(INPUT_POST, 'color')); $symbol_code = addslashes(filter_input(INPUT_POST, 'symbol_code')); $productMgr->updateProductColorOptionalCode($product_id, $color, $symbol_code); $return = []; $return['status'] = 'success'; echo json_encode($return); } elseif ($operation === "deleteProduct") { $productIdList_str = filter_input(INPUT_POST, 'productIdList'); $productIdList = explode(",", $productIdList_str); foreach ($productIdList as $id) {