-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaventura.html
More file actions
129 lines (86 loc) · 2.41 KB
/
aventura.html
File metadata and controls
129 lines (86 loc) · 2.41 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
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
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="UTF-8">
<title>Categoría Aventura</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<header>
<a href="index.html" class="volver">⬅ Volver al Inicio</a>
<h1>🗺️ Categoría Aventura</h1>
<p>Explora mundos increíbles</p>
</header>
<section class="contenedor">
<!-- PORTAL 2 -->
<div class="categoria">
<a href="#pagoPortal">
<img src="https://cdn.cloudflare.steamstatic.com/steam/apps/620/header.jpg">
<h3>Portal 2</h3>
</a>
<p>Resuelve puzzles utilizando portales.</p>
<p class="precio">$9.990</p>
<button class="btnCarrito" onclick="agregarCarrito('Portal 2',9990,'aventura')">
Agregar al carrito
</button>
</div>
<!-- RDR2 -->
<div class="categoria">
<a href="#pagoRDR2">
<img src="https://cdn.cloudflare.steamstatic.com/steam/apps/1174180/header.jpg">
<h3>Red Dead Redemption 2</h3>
</a>
<p>Aventura en el salvaje oeste.</p>
<p class="precio">$39.990</p>
<button class="btnCarrito" onclick="agregarCarrito('Red Dead Redemption 2',39990,'aventura')">
Agregar al carrito
</button>
</div>
</section>
<!-- PAGO PORTAL -->
<div id="pagoPortal" class="pago">
<div class="ventana">
<h2>Compra Portal 2</h2>
<p>Precio original: <b>$9.990</b></p>
<p>El descuento se aplica en el carrito</p>
<hr>
<button class="btnForm">Ir a pagar</button>
<a href="#" class="btnCancelar">Cancelar</a>
</div>
</div>
<!-- PAGO RDR2 -->
<div id="pagoRDR2" class="pago">
<div class="ventana">
<h2>Compra Red Dead Redemption 2</h2>
<p>Precio original: <b>$39.990</b></p>
<p>El descuento se aplica en el carrito</p>
<hr>
<button class="btnForm">Ir a pagar</button>
<a href="#" class="btnCancelar">Cancelar</a>
</div>
</div>
<script>
function agregarCarrito(nombre,precio,categoria){
let usuario = localStorage.getItem("usuario");
// Permitir invitado si no hay usuario
if(!usuario){
let confirmar = confirm("¿Quieres ingresar como invitado?");
if(confirmar){
localStorage.setItem("usuario", "Invitado");
} else {
window.location.href = "index.html#login";
return;
}
}
let carrito = JSON.parse(localStorage.getItem("carrito")) || [];
carrito.push({
nombre: nombre,
precio: precio,
categoria: categoria
});
localStorage.setItem("carrito", JSON.stringify(carrito));
alert(nombre + " agregado al carrito correctamente");
}
</script>
</body>
</html>