{{-- Show all Vendor products --}} {{-- This file is 'iclude'-ed in front/products/vendor_listing.blade.php --}}
@foreach ($vendorProducts as $product)
{{-- Call the static getDiscountPrice() method in the Product.php Model to determine the final price of a product because a product can have a discount from TWO things: either a `CATEGORY` discount or `PRODUCT` discout --}} @php $getDiscountPrice = \App\Models\Product::getDiscountPrice($product['id']); @endphp @if ($getDiscountPrice > 0) {{-- If there's a discount on the price, show the price before (the original price) and after (the new price) the discount --}}
Rs . {{ $getDiscountPrice }}
Rs . {{ $product['product_price'] }}
@else {{-- if there's no discount on the price, show the original price --}}
Rs . {{ $product['product_price'] }}
@endif
@php $isProductNew = \App\Models\Product::isProductNew($product['id']) @endphp @if ($isProductNew == 'Yes')
NEW
@endif
@endforeach