public function postClear() { $clear = Input::get('clear'); // make sure submit was clicked if (!empty($clear)) { $items = Items::where('completed', 1)->delete(); } return Redirect::route('home'); }
public function getProcesePurchase($id) { $title = "Metodo de pago | Nia Boutique.com"; $fac = Facturas::find($id); $x = FacturaItem::where('factura_id', '=', $id)->sum('item_qty'); $aux = FacturaItem::where('factura_id', '=', $id)->get(array('item_id', 'item_qty', 'item_talla', 'item_color', 'item_precio')); $i = 0; $auxT = 0; $auxQ = 0; $p = ''; foreach ($aux as $a) { $b = Items::where('item.id', '=', $a->item_id)->first(); $p = $p . $b->item_nomb . ', '; $b->qty = $a->item_qty; $b->precio = $a->item_precio; $b->item_talla = Tallas::where('id', '=', $a->item_talla)->pluck('talla_desc'); $b->item_color = Colores::where('id', '=', $a->item_color)->pluck('color_desc'); $auxT = $auxT + $b->qty * $b->item_precio; $auxQ = $auxQ + $b->qty; $aux = Misc::where('item_id', '=', $a->item_id)->where('deleted', '=', 0)->first(); $b->img = Images::where('misc_id', '=', $aux->id)->where('deleted', '=', 0)->first(); $item[$i] = $b; $i++; } $total = 0; $method = 'hola'; $bancos = Bancos::where('deleted', '=', 0)->get(); return View::make('indexs.showCart')->with('title', $title)->with('method', $method)->with('total', $total)->with('items', $item)->with('id', $id)->with('bancos', $bancos); }
public function getShowItem($id) { $art = Items::where('item.id', '=', $id)->first(array('item.*')); $a = new stdClass(); $a->id = $art->id; $a->item_nomb = $art->item_nomb; $a->item_desc = $art->item_desc; $a->item_cod = $art->item_cod; $a->item_precio = $art->item_precio; if (!is_null($art->percent)) { $a->percent = $art->percent; } $a->misc = array(); $a->tallas = array(); $a->colores = array(); //$misc = Misc::where('item_id','=',$art->id)->first(); $misc = Misc::where('item_id', '=', $art->id)->get(); $aux = array(); $i = 0; foreach ($misc as $m) { $aux[$i] = Images::where('misc_id', '=', $m->id)->where('deleted', '=', 0)->get(); $i++; } $a->images = $aux; $t = Misc::where('item_id', '=', $art->id)->groupBy('item_talla')->get(array('item_talla')); $c = Misc::where('item_id', '=', $art->id)->get(array('item_color', 'item_talla')); $a->tallas = $t; $a->colores = $c; $tallas = Tallas::get(); $colores = Colores::get(); $title = $art->item_nomb; if (Auth::check() && Auth::user()->role == 1) { $layout = 'admin'; } else { $layout = 'default'; } $option = array(); $tallas = Tallas::get(); $colores = Colores::get(); return View::make('indexs.artSelf')->with('title', $title)->with('art', $a)->with('layout', $layout)->with('tallas', $tallas)->with('colores', $colores); }
public function postAddDelItemProm() { $id = Input::get('id'); $val = Input::get('val'); $item = Items::where('id', '=', $id)->first(); $item->item_prom = $val; if ($item->save()) { return Response::json(array('type' => 'success', 'msg' => 'Articulo agregado satisfactoriamente.')); } else { return Response::json(array('type' => 'danger', 'msg' => 'Error al agregar el articulo.')); } }