@php
$discountPercentage = 0;
// Check if product has sale price different from regular price
if ($product->front_sale_price && $product->front_sale_price < $product->price) {
$discountPercentage = round((($product->price - $product->front_sale_price) / $product->price) * 100);
}
// For logged in customers, check for additional discounts
if (auth('customer')->check()) {
$customer = auth('customer')->user();
$finalPrice = $product->front_sale_price ?: $product->price;
// Wholesale customer pricing
if ($customer->customer_type == 1 && $product->wholesale_price) {
$finalPrice = $product->wholesale_price;
}
// Apply customer default discount
if (hasCustomerDiscount()) {
$finalPrice += getCustomerDiscountAmount();
}
// Recalculate discount percentage
if ($finalPrice < $product->price) {
$discountPercentage = (($product->price - $finalPrice) / $product->price) * 100;
$discountPercentage = number_format($discountPercentage, 2);
}
}
@endphp
@if($discountPercentage > 0)
{{ $discountPercentage }}% Off
@endif
{{-- @if($product->productLabels->count() > 0 && auth('customer')->user())
@foreach($product->productLabels as $label)
css_styles !!}>
{{ $label->name }}
@endforeach
@endif --}}
@if (($brands = $product->brand) && $brands->id)
{!! BaseHelper::clean($brands->name) !!}
@endif
@if (EcommerceHelper::isWishlistEnabled())
@endif
@if (EcommerceHelper::isCompareEnabled())
@endif
@if($product->productLabels->count() > 0 && auth('customer')->user())
@foreach($product->productLabels as $label)
css_styles !!}>
{{ $label->name }}
@endforeach
@endif
@if (($category = $product->categories->first()) && $category->id)
{!! BaseHelper::clean($category->name) !!}
@else
@endif
{{-- {!! BaseHelper::clean($product->name) !!}
--}}
{!! BaseHelper::clean($product->name) !!}
{!! Theme::partial('ecommerce.product-availability', compact('product')) !!}
@if (EcommerceHelper::isReviewEnabled())
({{ number_format($product->reviews_count) }})
@endif
{{-- Product Attributes for List View --}}
@if($product->defaultVariation && $product->defaultVariation->productAttributes->count() > 0)
@foreach($product->defaultVariation->productAttributes->groupBy('attribute_set_id') as $setId => $attributes)
{{ $attributes->first()->productAttributeSet->title }}:
@foreach($attributes as $attribute)
{{ $attribute->title }}
@endforeach
@endforeach
@endif
@if($product->productLabels->count() > 0 && auth('customer')->user())
@foreach($product->productLabels as $label)
css_styles !!}>
{{ $label->name }}
@endforeach
@endif
{{--
--}}
{!! Theme::partial('ecommerce.product-price', compact('product')) !!}