@extends('admin.master') @section('title', 'Edit Product') @php $selectedCategoryIds = old('categories', $product->categories->pluck('id')->all()); $selectedOfferIds = old('offers', $product->offers->pluck('id')->all()); $selectedFlagIds = old('flags', $product->flags->pluck('id')->all()); $imagesBySlot = $product->images->keyBy('slot_number'); $initialVariants = old( 'variants', $product->variants ->map(function ($variant) { return [ 'id' => $variant->id, 'name' => $variant->name, 'sku' => $variant->sku, 'regular_price' => $variant->regular_price, 'discount_type' => $variant->discount_type, 'discount_value' => $variant->discount_value, 'sale_price' => $variant->sale_price, 'stock_quantity' => $variant->stock_quantity, 'stock_alert_quantity' => $variant->stock_alert_quantity, 'weight_unit_id' => $variant->weight_unit_id, 'weight_value' => $variant->weight_value, 'is_default' => $variant->is_default, 'image' => $variant->image, 'attribute_value_ids' => $variant->attributeValues->pluck('id')->all(), ]; }) ->values() ->all(), ); @endphp @push('styles') @endpush @section('content')
@csrf @method('PUT')
Edit Product
{{ $product->name }}
Cancel
@if ($errors->any())
Please correct the following errors:
@endif
Product Information
@foreach ([ [ 'id' => 'editPublished', 'name' => 'is_published', 'label' => 'Published', 'checked' => old('is_published', $product->is_published), ], [ 'id' => 'editPreorder', 'name' => 'pre_order_enabled', 'label' => 'Pre-order Enabled', 'checked' => old('pre_order_enabled', $product->pre_order_enabled), ], [ 'id' => 'editTrackStock', 'name' => 'track_stock', 'label' => 'Track Inventory', 'checked' => old('track_stock', $product->track_stock), ], ] as $switchData)
{{ $switchData['label'] }}
@endforeach
Media
@for ($slot = 2; $slot <= 11; $slot++) @php $currentImage = $imagesBySlot->get($slot); @endphp @endfor
Product Price and Inventory
@foreach ([ [ 'label' => 'Stock Alert', 'name' => 'stock_alert_quantity', 'value' => $product->stock_alert_quantity, 'step' => '1', ], [ 'label' => 'Stock Quantity', 'name' => 'stock_quantity', 'value' => $product->stock_quantity, 'step' => '1', ], [ 'label' => 'Regular Price', 'name' => 'regular_price', 'value' => $product->regular_price, 'step' => '0.01', ], [ 'label' => 'Sale Price', 'name' => 'sale_price', 'value' => $product->sale_price, 'step' => '0.01', ], ] as $numberField)
@endforeach
has_variants))> Enable variants
Product Description
{!! old('short_description', $product->short_description) !!}
{!! old('long_description', $product->long_description) !!}
Delivery Type
@foreach ([ 'free_shipping' => 'Free Shipping', 'rate_by_weight' => 'Rate by Weight', ] as $value => $label) @endforeach
Offers
@forelse($offers as $offer)
{{ $offer->name }}
id, $selectedOfferIds))>
@empty No active offers. @endforelse
Product Flags
@forelse($flags as $flag)
{{ $flag->name }}
id, $selectedFlagIds))>
@empty No product flags. @endforelse
Digital Product
is_digital))> Digital Product
SEO
seo_enabled))> Enable SEO
@endsection @push('scripts') @endpush