require_once "DataBase/Price.php"; $db_action = var_get_post("db_action", ""); $product = new Product(); $tax = new Tax(); $category = new Category(); $priceset = new Priceset(); $price = new Price(); $group = new Group(); switch ($db_action) { case "new": $product->create(var_post("product_id", ""), array(var_post("name", ""), var_post("details", ""), var_post("category_id", ""), var_post("tax_id", ""), var_post("available", ""), var_post("group_id", ""), var_post("order_number", ""), var_post("anmerkung", ""))); $priceset_list = $priceset->get(); for ($i = 0; $i < count($priceset_list); $i++) { $price->create(var_post("priceset_id_" . $i, ""), var_post("product_id", ""), array(var_post("priceset_price_" . $i, ""))); } break; case "edit": $product->update(var_post("product_id", ""), array(var_post("name", ""), var_post("details", ""), var_post("category_id", ""), var_post("tax_id", ""), var_post("available", ""), var_post("group_id", ""), var_post("order_number", ""), var_post("anmerkung", ""))); $priceset_list = $priceset->get(); for ($i = 0; $i < count($priceset_list); $i++) { if ($price->exists(var_post("priceset_id_" . $i, ""), var_post("product_id", ""))) { $price->update(var_post("priceset_id_" . $i, ""), var_post("product_id", ""), array(var_post("priceset_price_" . $i, ""))); } else { $price->create(var_post("priceset_id_" . $i, ""), var_post("product_id", ""), array(var_post("priceset_price_" . $i, ""))); } } break; case "delete": $product->delete(var_get("product_id", "")); break; }