@props([ // 有動作 [default:true] 'hasActionMode' => !isset($attributes['has-action']) || $attributes['has-action'] === '1' ? true : false, // 有圖片模式 [default:true] 'hasImageMode' => !isset($attributes['has-image']) || $attributes['has-image'] === '1' ? true : false, ]) @php // 商品價格 // $price = optional($product->activity_product)->price ?? $product->price ?? $product->original_price; $price = $product->sell_price; @endphp
@if(isset($product))
merge([ 'class' => ($hasImageMode === true ? 'col-md-1' : 'col-md-2') . ' ' . ($hasActionMode === true ? 'd-flex' : 'd-none') . ' ' . ' align-content-center flex-wrap ' ]) }}> {{-- add_product_to_cart 是訂單使用的 | add_product_to_combination 是商品管理用的 --}} {{-- 我再想想怎麼優化,夠亂了 (ΦωΦ) --}}
merge(['class' => 'col-md-3 align-content-center flex-wrap '. ($hasImageMode === true ? 'd-flex' : 'd-none') ]) }}>
merge(['class' => ($hasImageMode === true ? 'col-md-8' : 'col-md-10') ]) }} >

{{ $product->name }}

{{ $product->code }} @if (optional($product->activity_product)->product_property_id == \App\Constants\ProductPropertyConstant::PROPERTY_ADDITIONAL)
加價購
@elseif (optional($product->activity_product)->product_property_id == \App\Constants\ProductPropertyConstant::PROPERTY_TRY)
試吃品
@endif
@if($product->original_price > $price) $ {{ number_format($product->original_price) }} @endif $ {{ number_format($price) }}
@if ($product->combinations->isNotEmpty()) @foreach ($product->combinations as $product_combination) {{-- 只有一個規格就不顯示了--}} {{-- @continue($product_combination->material_specifications->count() == 1)--}}
{{ $product_combination->name ?: '組合' . $product_combination->index }}
@if ($product_combination->material_specifications->isNotEmpty()) @foreach ($product_combination->material_specifications as $spec) @endforeach @endif
@endforeach @endif
@endif