@forelse($stocks as $stock) @php $parent_image = null; if (!empty($stock->product) && !empty($stock->product->parent_product_id)) { $parent_image = App\Product::where('id', $stock->product->parent_product_id)->first(); } @endphp
qty == 0) hidden @endif>
{{ $stock->product->product_name ?? '' }} @php $product_sku = null; if (!empty($stock->product_id) && !empty($stock->attribute_value_id)) { if (!empty($stock->second_attribute_value_id)) { $product_sku = App\ProductHasMultipleVarition::where('product_id', $stock->product_id) ->where('attribute_value_id', $stock->attribute_value_id) ->where('second_attribute_value_id', $stock->second_attribute_value_id) ->first(); } else { $product_sku = App\ProductHasMultipleVarition::where('product_id', $stock->product_id) ->where('attribute_value_id', $stock->attribute_value_id) ->first(); } } @endphp @if (!empty($product_sku)) {{ $product_sku->sku }} @else ({{ $stock->product->sku ?? '' }}) @endif
@if (!empty($stock->qty)) ({{ $stock->qty }}) @else (0) @endif @php // Fetch the stock using the stock_id from the SaleItem $stock = App\Stock::find($stock->id); // Fetch the attribute values if stock exists if ($stock) { $attribute_value = App\AttributeValue::find($stock->attribute_value_id); $second_attribute_value = App\AttributeValue::find($stock->second_attribute_value_id); } @endphp @if ($stock && $attribute_value && $attribute_value->value) {{ $attribute_value->value }} @if ($second_attribute_value && $second_attribute_value->value) | {{ $second_attribute_value->value }} @endif @else (single) @endif
@empty

@endforelse