Example #1
0
<?php

session_start();
require_once 'Db.class.php';
require_once 'Product.class.php';
require_once 'User.class.php';
$db = new DB();
if (isset($_REQUEST['item'])) {
    $product = new Product($_REQUEST['item']);
    if ($product->id != null) {
        if (isset($_SESSION['user'])) {
            $user = new User($_SESSION['user']);
            $user->addToCart($product->id);
            header('location: ../../item.php?id=' . $product->id);
        } else {
            header('location: ../../item.php?id=' . $product->id);
        }
    } else {
        header('location: ../../item.php?id=' . $product->id);
    }
}
Example #2
0
<?php

session_start();
require_once 'include/php/Db.class.php';
require_once 'include/php/Product.class.php';
require_once 'include/php/User.class.php';
$db = new DB();
$page = "checkout";
if (isset($_SESSION['user'])) {
    $user = new User($_SESSION['user']);
}
if (isset($_REQUEST['item'])) {
    if (isset($user)) {
        $user->addToCart($_REQUEST['item']);
    }
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" class="no-js">
<head>
    <meta http-equiv = "Content-Type" content = "text/html; charset=utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="author" content="Harish Kandala">
    <meta name="description" content="eKart is a sample ecommerce website with all necessary features">
    <meta name="keywords" content="Ecommerce, Shopping, Buy, Sale, Cart, eKart">
    <title>eKart | Checkout</title>
    <link rel="icon" href="img/cart.png">
    <!-----------------------------Stylesheets---------------------------->
    <link rel="stylesheet" type="text/css" href="include/css/styles.css">
    <link rel="stylesheet" href="include/css/owl.carousel.css">