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')); }
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!'); } }
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')); }
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')); }
public function edit() { $attrSets = AttributeSet::find(Input::get('id')); $action = route("admin.attrSets.save"); return view(Config('constants.adminAttrSetView') . '.addEdit', compact('attrSets', 'action')); }