public function create()
 {
     if (!isset($_POST['quantity']) || !isset($_POST['product_id']) || !isset($_POST['product_price'])) {
         return call('pages', 'error');
     }
     if (isAdmin()) {
         $_SESSION['alert'] = "Admin is not able to buy products";
         return header("Location: index.php?controller=products&action=index");
     }
     if (!isset($_SESSION['id'])) {
         $_SESSION['alert'] = "Please log in before shopping";
         return header("Location: index.php?controller=products&action=index");
     }
     if (!Order::isValid($_SESSION['id'])) {
         $_SESSION['alert'] = "Before you can buy products, you must provide necessary perfonal information";
         return header("Location: index.php?controller=products&action=index");
     }
     if (!isset($_SESSION['orderID'])) {
         $_SESSION['orderID'] = Order::create($_SESSION['id']);
     }
     require_once 'models/order_detail.php';
     if (OrderDetail::check($_SESSION['orderID'], $_POST['product_id'])) {
         OrderDetail::addQuantity($_SESSION['orderID'], $_POST['product_id'], $_POST['quantity']);
     } else {
         OrderDetail::create($_SESSION['orderID'], $_POST['product_id'], $_POST['product_price'], $_POST['quantity']);
     }
     $_SESSION['notice'] = "Added product to basket";
     header("Location: index.php?controller=products&action=index");
 }