<button name="btn_filtrar_valores"
                                    type="submit" 
                                    class="btn btn-primary"
                                    >
                                <i class="fa fa-sign-out"></i>
                            </button>
                        </h4>
                        </form>
                    </div>
                </div>
                <!--End of price filter-->
                
                <form action=detalle_producto.php method="POST">
                    <div class="w3-row-margin">
                        <?php 
$p = new ProductoDal();
if (!isset($_POST['btn_filtrar_valores']) && !isset($_POST['btn_ordenar_precio_asc']) && !isset($_POST['btn_ordenar_precio_desc']) && !isset($_POST['btn_ordenar_alpha_asc']) && !isset($_POST['btn_ordenar_alpha_desc'])) {
    echo $p->listaProductoXTipoProducto($tipoProducto);
} else {
    if (isset($_POST['btn_filtrar_valores'])) {
        $valor1 = $_POST['valor_min'];
        $valor2 = $_POST['valor_max'];
        echo $p->listaProductoXValores($tipoProducto, $valor1, $valor2);
    } else {
        if (isset($_POST['btn_ordenar_precio_asc'])) {
            echo $p->listaProductoMenorAMayor($tipoProducto);
        } else {
            if (isset($_POST['btn_ordenar_precio_desc'])) {
                echo $p->listaProductoMayorAMenor($tipoProducto);
            } else {
                if (isset($_POST['btn_ordenar_alpha_asc'])) {
                        &nbsp;Hogar y Limpieza</a>
            <a class="list-group-item" href="busqueda_mascotas.php"> <img src="../icons/mascotas.png" width="30" height="30" alt="mascotas"/>
                        &nbsp;Mascotas</a>
                <!--/nav-->
            </div>
            <!--End of sidebar-->
            <div class="w3-col m7 w3-card w3-padding">

                <!--End of breadcrumbs-->
                <div class="w3-container red">
                    <h2>Detalles del producto:&nbsp;&nbsp;<i class="fa fa-search"></i> </h2>
                </div>
                <form action="../process/ProcesarCarro.php" method="POST">
                <div class="w3-row-margin">
                 <?php 
$p = new ProductoDal();
$idProducto = "";
if (isset($_POST["imagen"])) {
    $idProducto = $_POST["imagen"];
}
$p->busquedaProducto($idProducto);
?>
                 
                 
                </div>
                </form>         
            </div>
            <div class="w3-col m1">&nbsp;</div>
        </div>

        <br>
 if (isset($_POST['txt_subtotal'])) {
     //SESSION
     $sessionCliente = $_SESSION['cliente'];
     $sessionDespacho = $_SESSION['despacho'];
     $sessionMetodo = $_SESSION['metodo_pago'];
     $listCarro = $_SESSION['carro'];
     //CLASS
     //BUSINESS
     $despacho = new Despacho();
     $carro = new Carro();
     $venta = new Ventas();
     //DAL
     $despachoDal = new DespachoDal();
     $carroDal = new CarroDal();
     $ventaDAl = new VentaProductoDal();
     $productoDal = new ProductoDal();
     //SET DESPACHO
     $despacho->setDireccion($sessionDespacho['direccion']);
     $despacho->setNombrePersonaAEntregar($sessionDespacho['nombrePersona']);
     $despacho->setIdComuna($sessionDespacho['idComuna']);
     //INSERT DESPACHO
     $insertDespacho = $despachoDal->insertDespacho($despacho);
     switch ($insertDespacho) {
         case 1:
             echo 'despacho OK';
             break;
         default:
             echo "Despacho: " . $despachoDal->insertDespacho($despacho);
             break;
     }
     //SET CARRITO
<?php

try {
    include_once '../model.business/Producto.php';
    include_once '../model.dal/ProductoDal.php';
    if (isset($_POST['txt_id_producto'])) {
        //CLASS
        $p = new Producto();
        $pDal = new ProductoDal();
        //SET
        $id = $_POST['txt_id_producto'];
        $p->setIdProducto($_POST['txt_id_producto']);
        $p->setNombreProducto($_POST['txt_nombre_producto']);
        $p->setTipoProducto($_POST['ddl_lista_tipo_producto']);
        $p->setMarca($_POST['ddl_marca_producto']);
        $p->setPrecioUnitario($_POST['txt_precio']);
        $p->setStock($_POST['txt_stock']);
        $p->setEstado($_POST['rbtn_estado']);
        $p->setDescripcion($_POST['txt_descripcion']);
        if (isset($_POST['btn_guardar'])) {
            if ($pDal->updateProducto($p) == 1) {
                header("Location: ../intranet/redirect_index_intranet_producto_modificado.php");
            } else {
                header("Location: ../intranet/redirect_index_intranet_error.php");
            }
        }
        if (isset($_POST['btn_eliminar'])) {
            if ($pDal->deleteProducto($id) == 1) {
                header("Location: ../intranet/redirect_index_intranet_producto_eliminado.php");
            } else {
                header("Location: ../intranet/redirect_index_intranet_error.php");
                            <button name="btn_filtrar_valores"
                                    type="submit" 
                                    class="btn btn-primary"
                                    >
                                <i class="fa fa-sign-out"></i>
                            </button>
                        </h4>
                        </form>
                    </div>
                </div>
                <!--End of price filter-->
                
                <form action="detalle_producto.php" method="POST">
                    <div class="w3-row-margin">
                        <?php 
$p = new ProductoDal();
$busqueda = "";
if (isset($_POST["txt_busqueda"])) {
    $busqueda = $_POST["txt_busqueda"];
    $p->listaProductoGeneral($busqueda);
} else {
    if (isset($_POST["btn_filtrar_valores"])) {
        $valor1 = $_POST["valor_min"];
        $valor2 = $_POST["valor_max"];
        $p->listaProductoXValoresBusquedaGeneral($valor1, $valor2);
    } else {
        if (isset($_POST["btn_ordenar_precio_asc"])) {
            $p->listaProductoMenorAMayorBusquedaGeneral();
        } else {
            if (isset($_POST["btn_ordenar_precio_desc"])) {
                $p->listaProductoMayorAMenorBusquedaGeneral();
            
            <!--Content-->
            <div class="w3-col m7 w3-card w3-padding">
                <!--Title bar-->
                <div class="w3-container red">
                    <h2>Agregar nuevo producto&nbsp;&nbsp; <img src="../icons/new_product_w.png" width="50" height="50" alt="new_product_w"/>
                    </h2>
                     <p align="right" > <button class="btn btn-info" onclick="ayuda()"><i class="fa fa-question"></i></button>
                </div>
                <br>
                <!--End of title bar-->
                <div>
                    <form action="../process/create_product.php" enctype="multipart/form-data" method="POST"  >
                        <table border="1" class="w3-table w3-card red-l5">
                <?php 
$productoDal = new ProductoDal();
?>
                <tbody>
                    <tr>
                        <td>
                          Número  
                        </td>
                        <td>
                            <input type="text" 
                                   name="txt_id_producto" 
                                   value="<?php 
echo $productoDal->maxProducto();
?>
" 
                                   class="form-control"
                                   size="5" 
                                   name="btn_buscar" />
                        </td>
                    </tr>
                </tbody>
         </table>     
      </form>         
                    <!--Product Modification/Elimination-->
                    <form action="../process/modificar_eliminar_producto.php" method="POST">
                    <table>
                        <tbody>
                    <?php 
$id = 0;
if (isset($_POST['txt_id'])) {
    $id = $_POST['txt_id'];
}
$productoDal = new ProductoDal();
$p = new Producto();
$p = $productoDal->buscarProductoXId($id);
if (isset($p)) {
    ?>
                    <tr class="w3-row">
                        <td class="w3-col m5">
                            Número
                        </td>
                        <td class="w3-col m7">
                            <input type="text" 
                                   name="txt_id_producto" 
                                   value="<?php 
    echo $p->getIdProducto();
    ?>
" 
                    </div>
                </div>
                <!--End of carousel-->
                <br>
                <!--Main card-->
                
                <!--Title bar-->
                <div class="w3-container red">
                    <h2>Ofertas impactantes&nbsp;&nbsp;<i class="fa fa-heartbeat"></i> </h2>
                </div>
                <!--End of title bar-->
                <!--First Row of items-->
                <form action="categorias/detalle_producto.php" method="POST">
                  <div class="w3-row-margin">          
                      <?php 
$propiedadDal = new ProductoDal();
$propiedadDal->listaProductoEnOfertaIndex();
?>
                  </form>
                </div>
                        
                <!--End of first row of items-->
            </div>
            <!--End of content-->
            
            <!--Blank column-->
            <div class="w3-col m1">&nbsp;</div>
            <!--End of blank column-->
            
        </div>
        <!--End of Main Row-->
<?php

try {
    include_once '../model.business/Producto.php';
    include_once '../model.dal/ProductoDal.php';
    if (isset($_POST['txt_id_producto'])) {
        //Subir imagen al servidor
        $rutaServer = '../imagesProducts';
        $rutaTemp = $_FILES['imagen']['tmp_name'];
        $nombreIma = $_FILES['imagen']['name'];
        $rutaDestino = $rutaServer . "/" . $nombreIma;
        move_uploaded_file($rutaTemp, $rutaDestino);
        //Clases
        $p = new Producto();
        $pDal = new ProductoDal();
        //Set
        $p->setIdProducto($_POST['txt_id_producto']);
        $p->setNombreProducto($_POST['txt_nombre_producto']);
        $p->setPrecioUnitario($_POST['txt_precio']);
        $p->setStock($_POST['txt_stock']);
        $p->setDescripcion($_POST['txt_descripcion']);
        $p->setTipoProducto($_POST['ddl_lista_tipo_producto']);
        $p->setMarca($_POST['ddl_marca_producto']);
        //Recoge el NOMBRE del file
        $p->setUrlFoto($nombreIma);
        $p->setEstado($_POST['rbtn_estado']);
        //Registro BD
        $resultado = $pDal->insertProducto($p);
        switch ($resultado) {
            case 1:
                //out.print("Registro OK");