001.
<?php
002.
session_start();
003.
include
"connection.php"
;
004.
$id
=
$_GET
[
"id"
];
005.
006.
$sql
= "SELECT * FROM product inner join type_product
007.
on product.type_product_id = type_product.type_product_id
008.
where product.product_id =
'$id'
009.
order by product.product_id Desc";
010.
011.
$objQuery
= mysql_query(
$sql
)
or
die
(
"Error Query ["
.
$sql
.
"]"
);
echo
mysql_error();
012.
$rs
= mysql_fetch_array(
$objQuery
)
013.
014.
015.
?>
016.
017.
<link rel=
"stylesheet"
media=
"screen, projection"
href=
"./dist/drift-basic.css"
>
018.
<style type=
"text/css"
>
019.
body {
020.
font-family: Helvetica Neue, Arial, sans;
021.
margin-top: 2em;
022.
background: #FAFAFA;
023.
}
024.
025.
.wrapper {
026.
margin: 0 auto;
027.
width: 860px;
028.
}
029.
030.
.drift-demo-trigger {
031.
width: 40%;
032.
float: left;
033.
}
034.
035.
.detail {
036.
position: relative;
037.
width: 55%;
038.
margin-left: 5%;
039.
float: left;
040.
}
041.
042.
h1 {
043.
color: #013C4A;
044.
margin-top: 1em;
045.
margin-bottom: 1em;
046.
}
047.
048.
p {
049.
max-width: 32em;
050.
margin-bottom: 1em;
051.
color: #23637f;
052.
line-height: 1.6em;
053.
}
054.
055.
p:last-of-type {
056.
margin-bottom: 2em;
057.
}
058.
059.
a {
060.
color: #00C0FA;
061.
}
062.
063.
.ix-link {
064.
display: block;
065.
margin-bottom: 3em;
066.
}
067.
068.
@media (max-width: 900px) {
069.
.wrapper {
070.
text-align: center;
071.
width: auto;
072.
}
073.
074.
.detail, .drift-demo-trigger {
075.
float: none;
076.
}
077.
078.
.drift-demo-trigger {
079.
max-width: 100%;
080.
width: auto;
081.
margin: 0 auto;
082.
}
083.
084.
.detail {
085.
margin: 0;
086.
width: auto;
087.
}
088.
089.
p {
090.
margin: 0 auto 1em;
091.
}
092.
093.
.responsive-hint {
094.
display: none;
095.
}
096.
}
097.
</style>
098.
099.
100.
<div
class
=
"wow flipInY"
>
101.
<div
class
=
"section-heading text-center"
>
102.
<h4
class
=
"h-bold"
>รายละเอียดสินค้า
" <?=$rs[product_name]?> "
</h4>
103.
<div
class
=
"divider-header"
></div>
104.
</div>
105.
106.
</div>
107.
108.
109.
110.
111.
<form action=
"cart_.php#work"
method=
"post"
>
112.
113.
<div
class
=
"row"
>
114.
<div
class
=
"wrapper"
>
115.
<img
class
=
"drift-demo-trigger"
data-zoom=
"admin/img/product/<?=$rs[product_image]?>"
src=
"admin/img/product/<?=$rs[product_image]?>"
>
116.
117.
118.
119.
<div
class
=
"detail"
>
120.
<div
class
=
"col-md-12"
>
121.
<table width=
"100%"
border=
"0"
>
122.
<tr>
123.
<td width=
"20%"
><strong>รหัสสินค้า</strong></td>
124.
<td><?=
$rs
[product_id]?></td>
125.
</tr>
126.
<tr>
127.
<td><strong>หมวดสินค้า</strong></td>
128.
<td><?=
$rs
[type_name]?></td>
129.
</tr>
130.
<tr>
131.
<td><strong>ชื่อสินค้า</strong></td>
132.
<td><?=
$rs
[product_name]?></td>
133.
</tr>
134.
<tr>
135.
<td><strong>ราคา</strong></td>
136.
<td><?=
$rs
[product_price]?> บาท</td>
137.
</tr>
138.
<tr>
139.
<td><strong>น้ำหนัก</strong></td>
140.
<td><?=
$rs
[product_weight]?> กรัม </td>
141.
</tr>
142.
<tr>
143.
<td valign=
"top"
><strong>รายละเอียด</strong></td>
144.
<td><?=
$rs
[product_detail]?> </td>
145.
</tr>
146.
<tr>
147.
<td valign=
"top"
> </td>
148.
<td><?
if
(
$rs
[product_stock] <= 0)
149.
{
150.
echo
"<font color='red'>สินค้าหมดชั่วคราว</font>"
;
151.
}
152.
?>
153.
<br>
154.
</td>
155.
</tr>
156.
157.
<tr>
158.
<td valign=
"top"
> </td>
159.
<td> </td>
160.
</tr>
161.
162.
</table>
163.
164.
165.
<div
class
=
"row"
>
166.
<div
class
=
"col-md-3"
align=
"center"
>
167.
168.
169.
170.
<div id=
"fb-root"
></div>
171.
<script>(
function
(d, s, id) {
172.
var
js, fjs = d.getElementsByTagName(s)[0];
173.
if
(d.getElementById(id))
return
;
174.
js = d.createElement(s); js.id = id;
175.
js.src =
"//connect.facebook.net/th_TH/sdk.js#xfbml=1&version=v2.0"
;
176.
fjs.parentNode.insertBefore(js, fjs);
177.
}(document,
'script'
,
'facebook-jssdk'
));</script>
178.
180.
181.
182.
</div>
183.
<div
class
=
"col-md-3"
align=
"right"
>
184.
<input type=button onClick=
'window.history.back()'
value=
'ย้อนกลับ'
class
=
"btn btn-red"
>
185.
</div>
186.
187.
<div
class
=
"col-md-3"
>
188.
<?
if
(
$rs
[product_stock] > 0)
189.
{ ?>
190.
<input type=
"submit"
name=
"add_to_cart"
class
=
"btn btn-info"
value=
"เพิ่มสินค้าลงตระกร้า"
/>
191.
<? }?>
192.
</div></div>
193.
194.
</div>
195.
</div>
196.
197.
<input type=
"hidden"
name=
"h_product_id"
value=
"<?=$rs['product_id']?>"
>
198.
<input type=
"hidden"
name=
"h_product_price"
value=
"<?=$rs['product_price']?>"
>
199.
<input type=
"hidden"
name=
"h_weight"
value=
"<?=$rs['product_weight']?>"
>
200.
<input type=
"hidden"
name=
"h_product_name"
value=
"<?=$rs['product_name']?>"
>
201.
202.
203.
</div>
204.
</div>
205.
206.
<script src=
"dist/Drift.js"
></script>
207.
<script>
208.
new
Drift(document.querySelector(
'.drift-demo-trigger'
), {
209.
paneContainer: document.querySelector(
'.detail'
),
210.
inlinePane: 400,
211.
inlineOffsetY: -85,
212.
containInline: true
213.
});
214.
</script>
215.
</form>
216.
217.
218.
219.
<div style=
"padding:7%"
></div>
220.
221.
<div
class
=
"col-xs-12"
>
222.
<div
class
=
"service-box"
>
223.
<div
class
=
"accordion"
id=
"accordionArea"
>
224.
<div
class
=
"accordion-group"
>
225.
<div
class
=
"accordion-heading accordionize"
>
226.
<a
class
=
"accordion-toggle"
data-toggle=
"collapse"
data-parent=
"#accordionArea"
href=
"#oneArea"
>
227.
รีวิวสินค้า
228.
<i
class
=
"fa fa-chevron-down"
></i>
229.
</a>
230.
</div>
231.
232.
<div id=
"oneArea"
class
=
"accordion-body collapse"
>
233.
234.
<?
if
(isset(
$_SESSION
[
'member_id'
]))
235.
{
236.
237.
$member_id
=
$_SESSION
[
'member_id'
];
238.
$strSQL
=
"SELECT * FROM member WHERE member_id = '$member_id' "
;
239.
$objQuery
= mysql_query(
$strSQL
);
240.
$objResult
= mysql_fetch_array(
$objQuery
);
241.
?>
242.
243.
<form action=
"comment_product.php"
method=
"post"
>
244.
245.
246.
247.
<label>ความคิดเห็นที่มีต่อสินค้า</label> <textarea name=
"comment_detail"
type=
"text"
class
=
"form-control"
rows=
"3"
></textarea>
248.
249.
<label>ชื่อจริง</label><input name=
"member_id"
type=
"text"
class
=
"form-control"
placeholder=
"ชื่อผู้ร่วมรีวิว"
value=
"<?=$objResult["
username
"];?> "
readonly=
"readonly"
>
250.
<br>
251.
<button type=
"submit"
class
=
"btn btn-info"
>แสดงความคิดเห็น</button>
252.
<button type=
"reset"
class
=
"btn btn-danger"
>ยกเลิก </button>
253.
254.
<input type=
"hidden"
name=
"product_id"
value=
"<?=$rs[product_id]?>"
>
255.
256.
</form> <? } ?>
257.
258.
<div style=
"padding:30px"
></div>
259.
<h3>ความคิดเห็นสินค้า</h3>
260.
261.
262.
263.
<?
264.
265.
$product_id
=
$rs
[
'product_id'
];
266.
$i
= 1 ;
267.
268.
$q
=
"SELECT * FROM comment INNER JOIN member ON member.member_id = comment.member_id WHERE comment.product_id = '$product_id' ORDER BY comment.comment_id DESC "
;
269.
$qr
=mysql_query(
$q
);
270.
271.
272.
$Num_Rows
=mysql_num_rows(
$qr
);
273.
if
(
$Num_Rows
==0){
274.
275.
echo
"ยังไม่มีความคิดเห็นต่อสินค้านี้"
; }
276.
277.
278.
while
(
$rs
=mysql_fetch_array(
$qr
)){
279.
?>
280.
281.
282.
283.
ความคิดเห็นที่ <?=
$i
?>
284.
<p/><?=
$rs
[
'comment_detail'
]?>
285.
<p/>ผู้แสดงความคิดเห็น คุณ : <?=
$rs
[
'username'
]?>
286.
<hr>
287.
288.
<?
$i
++; } ?>
289.
290.
291.
</div>
292.
</div>
293.
</div>
294.
</div>
295.
</div>
296.
<span style=
"color: black"
>
297.
</span>