Exemplo n.º 1
0
 public function addLinea(Producto $producto)
 {
     $id = $producto->getId();
     if (isset($this->carrito[$id])) {
         $lineacarrito = $this->getLinea($id);
         $lineacarrito->setCantidad($lineacarrito->getCantidad() + 1);
     } else {
         $lineacarrito = new LineaCarrito($producto, 1);
         $this->carrito[$id] = $lineacarrito;
     }
 }
Exemplo n.º 2
0
 function edit(Producto $producto)
 {
     $sql = "UPDATE {$this->tabla} SET nombre=:nombre, descripcion=:descripcion, precio=:precio, iva=:iva, estado=:estado WHERE id=:id";
     $param['id'] = $producto->getId();
     $param['nombre'] = $producto->getNombre();
     $param['descripcion'] = $producto->getDescripcion();
     $param['precio'] = $producto->getPrecio();
     $param['iva'] = $producto->getIva();
     $param['estado'] = $producto->getEstado();
     $r = $this->bd->setConsulta($sql, $param);
     if (!$r) {
         return -1;
     }
     return $this->bd->getNumeroFilas();
 }
Exemplo n.º 3
0
<?php

require "funciones.php";
$bd = new BaseDeDatos();
$bd->setConexion();
$producto = new Producto($_POST['id']);
$admin = new Administrador($_POST['id_user']);
$admin->actProducto($_POST['n'], $_POST['d'], $_POST['p'], $producto->getId());
Exemplo n.º 4
0
<?php

require "funciones.php";
$bd = new BaseDeDatos();
$bd->setConexion();
$producto = new Producto($_POST['id']);
$admin = new Administrador($_POST['usuario']);
$admin->eliminarProducto($producto->getId());
Exemplo n.º 5
0
 /**
  * Declares an association between this object and a Producto object.
  *
  * @param             Producto $v
  * @return FacturaDetalle The current object (for fluent API support)
  * @throws PropelException
  */
 public function setProducto(Producto $v = null)
 {
     if ($v === null) {
         $this->setProductoId(NULL);
     } else {
         $this->setProductoId($v->getId());
     }
     $this->aProducto = $v;
     // Add binding for other direction of this n:n relationship.
     // If this object has already been added to the Producto object, it will not be re-added.
     if ($v !== null) {
         $v->addFacturaDetalle($this);
     }
     return $this;
 }
Exemplo n.º 6
0
			}else if(event.keyCode == 39){
				var spinner = new Spinner(opts).spin(tar); 
				$('#ventana_emergente').load('php/detalles_prod.php?id='+id_siguiente);
			}
		}
	});
</script>
<?php 
$query = mysql_query("SELECT id_imagen, id_prod FROM imagen, producto WHERE producto.id_prod = '{$_GET['id']}' AND imagen.id_imagen = producto.id_prod");
if (mysql_num_rows($query) > 0) {
    while ($row = mysql_fetch_array($query)) {
        $producto = new Producto($row['id_prod']);
        $imagen = new Imagen($row['id_imagen'], '', '', '', '');
        ?>
<input type="hidden" id="id_prod" value="<?php 
        echo $producto->getId();
        ?>
">
<label class="pulse">Pulse 'Esc' para salir</label>
	<div class="detailProducto">
		<div id="<?php 
        echo $producto->getId();
        ?>
" class="detailImgProducto" style="background-image: url(<?php 
        echo str_replace('../', '', $imagen->getImagen('imagen'));
        ?>
);">
			<img src="img/delete.png" class="tool eliminar">
			<div class="tooltip">Eliminar publicación</div>
		</div>
		<div class="detailDesProd">
Exemplo n.º 7
0
 /**
  * Adds an object to the instance pool.
  *
  * Propel keeps cached copies of objects in an instance pool when they are retrieved
  * from the database.  In some cases -- especially when you override doSelect*()
  * methods in your stub classes -- you may need to explicitly add objects
  * to the cache in order to ensure that the same objects are always returned by doSelect*()
  * and retrieveByPK*() calls.
  *
  * @param      Producto $obj A Producto object.
  * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
  */
 public static function addInstanceToPool($obj, $key = null)
 {
     if (Propel::isInstancePoolingEnabled()) {
         if ($key === null) {
             $key = (string) $obj->getId();
         }
         // if key === null
         ProductoPeer::$instances[$key] = $obj;
     }
 }
Exemplo n.º 8
0
 /**
  * Filter the query by a related Producto object
  *
  * @param   Producto|PropelObjectCollection $producto The related object(s) to use as filter
  * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return   PromocionQuery The current query, for fluid interface
  * @throws   PropelException - if the provided filter is invalid.
  */
 public function filterByProducto($producto, $comparison = null)
 {
     if ($producto instanceof Producto) {
         return $this->addUsingAlias(PromocionPeer::PRODUCTO_ID, $producto->getId(), $comparison);
     } elseif ($producto instanceof PropelObjectCollection) {
         if (null === $comparison) {
             $comparison = Criteria::IN;
         }
         return $this->addUsingAlias(PromocionPeer::PRODUCTO_ID, $producto->toKeyValue('PrimaryKey', 'Id'), $comparison);
     } else {
         throw new PropelException('filterByProducto() only accepts arguments of type Producto or PropelCollection');
     }
 }
Exemplo n.º 9
0
 /**
  * Exclude object from result
  *
  * @param   Producto $producto Object to remove from the list of results
  *
  * @return ProductoQuery The current query, for fluid interface
  */
 public function prune($producto = null)
 {
     if ($producto) {
         $this->addUsingAlias(ProductoPeer::ID, $producto->getId(), Criteria::NOT_EQUAL);
     }
     return $this;
 }
Exemplo n.º 10
0
<?php

require "funciones.php";
$bd = new BaseDeDatos();
$bd->setConexion();
$producto = new Producto($_POST['id_prod']);
$usuario = new Usuario($_POST['usuario']);
$usuario->comprar($producto->getId());