-
Notifications
You must be signed in to change notification settings - Fork 0
/
cart-item-delete.php
93 lines (80 loc) · 2.4 KB
/
cart-item-delete.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<?php require_once('header.php'); ?>
<?php
// Check if the product is valid or not
if( !isset($_REQUEST['id']) || !isset($_REQUEST['size']) || !isset($_REQUEST['color']) ) {
header('location: cart.php');
exit;
}
$i=0;
foreach($_SESSION['cart_p_id'] as $key => $value) {
$i++;
$arr_cart_p_id[$i] = $value;
}
$i=0;
foreach($_SESSION['cart_size_id'] as $key => $value) {
$i++;
$arr_cart_size_id[$i] = $value;
}
$i=0;
foreach($_SESSION['cart_size_name'] as $key => $value) {
$i++;
$arr_cart_size_name[$i] = $value;
}
$i=0;
foreach($_SESSION['cart_color_id'] as $key => $value) {
$i++;
$arr_cart_color_id[$i] = $value;
}
$i=0;
foreach($_SESSION['cart_color_name'] as $key => $value) {
$i++;
$arr_cart_color_name[$i] = $value;
}
$i=0;
foreach($_SESSION['cart_p_qty'] as $key => $value) {
$i++;
$arr_cart_p_qty[$i] = $value;
}
$i=0;
foreach($_SESSION['cart_p_current_price'] as $key => $value) {
$i++;
$arr_cart_p_current_price[$i] = $value;
}
$i=0;
foreach($_SESSION['cart_p_name'] as $key => $value) {
$i++;
$arr_cart_p_name[$i] = $value;
}
$i=0;
foreach($_SESSION['cart_p_featured_photo'] as $key => $value) {
$i++;
$arr_cart_p_featured_photo[$i] = $value;
}
unset($_SESSION['cart_p_id']);
unset($_SESSION['cart_size_id']);
unset($_SESSION['cart_size_name']);
unset($_SESSION['cart_color_id']);
unset($_SESSION['cart_color_name']);
unset($_SESSION['cart_p_qty']);
unset($_SESSION['cart_p_current_price']);
unset($_SESSION['cart_p_name']);
unset($_SESSION['cart_p_featured_photo']);
$k=1;
for($i=1;$i<=count($arr_cart_p_id);$i++) {
if( ($arr_cart_p_id[$i] == $_REQUEST['id']) && ($arr_cart_size_id[$i] == $_REQUEST['size']) && ($arr_cart_color_id[$i] == $_REQUEST['color']) ) {
continue;
} else {
$_SESSION['cart_p_id'][$k] = $arr_cart_p_id[$i];
$_SESSION['cart_size_id'][$k] = $arr_cart_size_id[$i];
$_SESSION['cart_size_name'][$k] = $arr_cart_size_name[$i];
$_SESSION['cart_color_id'][$k] = $arr_cart_color_id[$i];
$_SESSION['cart_color_name'][$k] = $arr_cart_color_name[$i];
$_SESSION['cart_p_qty'][$k] = $arr_cart_p_qty[$i];
$_SESSION['cart_p_current_price'][$k] = $arr_cart_p_current_price[$i];
$_SESSION['cart_p_name'][$k] = $arr_cart_p_name[$i];
$_SESSION['cart_p_featured_photo'][$k] = $arr_cart_p_featured_photo[$i];
$k++;
}
}
header('location: cart.php');
?>