예제 #1
0
 public function search()
 {
     $busq = Input::get('busq');
     $title = "Busqueda: " . $busq;
     $cat = Cat::where('deleted', '=', 0)->get(array('categorias.id', 'categorias.cat_nomb'));
     $subcat = array();
     foreach ($cat as $c) {
         $aux = SubCat::where('cat_id', '=', $c->id)->where('deleted', '=', 0)->get();
         $subcat[$c->id] = $aux->toArray();
     }
     $art = DB::select("SELECT DISTINCT `item`.`id`,\t\n\t\t\t\t\t\t\t\t\t\t   `item`.`item_nomb`,\n\t\t\t\t\t\t\t\t\t\t   `item`.`item_cod`,\n\t\t\t\t\t\t\t\t\t\t   `item`.`item_stock`,\n\t\t\t\t\t\t\t\t\t\t   `item`.`item_precio`,\n\t\t\t\t\t\t\t\t\t\t   `m`.`id` AS misc_id,\n\t\t\t\t\t\t\t\t\t\t   `i`.`image`\n\t\t\tFROM  `item` \n\t\t\tLEFT JOIN  `miscelanias` AS m ON  `m`.`item_id` =  `item`.`id` \n\t\t\tLEFT JOIN  `images` \t AS i ON  `i`.`misc_id` =  `m`.`id`\n\t\t\tLEFT JOIN  `tallas`      AS t ON  `m`.`item_talla`=`t`.`id`\n\t\t\tLEFT JOIN  `colores` \t AS c ON  `m`.`item_color`=`c`.`id`\n\t\t\tWHERE (\n\t\t\t\tLOWER(  `item`.`item_nomb` ) LIKE  '%" . strtolower($busq) . "%' OR\n\t\t\t\tLOWER(  `item`.`item_desc` ) LIKE  '%" . strtolower($busq) . "%' OR\n\t\t\t\tLOWER(  `item`.`item_precio` ) LIKE  '%" . strtolower($busq) . "%' OR\n\t\t\t\tLOWER(  `t`.`talla_desc` ) LIKE  '%" . strtolower($busq) . "%' OR\n\t\t\t\tLOWER(  `t`.`talla_nomb` ) LIKE  '%" . strtolower($busq) . "%' OR\n\t\t\t\tLOWER(  `c`.`color_nomb` ) LIKE  '%" . strtolower($busq) . "%' OR\n\t\t\t\tLOWER(  `c`.`color_desc` ) LIKE  '%" . strtolower($busq) . "%'\n\t\t\t)\n\t\t\tAND  `item`.`deleted` = 0\n\t\t\tGROUP BY item.id\n\t\t\t");
     return View::make('indexs.busq')->with('title', $title)->with('art', $art)->with('cat', $cat)->with('subcat', $subcat)->with('busq', $busq);
 }
예제 #2
0
 public function getNewMisc($id)
 {
     $title = "Nueva Caracteristica";
     $item = Items::find($id);
     $misc = Misc::where('item_id', '=', $item->id)->get();
     $item->misc = $misc;
     $cat = Cat::where('deleted', '=', 0)->get();
     $tallas = Tallas::where('deleted', '=', 0)->get();
     $colors = Colores::where('deleted', '=', 0)->get();
     return View::make('admin.newMisc')->with('title', $title)->with('item', $item)->with('cat', $cat)->with('tallas', $tallas)->with('colores', $colors);
 }