public function save()
 {
     $attrSets = AttributeSet::findOrNew(Input::get('id'));
     $attrSets->attr_set = Input::get('attr_set');
     $attrSets->save();
     return redirect()->route('admin.attrSets.view');
 }
 public function edit()
 {
     //  dd(Helper::test());
     $attrs = Attribute::find(Input::get('id'));
     $attrSets = AttributeSet::get(['id', 'attr_set'])->toArray();
     $attr_types = AttributeType::all();
     $action = route("admin.attrs.save");
     return view(Config('constants.adminAttrView') . '.addEdit', compact('attrs', 'attrSets', 'action', 'attr_types'));
 }
Пример #3
0
 public function configurable($id)
 {
     $prod = Product::find($id);
     $producctAttrSetId = $prod->attr_set;
     $attrOpt = AttributeSet::find($producctAttrSetId)->attributes()->where("is_filterable", "=", 1)->get()->toArray();
     $prodId = $prod->id;
     $relatedProd = $prod->relatedproducts()->with('catalogimgs')->take(3)->get()->toArray();
     $upsellProd = $prod->upsellproducts()->with('catalogimgs')->take(3)->get()->toArray();
     // dd($upsellProd);
     return view(Config('constants.frontendCatalogProductView') . '.configurableProd', compact('prod', 'attrOpt', 'relatedProd', 'upsellProd'));
 }
Пример #4
0
 public function delete()
 {
     $id = Input::get('id');
     $getcount = Product::where("attr_set", "=", $id)->count();
     if ($getcount <= 0) {
         AttributeSet::find($id)->attributes()->detach();
         AttributeSet::find($id)->delete();
         return redirect()->back()->with('message', 'Attribute Set deleted successfully!');
     } else {
         return redirect()->back()->with('message', 'Sorry This Attribute Set is Part of a Product! Delete the Product First!');
     }
 }
Пример #5
0
 public function configProdAttrsWithoutStock($prodId)
 {
     $prod = Product::find($prodId);
     $attributes = AttributeSet::find($prod->attributeset['id'])->attributes()->get();
     $attrs = [];
     foreach ($attributes as $attr) {
         $attrs[$attr->id]['name'] = $attr->attr;
         $attrValues = $attr->attributeoptions()->get(['id', 'option_name']);
         foreach ($attrValues as $val) {
             $attrs[$attr->id]['options'][$val->id] = $val->option_name;
         }
     }
     $prodVariants = Product::where("parent_prod_id", "=", $prod->id)->get();
     $action = route('admin.products.configurable.update.without.stock');
     return view(Config('constants.adminProductView') . '.editCProdWithoutStock', compact('prod', 'action', 'attrs', 'prodVariants'));
 }
Пример #6
0
 public function prodAttrs($prodId)
 {
     $prod = Product::find($prodId);
     $attrs = AttributeSet::find($prod->attributeset['id'])->attributes->toArray();
     $action = route('update2Prod');
     return view(Config('constants.adminProductView') . '.edit2Prod', compact('prod', 'action', 'attrs'));
 }