Ver Mensaje Individual
  #1 (permalink)  
Antiguo 04/11/2011, 06:54
ismaelbenavente
 
Fecha de Ingreso: octubre-2011
Mensajes: 7
Antigüedad: 13 años, 1 mes
Puntos: 1
Crear un carrito compras

Me gustaria que me pudieran ayudar a base de este código crear como un carro de compras, para que cuando se busque un articulo se vaya creando un lista para luego poder sacar los productos vendidos por pdf.

Os dejo el código:


Código PHP:
echo "<center><table border='0'>";
                echo 
"<tr>";
                        echo 
"<td width='100'><b><center>Nombre</center></td>";
                            
                        echo 
"<td width='100'><b><center>Ref. Articulo</center></b></td>";
                        echo 
"<td width='100'><b><center>Stock</center></b></td>";
                        echo 
"<td width='100'><b><center>PVP</center></b></td>";
                        echo 
"<td width='100'><b><center>Sector</center></b></td>";
                echo 
"</tr>";
        
        include(
'mpdf/mpdf.php');

        
$mpdf=new mPDF('c','A4','','',42,15,67,67,20,15);
        
$mpdf->setHeader(); 
        
$mpdf->AddPage();
        
        
$html="
        <HTML>
            <HEAD>
            <TITLE>VENTAS DEL DIA </TITLE> 
        </HEAD>
        <BODY>
                <center><table border='0'>
                <tr>
                        <td><h2><b><center>REF. ARTICULO</b></h2></center></td>    
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>    
                        <td width='100'><h2><b><center>NOMBRE</center></b></h2></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td width='100'><h2><b><center>STOCK</center></b></h2></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td width='100'><h2><b><center>PVP</center></b></h2></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td></td>
                        <td width='100'><h2><b><center>SECTOR</center></b></h2></td>
                </tr>"
;
        
                echo 
"<tr>";
                    echo 
"<form name='ref' action='' method='post'>";
                    echo 
"<td><input type='text' name='ref'></td>";
                        
                
$refA=$_POST['ref'];        
                        
            
            
                        
                
$busqueda="SELECT * FROM Articulos WHERE Descripcion='$refA'";
                
        
                  
$encontrado=@mysql_query($busqueda);
                
    
                if (!
$encontrado)
                echo 
"Error: No se han encontrado articulos";
                else 
                    {
                    while (
$fila=@mysql_fetch_array($encontrado))
                        {
                        
$art=$fila;
                        
$nom=$fila;
                        
$stock=$fila;
                        
$pvp=$fila;
                        
$sector=$fila;
                        
                    echo 
"<tr>";
                         echo 
"<td><center>$art[IdArticulo]</center></td>";
                                
                                echo 
"<td><center>$nom[Descripcion]</center></td>";
                                
                                echo 
"<td><center>$stock[Stock]</center></td>";
                                
                                echo 
"<td><center>$pvp[PVP]</center></td>";
                            
                                echo 
"<td><center>$sector[Sector]</center></td>";
                       echo 
"</tr>";
                    
$html.="    
                        <tr>
                                <td><center>$art[IdArticulo]</center></td>
                                <td></td>
                                <td></td>
                                <td></td>
                                <td></td>
                                <td><center>$nom[Descripcion]</center></td>
                                <td></td>
                                <td></td>
                                <td></td>
                                <td></td>
                                <td><center>$stock[Stock]</center></td>
                                <td></td>
                                <td></td>
                                <td></td>
                                <td></td>
                                <td><center>$pvp[PVP]</center></td>
                                <td></td>
                                <td></td>
                                <td></td>
                                <td></td>
                                <td><center>$sector[Sector]</center></td>
                        </tr>
                        </table>
                    </BODY>
                </HTML>"
;
                    
                
$mpdf->WriteHTML($html);
                        
$mpdf->Output('pdf/dia8.pdf','F');
                        
                    
                        }
                    
                    

                        
mysql_free_result($encontrado);
                        
                        
                    } 

Espero vuestra ayuda, gracias.