Category : product

enter image description hereenter image description hereenter image description hereHow can i increase product stock manually from backend.I need this type of process, when i search product then show all product then, when i click one product then show some function to add stock then submit the button then automatically update stock .i have two ..

Read more

VIEW FILE <div class="col-sm-4"> <label>Other Images</label> <div class="input-group control-group img_div form-group" > <input type="file" name="image[]" class="form-control"> <div class="input-group-btn"> <button class="btn btn-success btn-add-more" type="button">Add</button> </div> </div> </div> <div>@foreach($image as $image) <p><img src="{{asset(‘/files/’.$image->images)}}" height="50px" id="{{$image->id}}" class="photo"/> <button class="removeimg" data-id="{{$image->id}}" data-token="{{ csrf_token() }}">Remove</button></p> @endforeach </div> AJAX $(document).ready( function () { $(document).on(‘click’, ‘.removeimg’,function(){ var confirmation = confirm("are you sure ..

Read more

CONTROLLER public function updateproduct(Request $request, $id) { if($request->hasfile(‘images’)) { foreach($request->file(‘images’) as $file) { $name = time().’.’.$file->extension(); if($file->move(public_path().’/files/’, $name)){ Image::create([ ‘images’=>$name, ‘product_id’=>$product->id, ]); } } } $request->validate([ ‘name’=>’required’, ‘description’=>’required’, ‘images’=> ‘nullable’, ‘price’=>’required|numeric’, ‘quantity’=>’required|numeric’, ]); $product = Product::findOrFail($id); $product->name=$request->name; $product->description=$request->description; $product->price=$request->price; $product->quantity=$request->quantity; $product->update(); } There is products table, images table and product_images table. It works fine while ..

Read more

$this is namespace AppModelsProduct; protected $fillable = [ ‘name’, ‘slug’, ‘company_id’, ‘original_price’, ‘discount_price’, ‘code’, ‘barcode’, ‘quantity’, ‘parent_id’, ‘position’, ‘status’, ‘short_description’, ‘long_description’, ‘approved’, ‘auto_approve’ ]; enter code here public function childProducts() { return $this->hasMany(Product::class, ‘parent_id’, ‘id’); } my scope public function scopeActive($query) { return $query->where(‘status’, 1); } Sourc..

Read more

I have an edit product page in Voyager admin panel. I want to update related products. In the view, I’m displaying already stored related products. So I want to show all other products also to select the new one’s. My view is: <label class="control-label">Related Products</label> <select class="form-control select2-taggable select2-hidden-accessible" name="related_id[]" multiple> @foreach($relatedproducts as $related) <option ..

Read more

I stored related items from Add product form. I want to retrieve those stored items in edit product form so user can remove stored items and display all other products from product table to select new items. My view is <select class="form-control select2-taggable select2-hidden-accessible" name="related_id[]" multiple> <ul class="select2-selection__rendered"> @foreach($relatedproducts as $related) <li class="select2-selection__choice" title="{{$related->name}}" data-select2-id="{{$related->id}}">{{$related->name}} ..

Read more

I’m overriding voyager admin panel & trying to store multiple related items in add new product form. My view is <div class="form-group col-md-8"> <label class="control-label">Related Products</label> <select class="form-control chosen-select"> @foreach($products as $product) <option class="form-control" value="{{$product->id}}" name="related_id[]"> {{$product->name}} </option> @endforeach </select> </div> Product Model public function related() { return $this->belongsToMany(‘AppProduct’, ‘related_products’, ‘product_id’, ‘related_id’); } RelatedProduct Model ..

Read more