Example #1
0
<?php

require_once '../model/orders/Orders.php';
session_start();
$peticion = json_decode(filter_input(INPUT_POST, 'peticion'));
$user = $_SESSION["user"][0];
$totalOrder = $peticion->total;
$tipoPedido = $peticion->type == 1 ? 'C' : 'O';
$products = $peticion->data;
$order = new Orders();
$resultInsert = $order->insertOrder($user, $totalOrder, $tipoPedido);
$order->insertDetailProduct($products, $resultInsert);
die(json_encode($resultInsert));
Example #2
0
 public static function submit_order()
 {
     if (isset($_POST['Total'])) {
         // var_dump( $_POST);
         $order = new Orders($_POST['Total']);
         $order->insertOrder();
         $itemsize = new ItemSize();
         $itemsize->update_item_quantity();
         if ($_SESSION['logedin'] == true) {
             header("location:MainPage.php");
         } else {
             if ($_POST['Total'] > 1000) {
                 //echo $_POST['Total'];
                 header("location:signUp.php");
             }
         }
         //header("location:index.php");
     }
 }