Good day my problem is that I do not know how to add a product directly to my table detailsCarito from datatables. I have an input in the last two columns where the amount of inventory to write the ones you want to add to the cart and the button ADD TO CART next to it.
while ( $aRow = $rResult->fetch_array())
{
$row = array();
for ( $i=0 ; $i<count($aColumnas) ; $i++ )
{
if ( $aColumnas[$i] == "version" )
{
/* Special output formatting for 'version' column */
$row[] = ($aRow[ $aColumnas[$i] ]=="0") ? '-' : $aRow[ $aColumnas[$i] ];
}
else if ( $aColumnas[$i] != ' ' )
{
/* General output */
if($aRow[ $aColumnas[$i] ]==$aRow['imag1']){//si la columna es imagen, imprime la imagen, sino los datos
$row[]= "<td><a href='detalles_productoDistr.php?ID=".$aRow['idProd']."'><img src=".$aRow['imag1']." width=70 heigth=70 ></a></td>";
}else
{
if($aRow[ $aColumnas[$i] ]==$aRow['precioMay']){
$row[] ='$'. $aRow[ $aColumnas[$i] ];//imprime el '$' si es precio
}else{
if($aRow[$aColumnas[$i]]==$aRow['existProd'])
{
$row[] = "<input type='text' name='agregarCarrito' id='textfield7' placeholder=".'Maximo:'.$aRow['existProd']." style='width: 80px' >";
#
}else{
$row[] = $aRow[ $aColumnas[$i]];
}
}
}
}
}
$row[]="<button name='agregar' type='submit' class='btn btn-large btn-primary' value='AGREGAR A CARRITO' >Agregar a Carrito<span class='glyphicon glyphicon-shopping-cart'></span></button>";
$output['aaData'][] = $row;
}
echo json_encode( $output );
I WANT TO CHANGE THE IMPUT BY:
<select class="selectpicker">
WHERE write or select up to the maximum amount possible. and the BUTTON if you add to cart. I do not know if I can call a function from the button, and I do not know if that can be done. I do not know if I ask for easy or difficult things, but my mind is closed and I do not know how to do it, and I look for it in many ways.