Пример #1
0
        $stock_array[$stock['art_no']] = $stock['on_stock'];
    }
} else {
    header("Location:index.php");
}
if (isset($_SESSION['user_id'])) {
    ?>

<h2>Pregled Vase Kosarice </h2>
<h4>Azurirajte svoju narudzbu ili nastavite kupovati.</h4>
<p style="color:#FF0000;font-weight:bold;margin:10px 0;"><?php 
    echo $myCheckout->error;
    ?>
</p>
<?php 
    if ($myCheckout->get_number_of_records() > 0) {
        ?>
<h3 style="width:480px;"><span style="float:right;"><a href="<?php 
        echo $_SERVER['PHP_SELF'];
        ?>
?action=cancel">Ponistiti sve!</a></span>Vasa Kosarica:</h3>
<table>
  <tr>
    <th width="100">Serijski broj</th>
    <th width="300">Naslov knjige</th>
	<th width="75">Cijena</th>
    <th width="75">Kolicina</th>
	<th>Azuriranje</th>
  </tr>
  <?php 
        foreach ($myCheckout->order_array as $val) {
Пример #2
0
$query_new = "SELECT * FROM stock ORDER BY art_no";
$res_new = mysql_query($query_new);
$row_new = mysql_fetch_assoc($res_new);
$cust_sql = "SELECT id,email FROM current WHERE id = 1";
$cust_result = mysql_query($cust_sql) or die(mysql_error());
$cust = mysql_fetch_object($cust_result);
$_SESSION['custom_num'] = $cust->id;
$_SESSION['email'] = $cust->email;
mysql_free_result($cust_result);
$myCart = new db_stock_cart($_SESSION['custom_num']);
if (isset($_GET['add']) || isset($_GET['product'])) {
    if ($myCart->check_against_stock($_GET['stock'], 1)) {
        $myCart->handle_cart_row($_GET['art_no'], $_GET['product'], 1, $_GET['price']);
    }
}
$num_rows = $myCart->get_number_of_records();
if (isset($_GET['action']) && $_GET['action'] == "checkout") {
    if ($num_rows > 0) {
        header("Location: " . CHECKOUT);
    } else {
        $myCart->error = "Vasa kosarica je trenutno prazna!";
    }
}
?>
<h2>Dodavanje Proizvoda u kosaricu</h2>
<h4>Imate dvije opcije dodavanja u kosaricu<br><br>
a. pomocu paypal sucelja  <br>
b. preko stranice</h4>
<p style="color:#FF0000;font-weight:bold;margin:10px 0;"><?php 
echo $myCart->error;
?>
Пример #3
0
require './includes/config1.inc.php';
require MYSQL;
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    include './includes/login.inc.php';
}
include './includes/header.html';
if (isset($_SESSION['user_id'])) {
    if (isset($_GET['kraj'])) {
        if ($_GET['kraj'] == 'Zavrsite') {
            ?>

 <?php 
        }
    }
    $myConfirm = new db_stock_cart($_SESSION['custom_num']);
    if ($myConfirm->get_number_of_records() == 0) {
        header("Location: " . PROD_IDX);
    }
    // uputi korisnika nazad ako vise nema narudbi
    $myConfirm->show_ordered_rows();
    $myConfirm->set_shipment_data();
    $sql_errors = 0;
    foreach ($myConfirm->order_array as $val) {
        $update_stock = sprintf("UPDATE stock SET amount = amount - %d, last_buy = NOW() WHERE art_no = '%s'", $val['quantity'], $val['product_id']);
        if (!mysql_query($update_stock)) {
            $sql_errors++;
        }
    }
    if ($sql_errors == 0) {
        $myConfirm->close_order();
    } else {