예제 #1
0
 /**
  * Setup the layout used by the controller.
  *
  * @return void
  */
 protected function getItem()
 {
     if (Request::ajax()) {
         $inp = Input::all();
         $misc = Misc::where('item_id', '=', $inp['id'])->where('item_talla', '=', $inp['talla'])->where('item_color', '=', $inp['color'])->where('deleted', '=', 0)->first();
         $aux = Misc::where('item_id', '=', $inp['id'])->where('deleted', '=', 0)->first();
         $img = Images::where('deleted', '!=', 1)->where('misc_id', '=', $aux->id)->first();
         $talla = Tallas::find($inp['talla']);
         $color = Colores::find($inp['color']);
         Cart::add(array('id' => $inp['id'], 'name' => $inp['name'], 'qty' => 1, 'options' => array('misc' => $misc->id, 'img' => $img->image, 'talla' => $inp['talla'], 'talla_desc' => $talla->talla_desc, 'color' => $inp['color'], 'color_desc' => $color->color_desc), 'price' => $inp['price']));
         $rowid = Cart::search(array('id' => $inp['id'], 'options' => array('talla' => $inp['talla'], 'color' => $inp['color'])));
         $item = Cart::get($rowid[0]);
         return Response::json(array('rowid' => $rowid[0], 'img' => $img->image, 'id' => $item->id, 'name' => $item->name, 'talla' => $talla->talla_desc, 'color' => $color->color_desc, 'qty' => $item->qty, 'price' => $item->price, 'subtotal' => $item->subtotal, 'cantArt' => Cart::count(), 'total' => Cart::total()));
     }
 }
예제 #2
0
 public function postElimColor()
 {
     if (Request::ajax()) {
         $id = Input::get('id');
         $color = Colores::find($id);
         $color->deleted = 1;
         $color->save();
         return Response::json(array('type' => 'success', 'msg' => 'Categoría eliminada correctamente'));
     }
 }