-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcart.php
More file actions
93 lines (73 loc) · 2.48 KB
/
Copy pathcart.php
File metadata and controls
93 lines (73 loc) · 2.48 KB
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
$id = $_GET["id"];
if ($id == NULL){
header( "Location: index.php" ) ;
exit;
}
/* 本の情報を取得 */
$json = file_get_contents("https://www.googleapis.com/books/v1/volumes/".$id);
$results = json_decode($json, TRUE);
$title = $results[volumeInfo][title]." ".$results[volumeInfo][subtitle];
$publishedDate = $results[volumeInfo][publishedDate];
$imageLink = $results[volumeInfo][imageLinks][smallhumbnail];
if ($results[saleInfo][listPrice][amount] == NULL) {
$listPrice = "(注文確定後にお知らせ)";
} else {
$listPrice = $results[saleInfo][listPrice][amount];
}
if ($results[volumeInfo][imageLinks][thumbnail] == NULL){
$imageLink = "img/noimage.png";
} else {
$imageLink = $results[volumeInfo][imageLinks][thumbnail];
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<link rel="stylesheet" href="css/cart.css">
<link rel="icon" href="img/favicon.ico">
<title>O書店</title>
</head>
<body>
<header>
<h1><a href="index.php">O書店</a></h1>
<span>Web注文機能を使うためには、ログインしてください</span>
<a id="login" href="">ログイン</a>
</header>
<form id="search" method="get" action="search.php">
<input name="q" type="search" placeholder="書籍を検索">
<input type="submit" value="">
</form>
<div id="main">
<div id="cart">
<section>
<h2>カートに追加しました</h2>
<img alt="<?php echo $title ?>" src="<?php echo $imageLink ?>">
<h3><?php echo $title ?></h3>
<p class="publishedDate"><?php echo $publishedDate ?></p>
<p><?php echo $authors ?></p>
<p class="price">¥ <?php echo $listPrice ?></p>
</section>
<section>
<h2>カートに入っている商品</h2>
<img alt="<?php echo $title ?>" src="<?php echo $imageLink ?>">
<h3><?php echo $title ?></h3>
<p class="publishedDate"><?php echo $publishedDate ?></p>
<p><?php echo $authors ?></p>
<p class="price">¥ <?php echo $listPrice ?></p>
</section>
</div>
<section id="nav">
<p><a class="button" href="order.php?id=<?php echo $id ?>">注文を確定する</a></p>
<p><a class="button_c" href="">買い物を続ける</a></p>
</section>
</div>
<footer>
<a href="">規約</a>
<a href="">プライバシー</a>
<a href="">店舗</a>
</footer>
</body>
</html>