示例#1
0
<?php

require_once 'template/header.php';
require_once 'functions/productsFunctions.php';
require_once 'functions/categorysFunctions.php';
require_once 'functions/sessionFunctions.php';
verifyUser();
$categorys = retrieveCategorys($connection);
$productId = $_POST['productId'];
$selected = "";
$productData = searchProduct($connection, $productId);
$id = $_POST['id'];
$product = $_POST['product'];
$price = $_POST['price'];
$description = $_POST['description'];
$category = $_POST['category_id'];
if (updateProducts($connection, $id, $product, $price, $description, $category)) {
    $_SESSION['success'] = "Product was successfully updated!";
    header("Location: retrieve.php");
    die;
}
?>

	<div class="col-lg-3"></div>
	<div class="col-lg-6">
		<h1 align="center">Edit Product</h1>
		<hr />
		<form action="update.php" method="post" accept-charset="utf-8">
			<input type="hidden" name="id" value="<?php 
echo $productData['productId'];
?>
示例#2
0
?>
<script src="../javascript/index.js" type="text/javascript"></script>
</head>
<body>
	<?php 
echo getBatikHeader();
?>
	
	<div class="main-body">
	<?php 
if (isset($_GET['query'])) {
    ?>
			<h2 class="main-title"><?php 
    echo '"' . $_GET['query'] . '"';
    ?>
</h2>
			<hr/>
			<?php 
    $productlist = searchProduct($_GET['query']);
    echo print_product_list($productlist, "Hasil Pencarian", "product-category-list");
} else {
    echo printProductNotFound();
}
?>
	</div>

	<?php 
echo getBatikFooter();
?>
</body>
</html>
示例#3
0
            return;
        }
        echo '{"result":1,"message":"Succesfully added product"}';
    }
    switch ($cmd) {
        case 1:
            addProduct();
            break;
        case 2:
            updateProduct();
            break;
        case 3:
            getAllProducts();
            break;
        case 4:
            getByCategory();
            break;
        case 5:
            getProductById();
            break;
        case 6:
            deleteProduct();
            break;
        case 7:
            searchProduct();
            break;
        default:
            echo '{"cmd":"none","message":"No command issued"}';
            break;
    }
}
示例#4
0
<?php

// initialize
include_once '../../common/init.php';
if (!isLoggedInAdmin() && !isLoggedInOperator()) {
    redirect('');
} else {
    // include needed database functions
    include_once $BASE_PATH . 'database/products.php';
    $search = strip_tags($_POST['search']);
    if (isset($_POST['pagenr'])) {
        $pagenr = $_POST['pagenr'];
        if ($search) {
            $products = searchProductPage($search, $pagenr);
        } else {
            $products = getAllProductsPage($pagenr);
        }
        echo json_encode(array("numpages" => ceil($products[0]['count'] / $pagesize), "products" => $products));
    } else {
        if ($search) {
            $products = searchProduct($search);
        } else {
            $products = getAllProducts();
        }
        echo json_encode(array("products" => $products));
    }
}
示例#5
0
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap-theme.min.css">
    </head>
    <body>
        <?php 
include_once './functions/dbconnect.php';
include_once './functions/utils-function.php';
include_once './functions/category-functions.php';
include './functions/products-functions.php';
require_once './includes/store/session-start.req-inc.php';
$categories = getAllCategories();
if (isPostRequest()) {
    $_SESSION['cart'][] = filter_input(INPUT_POST, 'product_id');
    $id = filter_input(INPUT_GET, 'category_id');
    $results = searchProduct($id);
}
if (isGetRequest()) {
    $id = filter_input(INPUT_GET, 'category_id');
    $results = searchProduct($id);
} else {
    $id = ' ';
}
?>
        <?php 
include './includes/store/header.php';
?>
        <?php 
include './includes/store/storeTable.php';
?>
    </body>
</html>