Пример #1
0
            die('Error : (' . $dbcon->errno . ') ' . $dbcon->error);
        }
        $stmt->close();
        unset($_SESSION['useraddress']);
    }
    header("Location: " . SITE_URL . "index.php?orders");
    exit;
}
//when new order is being created set the order status as new.
//new order to be created if there was no orderid in the session
if ($sess_orderID == -1) {
    //order status could be new, shippingInfo, review, confirmed, cancelled, shipped, delivered, completed
    $_SESSION['orderStatus'] = $sess_orderStatus = "new";
}
//in all above scenarios, the rest of the page needs to be executed
$currUserEmail = isGuest() ? "" : getCurrentUserEmail();
$currUsertype = "2";
$curr_user = ['userid' => '', 'firstname' => '', 'lastname' => '', 'email' => '', 'phone' => '', 'gender' => '', 'address1' => '', 'address2' => '', 'city' => '', 'state' => '', 'postalcode' => ''];
$order_add = ['email' => '', 'email' => '', 'ship_add1' => '', 'ship_add2' => '', 'ship_city' => '', 'ship_state' => '', 'ship_postal' => '', 'bill_add1' => '', 'bill_add2' => '', 'bill_city' => '', 'bill_state' => '', 'bill_postal' => '', 'paymenttype' => 'COD', 'phone' => ''];
//if the user is not a guest, get the current user details to prefill the order form
if (isset($_SESSION['userid'])) {
    $user_id = $_SESSION['userid'];
    $curr_user = [];
    $qry = "SELECT  userid, firstname, lastname, email, phone, gender, address1, address2, city, state, postalcode, usertype from user WHERE userid={$user_id}";
    if (!($stmt = $dbcon->prepare($qry))) {
        die('Prepare Error 1 : (' . $dbcon->errno . ') ' . $dbcon->error);
    }
    if (!$stmt->execute()) {
        die('Error : (' . $dbcon->errno . ') ' . $dbcon->error);
    }
    $stmt->store_result();
Пример #2
0
     }
     if (!$stmt->execute()) {
         die('Error : (' . $dbcon->errno . ') ' . $dbcon->error);
     }
     $stmt->store_result();
     $stmt->bind_result($a, $b, $c, $d);
     $curr_orders = [];
     while ($stmt->fetch()) {
         if ($c == "shippinginfo" || $c == "new" || $c == "Review") {
             $c = "Not Placed";
         }
         $curr_orders[] = ['orderid' => $a, 'useremail' => $b, 'amazonOrderID' => $c, 'status' => $d];
     }
     $stmt->close();
     //for custom designs of this user
     $currUserEmail = getCurrentUserEmail();
     $curr_des = [];
     $qry = "SELECT  productid, name, price, mainimg, customized  from products WHERE productid IN ( SELECT DISTINCT productid from customdesign WHERE addedBy='{$currUserEmail}')";
     if (!($stmt = $dbcon->prepare($qry))) {
         die('Prepare Error : (' . $dbcon->errno . ') ' . $dbcon->error);
     }
     if (!$stmt->execute()) {
         die('Error : (' . $dbcon->errno . ') ' . $dbcon->error);
     }
     $stmt->store_result();
     $stmt->bind_result($a, $b, $c, $d, $e);
     while ($stmt->fetch()) {
         $curr_des[] = ['productid' => $a, 'name' => $b, 'price' => $c, 'mainimg' => $d, 'customized' => $e];
     }
     $stmt->close();
 }