
24/04/2013, 02:39
|
| | Fecha de Ingreso: junio-2009
Mensajes: 3
Antigüedad: 15 años, 8 meses Puntos: 0 | |
Respuesta: Function comprar con Cakephp function comprar($idarticulo = null) {
if ($idarticulo != null) {
$articulo = $this->Articulo->find('first', array('conditions' => array('Articulo.id' => $idarticulo)));
if($articulo['Articulo']['stock']>0) {
[aquí iría la lógica cuando esta todo ok]
} else {
[aquí iría la lógica para cuando no hay stock]
}
}
Espero que les sirva. Salud! |