<?php
require('db/db1.php');
require_once('secure_novalidate.php');
if (isset($_SESSION["id"])) {
$rec_usu = "Select * from usuarios where id_usr = '" . $_SESSION["id"] . "'";
$res_usu = $db1->Execute($rec_usu) or
die($db1->ErrorMsg());
} else {
$_SESSION["id"]=0;
}
$query_producto = "select * from productos where est_pro = 1 order by id_pro";
$res_producto = $db1->Execute($query_producto) or
die($db1->ErrorMsg());
$total_producto = $res_producto->RecordCount();
$filas_producto = $total_producto/3;
$_SESSION['ElementosCarro'] = "0";
if (isset($_REQUEST['id_producto'])) { $id_producto = $_REQUEST['id_producto'];
} else {
$id_producto = 0;
}
?>
<?php
while(!$res_producto->EOF){
$imagen = "images/".$res_producto->Fields("img_prod");
$imagen_alter ="img/productos/no.png" ;
//if($res_producto->Fields("tipo_prod")=="producto" || $_SESSION["id"] != 0){
if($res_producto->Fields("tipo_prod")=="producto") /* $res_producto->Fields("tipo_prod")=="bolsa"*/{
echo('<li id="producto">');
echo('<a class="cbp-vm-image" href="#"><img src="' . $imagen . '"></a>');
} else {
echo('<a class="cbp-vm-image" href="#"><img src="' . $imagen_alter . '"></a>');
}
echo('<div class="cbp-vm-price">$ ' . number_format(floatval($res_producto->Fields("prec_pro")), 0, ',', '.') . '</div>'); echo('<div class="cbp-vm-details">');
echo($res_producto->Fields("desc_pro"));
echo('</div>');
echo('<div id="ok' . $res_producto->Fields("id_pro") . '" class="cbp-vm-add-ok"><img src="images/ok.png" width="27"><h3>Agregado</h3><br><p><a href="carro.php">Ver carro</a></p></div>');
echo('<button id="add' . $res_producto->Fields("id_pro") . '" class="amarillo">Agregar al carro</button>');
echo('</li>');
}
$res_producto->MoveNext();
}
?>
<script type="text/javascript" src="js/jquery.min.js"></script>
<script type="text/javascript" src="js/jquery.easing.1.3.js"></script>
<script src="js/classie.js"></script>
<script src="js/modalEffects.js"></script>
<!-- for the blur effect -->
<!-- by @derSchepp https://github.com/Schepp/CSS-Filters-Polyfill -->
<script>
// this is important for IEs
var polyfilter_scriptpath = '/js/';
</script>
<script src="js/cssParser.js"></script>
<script src="js/css-filters-polyfill.js"></script>
<script src="js/cbpViewModeSwitch.js"></script>
<script src="js/jquery.scrollTo.min.js"></script>
<script>
$(document).ready(function(){
<?php
if ($id_producto!="") {
echo('$.ajax({');
echo('}).done(function(data) {');
echo('$("#ok' . $id_producto . '").show("slow");');
echo('$("#add' . $id_producto . '").hide();');
echo('});');
}
$query_producto = "select * from productos where est_pro = 1";
$res_producto = $db1->Execute($query_producto) or
die($db1->ErrorMsg());
while(!$res_producto->EOF) {
echo('$("#add' . $res_producto->Fields('id_pro') . '").click(function(){');
if($res_producto->Fields("tipo_prod")=="producto" || $_SESSION["id"] != 0){
echo('$.ajax({');
echo('}).done(function(data) {');
echo('$("#ok' . $res_producto->Fields('id_pro') . '").show("slow");');
echo('$("#add' . $res_producto->Fields('id_pro') . '").hide();');
echo('});');
} else {
echo('$("#need-user").delay(1000).fadeIn(400, function(){');
echo("$('#need-user-content').slideDown( 500, 'easeOutBounce');");
echo('});');
echo('$("#cerrar-need-user").click(function (){');
echo('$("#need-user").hide(100);');
echo('});');
echo('$("#Action").attr("action", "procesos/login_usuario
?id_producto=' . $res_producto->Fields('id_pro') . '");');
}
$elementos_carro = $_SESSION['ElementosCarro'];
if ($elementos_carro=='') {
$elementos_carro='0';
}
$elementos_carro = $elementos_carro + 1;
$_SESSION['ElementosCarro'] = $elementos_carro;
$_SESSION['Carro_' . $elementos_carro] = $res_producto->Fields('id_pro');
echo('});');
$res_producto->MoveNext();
}
?>
});
</script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-48658134-1', 'finderbee.com');
ga('send', 'pageview');
</script>
<?php include "footer.php"; ?>