예제 #1
0
                    $pic_path = "public_html/img/detailImg/" . $pics;
                    move_uploaded_file($_FILES[$photo_name]['tmp_name'], $pic_path);
                    $imgColor = $_POST['color4'];
                    $imgURL_arr[$imgColor] = $pic_path;
                    $colorOptionalCode_arr[$imgColor] = $_POST['color_symbol_code4'];
                    break;
            }
        }
    }
    $colorArr = array_keys($imgURL_arr);
    $colors = implode(",", $colorArr);
    $productMgr->addProduct($product_id, $product_name, $symbol_code, $price, $colors, $description, $stock);
    $photoMgr->AddPhoto($product_id, 'thumbnail', $imgURL_thumbnail);
    foreach ($colorArr as $color) {
        $photoMgr->AddPhoto($product_id, $color, $imgURL_arr[$color]);
        $productMgr->addProductColorOptionalCode($product_id, $color, $colorOptionalCode_arr[$color]);
    }
    header("Location: admin.php#viewProduct");
} elseif ($operation === "edit_product") {
    $valid = true;
    $product_id = filter_input(INPUT_POST, 'edit_product_id');
    $existingPhotoList = $photoMgr->getPhotos($product_id);
    $product_name = filter_input(INPUT_POST, 'edit_product_name');
    $symbol_code = filter_input(INPUT_POST, 'edit_symbol_code');
    if (empty($symbol_code)) {
        $symbol_code = '';
    }
    $price = filter_input(INPUT_POST, 'edit_price');
    $color_count = 0;
    $color = "";
    $description = "";