-
Notifications
You must be signed in to change notification settings - Fork 0
/
braking_parts.php
189 lines (152 loc) · 5.79 KB
/
braking_parts.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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
<!DOCTYPE html>
<?php
session_start();
include_once "config.php";
include_once "pagination.php";
$current_url = "braking_parts.php"
?>
<html>
<head>
<title>INDEX</title>
<meta charset="UTF-8">
<link rel="stylesheet" href="style.css" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script>
$(document).ready(function(){
$("#oferta > div:gt(0)").hide();
setInterval(function() {
$('#oferta > div:first')
.fadeOut(1000)
.next()
.fadeIn(1000)
.end()
.appendTo('#oferta');
}, 3000);
});
</script>
</head>
<body>
<div id="wrapper">
<div id=header>
<img id = "header_image" src="images/logo.png">
<?php
if(isset($_SESSION["active_user"]))
{
echo $HTML =<<<HTML
<form id = "user_index" method="get" action="logout.php">
<p style="display:inline"><span style="color:#0e0e0e; font-size:115%; "> User < {$_SESSION["active_user"]["name"]} > </span> <b> | </b></p>
<a href ="logout.php?logout" style="font-size:115%;color:blue; "> Logout </a>
</form>
HTML;
}
?>
</div>
<div>
<div id="menu_tab">
<ul class="menu">
<li><a href="my_account.php" class="nav">My account</a></li>
<li class="divider"></li>
<li><a href=<?php
if(isset($_SESSION["active_user"]))
echo "# onclick=\"(alert('You Are Currently Logged In!'))\"; ";
else echo "register.php" ;
?>
class="nav">Register</a></li>
<li class="divider"></li>
<li><a href="index.php" class="nav">Products</a></li>
<li class="divider"></li>
<li><a href="view_cart.php" class="nav"> Cart </a></li>
<li class="divider"></li>
<li><a href="contact_us.php" class="nav">Contact Us</a></li>
</ul>
</div>
<!-- end of menu tab -->
<!------------------------------------------------------------------>
<div class="left_content">
<div class="title_box">Categories</div>
<link href="style.css" rel="stylesheet" type="text/css"/>
<ul class="left_menu">
<li class="odd"><a href="engine_parts.php"><b>Engine Parts</b></a></li>
<li class="even"><a href="braking_parts.php"><b>Braking Parts </b></a></li>
<li class="odd"><a href="exhaust_parts.php"><b>Exhaust Parts</b></a></li>
<li class="even"><a href="moto_parts.php"><b>Moto Accessories</b></a></li>
<li class="odd"><a href="gear_parts.php"><b>Protective Gear</b></a></li>
</ul>
<!-- end of left content -->
</div>
<?php
if(isset($_SESSION))
{
$total_prc = 0;$total_qty = 0;
if(isset($_SESSION["e-shop"]) && count($_SESSION['e-shop']>0))
{
$total_prc = Calc($_SESSION['e-shop'])['price'] ;
$total_qty = Calc($_SESSION['e-shop'])['qty'] ;
}
echo $HTML_ = <<<HTML
<div class="right_content">
<div class="border_box">
<form method="get" action="details.php">
<input type="text" name="search" value="Search..." maxlength="30" size = "12" >
<button> Search </button>
</form>
</div>
<form method="post" action="view_cart.php"
<div class="shopping_cart">
<div class="title_box">Shopping cart</div>
<div class="cart_details"> {$total_qty} items <br />
<span class="border_cart"></span> Total: <span class="price">{$total_prc}  {$currency}</span> </div>
<div class="cart_icon"><input type="image" src="images/shoppingcart.png"width="35" height="35" border="0" ></div>
</div>
</form>
</div>
HTML;
}
?>
<div class="center_content">
<div id="oferta" style="margin:5px 0 5px 0;">
<div>
<img src="images/image1.jpg" style="width:585px;">
</div>
<div>
<img src="images/image2.jpg" style="width:585px;">
</div>
</div>
<div class="center_prod_content">
<?php
// INCLUDE THE ADD TO CART PHP SCRIPT
//Paginate("SELECT COUNT(id) FROM products ","SELECT product_code, product_name, product_desc, product_img_name, price FROM products ORDER BY id ASC");
Paginate("SELECT COUNT(p_id) FROM products WHERE product_category = 'braking_parts' ","SELECT * FROM products WHERE product_category = 'braking_parts' ORDER BY p_id ASC ");
echo '<h1 class="center_heading"> Braking Parts </h1>';
include("prod_action_.php");
?>
<!------------------------------------------------------------------>
<?php
function Calc(array $temp_array){
$tmp = array(
'price' => 0.0,
'qty' =>0.0,
);
foreach($_SESSION['e-shop'] as $prod_object)
{
for($i = 0 ; $i < intval($prod_object["product_qty"]);$i++)
{
$tmp['price'] = $tmp['price'] + floatval($prod_object["product_price"]);
}
$tmp['qty']= $tmp['qty'] + floatval($prod_object["product_qty"]);
}
return $tmp;
}
?>
<!-- end of right content -->
</div>
<!-- end of main content -->
</div>
<div class="footer">
<div id="footer_logo"> HARIS MOTOS - All Rights Reserved 2015 </div>
</div>
</div>
</div>
<!-- end of main_container -->
</body>
</html>