function process($form_data) { include "Helper.php"; // pretty_print_array($form_data); $a = session_id(); include "connect.php"; $conn = init($_SESSION["permission_type"]); $result = array(); if (isset($form_data["transportoffer---relation"])) { $result = deleteTransportOffer($form_data, $conn); } else { if (isset($form_data["user---relation"])) { $result = deleteUser($form_data, $conn); } else { if (isset($form_data["contract---relation"])) { $result = deleteContract($form_data, $conn); } else { if (isset($form_data["market---relation"])) { $result = deleteMarket($form_data, $conn); } else { if (isset($form_data["transportoffer---relation"])) { $result = deleteTransportOffer($form_data, $conn); } else { if (isset($form_data["immigrants---relation"])) { $result = deleteImigrants($form_data, $conn); } else { if (isset($form_data["product---relation"])) { $result = deleteProduct($form_data, $conn); } else { if (isset($form_data["transportcompany---relation"])) { $result = deleteTransportCompany($form_data, $conn); } else { if (isset($form_data["flavour---relation"])) { $result = deleteTaste($form_data, $conn); } else { if (isset($form_data["storagetype---relation"])) { $result = deleteStoragetype($form_data, $conn); } else { if (isset($form_data["country---relation"])) { $result = deleteCountry($form_data, $conn); } } } } } } } } } } } if ($result["error"] == "") { $returnedData = $conn->query($result["data"]); } if ($conn->connect_errno) { $result["error"] = $conn->connect_error; } $result["data"] = ""; echo json_encode($result); }
<?php selectProductDropbox(); ?> </select> </p> <input type="submit" value="Löschen"> <?php if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST["product"])) { $product = filterfunktion($_POST["product"]); if ($_POST["product"] != "") { try { deleteProduct($product); //TO DO leere.php ersetzen mit Auflistung der eingegebenen Daten //header('Location: leere.php'); } catch (Exception $e) { echo "Fehler beim Datenbankzugriff. Bitte dem Administrator Bescheid geben."; } } } ?> </form> <!-- ADD PRODUCT --> <form onSubmit="return" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]); ?> " method="post">
$packages[$key]['end_date'] = '20' . $packageEndDate[2] . '-' . $packageEndDate[1] . '-' . $packageEndDate[0]; } } $today = date('Y-m-d', time()); foreach ($categories as $key => $category) { if ($category['subcategory_id'] != NULL && $category['subcategory_name'] != NULL) { $cat['id'] = explode(',', $category['subcategory_id']); $cat['name'] = explode(',', $category['subcategory_name']); $max = count($cat['id']); for ($i = 0; $i <= $max - 1; $i++) { $categories[$key]['subcategories'][$i]['id'] = $cat['id'][$i]; $categories[$key]['subcategories'][$i]['name'] = $cat['name'][$i]; } } } if (isset($detail) && $detail == 'delete') { if (isset($_POST['confirm']) && $_POST['confirm'] == 1) { $response = deleteProduct($_POST['product_id'], $db); if ($response) { $msg['class'] = 'success'; $msg['msg'] = 'Produkt wurde gelöscht!'; header('Location: /dashboard/edit'); } else { $msg['class'] = 'error'; $msg['msg'] = 'Produkt konnte nicht gelöscht werden!'; } } else { $msg['class'] = 'error'; $msg['msg'] = 'Sie müssen den Löschvorgang bestätigen!'; } }
include_once '../../functions/products-functions.php'; ?> <!-- Latest compiled and minified CSS --> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css"> <!-- Optional theme --> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css"> </head> <body> <?php require_once '../../includes/session-start.req-inc.php'; require_once '../../includes/access-required.html.php'; $id = filter_input(INPUT_GET, 'id'); $img = filter_input(INPUT_GET, 'img'); unlink($img); $isDeleted = deleteProduct($id); ?> <h1> Record <?php echo $id; ?> <?php if (!$isDeleted) { ?> Not<?php } ?> Deleted </h1>
<?php include "db_facade.php"; $postdata = file_get_contents("php://input"); $request = json_decode($postdata, true); if ($_SERVER['REQUEST_METHOD'] === 'POST') { if (array_key_exists('id', $request)) { $deleteResult = deleteProduct($request['id']); if ($deleteResult == false) { failWithError('Data update failed', '500 Internal Server Error'); } } else { failWithError('Invalid input data', '400 Bad Request'); } }
<title></title> </head> <body> <?php require_once '../../includes/session-start.php'; require_once '../../includes/access-required.html.php'; include_once '../../functions/dbConn.php'; include_once '../../functions/categoryFunctions.php'; include_once '../../functions/productsFunctions.php'; include_once '../../functions/until.php'; $products = getAllProducts(); $results = ''; if (isPostRequest()) { $product_id = filter_input(INPUT_POST, 'product_id'); deleteProduct($product_id); if (deleteProduct($product_id) == true) { $results = 'Product deleted'; } else { $results = 'Product was not deleted'; } } ?> <center> <h1>Delete Product</h1> <?php include '../../includes/results.html.php'; ?> <form method="post" action="#">
<?php // initialize include_once '../../../common/init.php'; if (!isLoggedInAdmin()) { redirect(''); } else { // include needed database functions include_once $BASE_PATH . 'database/products.php'; $id = $_GET['id']; if (!empty($id)) { deleteProduct($id); } redirect('pages/manager/products/list_products.php'); }
<?php include_once __DIR__ . '/templates/_libAdmin.php'; include_once __DIR__ . '/templates/_header.php'; include_once __DIR__ . '/templates/_top_menu.php'; echo "<div class='wr_cont'>"; if (isset($_GET['item_act'])) { if (isset($_GET['item_id'])) { $t_id = $_GET['item_id']; } switch ($_GET['item_act']) { case 'edit': editProduct($t_id, $connection); echo "Товар с id='" . $t_id . "' успешно изменён<br/><br/>"; break; case 'del': deleteProduct($t_id, $connection); echo "Товар с id='" . $t_id . "' успешно удалён<br/><br/>"; break; case 'add': addProduct($connection); echo "Товар успешно добавлен<br/><br/>"; break; } } //вывод таблицы товаров на странице редактирования товаров showTableProducts($connection); echo "</div>"; include_once __DIR__ . '/templates/_footer.php';
<meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title></title> <link href="../../css/bootstrap.min.css" rel="stylesheet"> </head> <body> <?php include_once '../../functions/dbconnect.php'; include_once '../../functions/product_functions.php'; include_once '../../functions/category_functions.php'; include_once '../../functions/util.php'; $existingProductID = filter_input(INPUT_GET, 'product_id'); $product = getAllInfoForOneProduct($existingProductID); if (isPostRequest()) { if (deleteProduct($existingProductID)) { $results = 'Product deleted'; $categories = getAllCategories(); $isDeleted = true; } else { $results = 'Error: Product was not deleted.'; } } ?> <?php include '../../includes/results.html.php'; ?>
function addProducts($client, $ids = array()) { //update currency // update_currency(); $default_tz = date_default_timezone_get(); date_default_timezone_set('UTC'); $category = new Category(1, 1); $sql = "select p.id_product, DATEDIFF(NOW(), p.`date_add`) as 'age'\n from ps_product p\n where p.price > 0 and p.active = 1"; $productScores = array(); $products = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql); foreach ($products as $product) { $productScores[$product['id_product']] = array('age' => $product['age'], 'week_sold' => 0, 'month_sales' => 0, 'year_sales' => 0); } $sql = "select p.`id_product`, sum(od.product_quantity) as 'quantity'\n from `ps_product` p\n inner join `ps_order_detail` od on od.product_id = p.id_product\n inner join ps_orders o on o.id_order = od.id_order\n where p.price > 0 \n and p.active = 1\n and o.date_add > now() - INTERVAL 7 DAY\n group by p.id_product"; $week_quantities = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql); foreach ($week_quantities as $week_quantity) { $productScores[$week_quantity['id_product']]['week_sold'] = $week_quantity['quantity']; } $sql = "select p.`id_product`, round(sum(od.product_quantity * od.product_price * 55 / o.`conversion_rate`)) as 'month_revenue'\n from `ps_product` p\n inner join `ps_order_detail` od on od.product_id = p.id_product\n inner join ps_orders o on o.id_order = od.id_order\n where p.price > 0 and p.active = 1\n and o.date_add > now() - INTERVAL 30 DAY\n group by p.id_product"; $month_sales = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql); foreach ($month_sales as $month_sale) { $productScores[$month_sale['id_product']]['month_sales'] = $month_sale['month_revenue']; } $sql = "select p.`id_product`, round(sum(od.product_quantity * od.product_price * 55 / o.`conversion_rate`)) as 'year_revenue'\n from `ps_product` p\n inner join `ps_order_detail` od on od.product_id = p.id_product\n inner join ps_orders o on o.id_order = od.id_order\n where p.price > 0 and p.active = 1\n and o.date_add > now() - INTERVAL 365 DAY\n group by p.id_product"; $year_sales = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql); foreach ($year_sales as $year_sale) { $productScores[$year_sale['id_product']]['year_sales'] = $year_sale['year_revenue']; } foreach ($products as $product) { $productScores[$product['id_product']]['score'] = getWeekSalesScore($productScores[$product['id_product']]['week_sold']) + getAgeScore($productScores[$product['id_product']]['age']) + getMonthScore($productScores[$product['id_product']]['month_sales']) + getYearScore($productScores[$product['id_product']]['year_sales']); } $docs = array(); $link = new Link(); $count = 0; $update = $client->createUpdate(); foreach ($products as $product) { if (!empty($ids) && !in_array((int) $product['id_product'], $ids)) { continue; } $productObj = new Product((int) $product['id_product'], true, 1); print_r('\\n' . 'reindexing ' . $product['id_product']); if (!$productObj->active) { deleteProduct($productObj->id, $client); continue; } $doc = $update->createDocument(); $doc->id_product = $productObj->id; $doc->reference = $productObj->reference; $doc->name = $productObj->name; $doc->description = preg_replace('@[\\x00-\\x08\\x0B\\x0C\\x0E-\\x1F]@', ' ', $productObj->description); $doc->description_short = preg_replace('@[\\x00-\\x08\\x0B\\x0C\\x0E-\\x1F]@', ' ', $productObj->description_short); $doc->brand_id = $productObj->id_manufacturer; $doc->brand_name = $productObj->manufacturer_name; $doc->style_tips = $productObj->description_short; $doc->alphaNameSort = $productObj->name; $dbresult = $productObj->getWsCategories(); $catIds = array(); foreach ($dbresult as $catIdRow) { $catIds[] = $catIdRow['id']; } $category_names = array(); foreach ($catIds as $catID) { $category = new Category((int) $catID); $category_names[] = $category->getName(1); } $doc->cat_name = $category_names; $doc->cat_id = $catIds; $doc->tags = $productObj->getTags(1); $doc->shipping_sla = $productObj->shipping_sla ? $productObj->shipping_sla : 0; $doc->weight = $productObj->weight ? $productObj->weight : 0.5; if (isset($productObj->work_type)) { $doc->work_type = preg_replace('@[\\x00-\\x08\\x0B\\x0C\\x0E-\\x1F]@', ' ', $productObj->work_type ? $productObj->work_type : ''); } if (isset($productObj->garment_type)) { $doc->garment_type = preg_replace('@[\\x00-\\x08\\x0B\\x0C\\x0E-\\x1F]@', ' ', $productObj->garment_type ? $productObj->garment_type : ''); } if (isset($productObj->blouse_length)) { $doc->blouse_length = $productObj->blouse_length ? $productObj->blouse_length : ''; } $doc->height = $productObj->height; $doc->width = $productObj->width; $atributeQty = Attribute::getAttributeQty($productObj->id); if ($productObj->quantity > 0 || $atributeQty > 0) { $doc->inStock = true; } else { $doc->inStock = false; } $doc->isPlusSize = $productObj->is_plussize ? true : false; $doc->isRTS = $productObj->is_rts ? true : false; $doc->quantity = $productObj->quantity ? $productObj->quantity : ($atributeQty ? $atributeQty : 0); //Indian Price $doc->offer_price_in = Product::getPriceStatic($productObj->id, true, NULL, 6, NULL, false, true, 1, false, NULL, NULL, IND_ADDRESS_ID); $doc->offer_price_in_rs = Tools::convertPrice($doc->offer_price_in, 4); $doc->mrp_in = Product::getPriceStatic($productObj->id, true, NULL, 6, NULL, false, false, 1, false, NULL, NULL, IND_ADDRESS_ID); if ($doc->mrp_in > $doc->offer_price_in) { $doc->discount_in = Tools::ps_round(($doc->mrp_in - $doc->offer_price_in) / $doc->mrp_in * 100); } //Worldwide Price $doc->offer_price = $productObj->getPrice(); $doc->offer_price_rs = Tools::convertPrice($doc->offer_price, 4); $doc->mrp = $productObj->getPriceWithoutReduct(); if ($doc->mrp > $doc->offer_price) { $doc->discount = Tools::ps_round(($doc->mrp - $doc->offer_price) / $doc->mrp * 100); } $date = DateTime::createFromFormat('Y-m-d H:i:s', $productObj->date_add); $doc->date_add = $date->format("Y-m-d\\TG:i:s\\Z"); $doc->product_link = $productObj->getLink(); $idImage = $productObj->getCoverWs(); if ($idImage) { $idImage = $productObj->id . '-' . $idImage; } else { $idImage = Language::getIsoById(1) . '-default'; } $doc->image_link_list = $link->getImageLink($productObj->link_rewrite, $idImage, 'list'); $doc->image_link_medium = $link->getImageLink($productObj->link_rewrite, $idImage, 'medium'); $doc->image_link_large = $link->getImageLink($productObj->link_rewrite, $idImage, 'large'); $images = $productObj->getImages(1); $productImages = array(); foreach ($images as $k => $image) { $productImages[] = $link->getImageLink($productObj->link_rewrite, $image['id_image'], 'large'); } $doc->image_links = $productImages; $doc->sales = $productScores[$product['id_product']]['score']; $productObj->fabric = trim($productObj->fabric); $productObj->fabric = preg_replace('/\\s+/', '-', $productObj->fabric); $doc->fabric = strtolower($productObj->fabric); $doc->is_customizable = $productObj->is_customizable; if (isset($productObj->generic_color) && !empty($productObj->generic_color)) { $colors = explode(',', $productObj->generic_color); $indexed_colors = array(); foreach ($colors as $color) { $indexed_colors[] = strtolower(preg_replace('/\\s+/', '-', trim($color))); } $doc->color = $indexed_colors; } if (isset($productObj->stone) && !empty($productObj->stone)) { $stones = explode(',', $productObj->stone); $indexed_stones = array(); foreach ($stones as $stone) { $indexed_stones[] = strtolower(preg_replace('/\\s+/', '-', trim($stone))); } $doc->stone = $indexed_stones; } if (isset($productObj->plating) && !empty($productObj->plating)) { $platings = explode(',', $productObj->plating); $indexed_platings = array(); foreach ($platings as $plating) { $indexed_platings[] = strtolower(preg_replace('/\\s+/', '-', trim($plating))); } $doc->plating = $indexed_platings; } if (isset($productObj->material) && !empty($productObj->material)) { $materials = explode(',', $productObj->material); $indexed_materials = array(); foreach ($materials as $material) { $indexed_materials[] = strtolower(preg_replace('/\\s+/', '-', trim($material))); } $doc->material = $indexed_materials; } if (isset($productObj->look) && !empty($productObj->look)) { $looks = explode(',', $productObj->look); $indexed_looks = array(); foreach ($looks as $look) { $indexed_looks[] = strtolower(preg_replace('/\\s+/', '-', trim($look))); } $doc->look = $indexed_looks; } if (isset($productObj->handbag_occasion) && !empty($productObj->handbag_occasion)) { $handbag_occasions = explode(',', $productObj->handbag_occasion); $indexed_handbag_occasions = array(); foreach ($handbag_occasions as $handbag_occasion) { $indexed_handbag_occasions[] = strtolower(preg_replace('/\\s+/', '-', trim($handbag_occasion))); } $doc->handbag_occasion = $indexed_handbag_occasions; } if (isset($productObj->handbag_style) && !empty($productObj->handbag_style)) { $handbag_styles = explode(',', $productObj->handbag_style); $indexed_handbag_styles = array(); foreach ($handbag_styles as $handbag_style) { $indexed_handbag_styles[] = strtolower(preg_replace('/\\s+/', '-', trim($handbag_style))); } $doc->handbag_style = $indexed_handbag_styles; } if (isset($productObj->handbag_material) && !empty($productObj->handbag_material)) { $handbag_materials = explode(',', $productObj->handbag_material); $indexed_handbag_materials = array(); foreach ($handbag_materials as $handbag_material) { $indexed_handbag_materials[] = strtolower(preg_replace('/\\s+/', '-', trim($handbag_material))); } $doc->handbag_material = $indexed_handbag_materials; } $combinaisons = $productObj->getAttributeCombinaisons(1); $indexed_sizes = array(); foreach ($combinaisons as $k => $combinaison) { if ($combinaison['group_name'] == 'size' || $combinaison['group_name'] == 'Size') { $indexed_sizes[] = $combinaison['attribute_name']; } } $doc->size = $indexed_sizes; $doc->cashback_percentage = $productObj->cashback_percentage; $docs[] = $doc; if (++$count == 300) { $update->addDocuments($docs); $result = $client->update($update); echo 'Update query executed' . PHP_EOL; echo 'Query status: ' . $result->getStatus() . PHP_EOL; echo 'Query time: ' . $result->getQueryTime() . PHP_EOL; $count = 0; $docs = array(); $update = $client->createUpdate(); } } $update->addDocuments($docs); date_default_timezone_set($default_tz); $result = $client->update($update); $sql = "update ps_product set indexed = 1 where indexed = 0"; Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql); }
<?php require_once dirname(__FILE__) . '/../function/func_product.php'; $idproduct = $_GET['idproduct']; //echo $idproduct; $delUnit = deleteProductUnit($idproduct); if ($delUnit) { $delProduct = deleteProduct($idproduct); if ($delProduct) { // echo "OK"; header("location: ../product.php?p=product&action=delProductCompleted"); } else { // echo "Error1"; header("location: ../product.php?p=product&action=delProductError"); } } else { // echo "Error2"; header("location: ../product.php?p=product&action=delProductdError"); }
<?php session_start(); if (isset($_REQUEST['id'])) { include "dbconnection.php"; deleteProduct($_REQUEST['id']); header("location:products.php?delete"); } else { header("location:products.php"); }
$products = getProducts($data); $pagination = new Pagination(); $pagination->total = $total_product; $pagination->page = $page; $pagination->limit = $numrows; $pagination->url = "product/page{page}.html"; $pagination = $pagination->render(); $url = ''; if ($order == 'ASC') { $url .= '/DESC'; } else { $url .= '/ASC'; } if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['selected'])) { foreach ($_POST['selected'] as $product_id) { $delete_query = deleteProduct($product_id); if ($delete_query) { $_SESSION['success'] = $lang['success_delete']; header('Location:product.html'); } else { $_SESSION['error_warning'] = $lang['error_query']; } } } ?> <div id="content"> <div class="breadcrumb"> <a href="home.html"><?php echo $lang['text_home']; ?> </a>
<?php require_once '../../library/config.php'; require_once '../library/functions.php'; checkUser(); $action = isset($_GET['action']) ? $_GET['action'] : ''; switch ($action) { case 'addProduct': addProduct(); break; case 'modifyProduct': modifyProduct(); break; case 'deleteProduct': deleteProduct(); break; case 'deleteImage': deleteImage(); break; default: // if action is not defined or unknown // move to main product page header('Location: index.php'); } function addProduct() { $catId = $_POST['cboCategory']; $name = $_POST['txtName']; $description = $_POST['mtxDescription']; $price = str_replace(',', '', (double) $_POST['txtPrice']); $qty = (int) $_POST['txtQty'];
redirect("index.php?controller=user&action=login"); } if (isset($_GET['action'])) { $action = $_GET['action']; switch ($action) { case "new": newProduct(); break; case "edit": editProduct($_GET['id']); break; case "view": viewProduct($_GET['id']); break; case "delete": deleteProduct($_GET['id']); break; default: echo "URL not found"; } } else { include "view/product/index.php"; } function viewProduct($id) { $product = getProductById($id); include "view/product/view.php"; } function editProduct($id) { $product = getProductById($id);
} function getToken() { if (isset($_COOKIE['token'])) { return $_COOKIE['token']; } else { header('location:login.php'); } } if (isset($_POST['add'])) { $id = $_POST['id']; addProduct($dbh, $id); } if (isset($_POST['delete'])) { $id = $_POST['id']; deleteProduct($dbh, $id); } ?> <!DOCTYPE html> <head> <title>New York Apartments</title> <link rel="stylesheet" type="text/css" href="styleSheet.css"> </head> <body id="shoppingCart"> <div class="aboutUl"> <ul> <li><a href="home.php">Home</a></li>
include "functions.php"; session_start(); if (!$_SESSION['admin'] == 1) { header("location: {$base_url}/views/home.php"); } $query = "SELECT products.product_id, products.name, products.price, artists.artist_name, genres.genre_name , labels.label_name\n FROM products \n JOIN artists ON products.artist_id = artists.artist_id\n JOIN genres ON products.genre_id = genres.genre_id\n JOIN labels ON products.label_id = labels.label_id"; $result = mysqli_query($db, $query); if (!$result) { die('Invalid query: ' . mysqli_error($db)); } if (isset($_POST['add-product-button'])) { addProduct($db); header("Refresh:0"); } if (isset($_POST['delete-product-button'])) { deleteProduct($db); header("Refresh:0"); } if (isset($_POST['add-artist-button'])) { addArtist($db); header("Refresh:0"); } if (isset($_POST['add-label-button'])) { addLabel($db); header("Refresh:0"); } if (isset($_POST['add-genre-button'])) { addGenre($db); header("Refresh:0"); } ?>