Exemple #1
0
function catDeleteCategory($categoryID)
{
    _deleteSubCategories($categoryID);
    $q = db_query("select productID FROM " . PRODUCTS_TABLE . " where categoryID=" . (int) $categoryID);
    if ($picture = db_fetch_row($q)) {
        DeleteThreePictures2($picture["productID"]);
    }
    db_query("delete FROM " . PRODUCTS_TABLE . " WHERE categoryID=" . (int) $categoryID);
    db_query("delete FROM " . CATEGORIES_TABLE . " WHERE parent=" . (int) $categoryID);
    $q = db_query("select picture FROM " . CATEGORIES_TABLE . " WHERE categoryID=" . (int) $categoryID);
    $r = db_fetch_row($q);
    if ($r["picture"] && file_exists("data/category/" . $r["picture"])) {
        unlink("data/category/" . $r["picture"]);
    }
    db_query("delete FROM " . CATEGORIES_TABLE . " WHERE categoryID=" . (int) $categoryID);
}
Exemple #2
0
function DeleteProduct($productID, $updateGCV = 1)
{
    $whereClause = " where productID=" . (int) $productID;
    $q = db_query("select itemID from " . SHOPPING_CART_ITEMS_TABLE . " " . $whereClause);
    while ($row = db_fetch_row($q)) {
        db_query("delete from " . SHOPPING_CARTS_TABLE . " where itemID=" . (int) $row["itemID"]);
    }
    // delete all items for this product
    db_query("update " . SHOPPING_CART_ITEMS_TABLE . " set productID=NULL " . $whereClause);
    // delete all product option values
    db_query("delete from " . PRODUCTS_OPTIONS_SET_TABLE . $whereClause);
    db_query("delete from " . PRODUCT_OPTIONS_VALUES_TABLE . $whereClause);
    // delete pictures
    DeleteThreePictures2($productID);
    // delete additional categories records
    db_query("delete from " . CATEGORIY_PRODUCT_TABLE . $whereClause);
    // delete discussions
    db_query("delete from " . DISCUSSIONS_TABLE . $whereClause);
    // delete special offer
    db_query("delete from " . SPECIAL_OFFERS_TABLE . $whereClause);
    // delete related items
    db_query("delete from " . RELATED_PRODUCTS_TABLE . $whereClause);
    db_query("delete from " . RELATED_PRODUCTS_TABLE . " where Owner=" . (int) $productID);
    // delete product
    db_query("delete from " . PRODUCTS_TABLE . $whereClause);
    if ($updateGCV == 1 && CONF_UPDATE_GCV == '1') {
        update_psCount(1);
    }
    return true;
}