<?php
session_start();
$_SESSION['apaga'] = 'NO';
if(!isset($_SESSION["carrito"])){
$_SESSION["carrito"] = [];
}
include 'cabecera.php';
require_once('conecta.php');
if (isset($_GET['tip'])){
$vcat=$_GET['tip'];
$pide = $pdo->prepare("SELECT * from productos Where tipo='$vcat'");
}else{
$pide = $pdo->prepare("SELECT * from productos Order By tipo");
}
?>
<!-- abajo esta la programacion-->
<!-- aqui va CSS -->
<style type="text/css">
*{
margin: 0px;
padding: 0px;
}
.contenedor{
width: 65%;
margin: 0 auto;
}
.col{
width: 29%;
margin-top: 13px;
margin-left: 30px;
margin-bottom: 62px;
display: inline-block;
}
.datos{
font-size: 18px;
text-align: center;
}
ul, ol {
list-style:none;
background-color: #708df7;
}
.nav > li {
float: left;
}
.nav li a {
height: 23px;
color: #fff;
text-decoration:none;
padding: 10px 15px;
display: block;
}
.nav li a:hover {
color: black;
}
.nav li ul {
display:none;
position:absolute;
min-width: 140px;
}
.nav li:hover > ul {
display:block;
}
.nav li ul li {
position:relative;
}
.nav li ul li ul {
right: -217px;
top: 6px;
}
.btn{
width: 160px;
height: 30px;
font-size: 15px;
color: #fff;
border: 0;
background-color: #6a85f2;
border-radius: 4px;
margin-top: 21px;
}
.btn:hover{
opacity: 0.8;
color: #ccc;
cursor: pointer;
}
#BotonArriba{
position: fixed;
width: 24px;
height: 24px;
bottom: 20px;
right: -100px;
transition: all 1s;
}
</style>
<!-- aqui va CSS -->
<div class="contenedor">
<?php
$pide->execute();
$dato = $pide->fetchAll(PDO::FETCH_ASSOC);
foreach ($dato as $fila) { ?>
<div class="col">
<img height=180 width="286"
src="<?php echo $fila['imagen'];?>"
data-toggle="popover"
data-trigger="hover"
data-content="<?php echo $fila['descripcion'];?>" >
<div class="datos">
<span><?php echo $fila['nombre'];?></span>
<h5>$ <?php echo number_format($fila['precio'],2); ?></h5>
<form name="f" action="carrito-agrega.php?mvt=<?php echo $fila['tipo']; ?>" method="post">
<input type="hidden" name="id" id="id" value="<?php echo $fila['id']; ?>" />
<input type="hidden" name="nombre" id="nombre" value="<?php echo $fila['nombre']; ?>"/>
<input type="hidden" name="precio" id="precio" value="<?php echo $fila['precio']; ?>"/>
<input type="hidden" name="cantidad" id="cantidad" value="<?php echo 1;?>"/>
<input type="submit" name="btnAccion" value="Agrega" class="btn" />
</form>
</div>
</div>
<?php } ?>
<a href="#AlPrincipio"><img src="./img-sys/flecha-up.PNG" id="BotonArriba"></a>
<script src="boton-arriba.js"></script>
</div>
<script type="text/javascript" src="js/jquery-3.7.1.js"></script>
<script>
/*$(document).ready(function(){
$('[data-toggle="popover"]').popover()
});*/
$(function () {
$('[data-toggle="popover"]').popover()
});
</script>
<?php include 'pie.php'; ?>