예제 #1
0
<?php

include "models/function.php";
IncludeClass::inc(array("Product"));
if (isset($_POST["go"])) {
    $nn = DB::selectAI("price");
    $attr = AttrValue::conbine($_POST["attr"], $_POST["val"]);
    if (isset($_POST["related"]) and $_POST["related"]) {
        $related = array_slice($_POST["related"], 0, 3);
        $data_related = serialize($related);
    } else {
        $data_related = "";
    }
    $arrText = array("section" => $_POST['section'], "collection" => $_POST['collection'], "exclusive" => $_POST['exclusive'], "name" => $_POST['name'], "nomer" => $_POST['nomer'], "code" => $_POST['code'], "size" => $_POST['size'], "material" => $_POST['material'], "proba" => $_POST['proba'], "vstavki" => $_POST['vstavki'], "weight" => $_POST['weight'], "price" => $_POST['price'], "price_old" => $_POST['price_old'], "attr" => $attr, "related" => $data_related, "title" => $_POST['title'], "description" => $_POST['description'], "keywords" => $_POST['keywords']);
    if ($_POST["go"] == "save") {
        $arrText += array('nn' => $nn, 'sk40' => 0, 'sk50' => 0);
        if (isset($arrText['related']) && !empty($arrText['related'])) {
            //$next_sql = " AND NOT id=";
            $proverka = DB::selectParam('price', 'nomer', $arrText['nomer'], false, false, false, false);
            $arr_prov = array("related" => $arrText['related']);
            if ($proverka != false && empty($proverka['related'])) {
                foreach ($proverka as $prov) {
                    DB::update(DB::updateSql("price", $arr_prov), $arr_prov, $prov['id']);
                }
            }
        }
        $lastId = DB::insert(DB::insertSql("price", $arrText), $arrText);
    } else {
        $lastId = $_POST["go"];
        if (isset($arrText['related']) && !empty($arrText['related'])) {
            $next_sql = " AND NOT id=" . $lastId;
예제 #2
0
<?php

include "models/function.php";
if (isset($_POST["go"])) {
    $objImg = new UploadImg();
    $name_img = $objImg->upload($_FILES, $_POST["photo_now"]);
    $objAttr = new AttrValue();
    $data_attr = $objAttr->conbine($_POST["attr"], $_POST["val"]);
    if (isset($_POST["related"]) and $_POST["related"]) {
        $related = array_slice($_POST["related"], 0, 4);
        $data_related = serialize($related);
    } else {
        $data_related = "";
    }
    require_once "classes/Product.php";
    $obj = new Product();
    if ($_POST["go"] == "save") {
        $fff = $obj->insert($obj->insertSql(), trimStr($_POST["section"]), trimStr($_POST["name"]), trimStr($_POST["nomer"]), trimStr($_POST["brand"]), trimStr($_POST["viscous"]), trimStr($_POST["type"]), trimStr($_POST["volume"]), trimStr($_POST["kol"]), trimStr($_POST["price"]), trimStr($_POST["text"]), $data_related, $data_attr, trimStr($_POST["title"]), trimStr($_POST["description"]), trimStr($_POST["keywords"]), $name_img, trimStr($_POST["img_title"]), trimStr($_POST["img_alt"]));
        header("Location: production.php?id=" . $_POST["section"]);
    } else {
        $obj->update($obj->updateSql(), trimStr($_POST["section"]), trimStr($_POST["name"]), trimStr($_POST["nomer"]), trimStr($_POST["brand"]), trimStr($_POST["viscous"]), trimStr($_POST["type"]), trimStr($_POST["volume"]), trimStr($_POST["kol"]), trimStr($_POST["price"]), trimStr($_POST["text"]), $data_related, $data_attr, trimStr($_POST["title"]), trimStr($_POST["description"]), trimStr($_POST["keywords"]), $name_img, trimStr($_POST["img_title"]), trimStr($_POST["img_alt"]), $_POST['go']);
        header("Location: production.php?id=" . $_POST["section"]);
    }
}
if (isset($_GET["delete"])) {
    $delete = new Delete();
    $delete->del($_GET["title"], $_GET["delete"]);
    header("Location: production.php?id=" . $_GET["delete"]);
}
require_once "classes/Catalog.php";
$section = new Catalog();