From a681d7a5573e6b25a4f03e60811bca08249ecf05 Mon Sep 17 00:00:00 2001 From: MilesChou Date: Mon, 10 Jul 2023 01:33:06 +0800 Subject: [PATCH] Add sale price --- resources/views/shop/index.blade.php | 7 ++++++- resources/views/shop/show.blade.php | 10 +++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/resources/views/shop/index.blade.php b/resources/views/shop/index.blade.php index 72f08a6b..66e0a285 100644 --- a/resources/views/shop/index.blade.php +++ b/resources/views/shop/index.blade.php @@ -89,7 +89,12 @@ alt="">

{{ substr($product->title,0,35) }}..

-

Rs.{{ number_format($product->price) }}

+ @if($product->onSale) + Rs. {{ $product->price }} +

Rs.{{ number_format($product->sale_price) }}

+ @else +

Rs.{{ number_format($product->price) }}

+ @endif
diff --git a/resources/views/shop/show.blade.php b/resources/views/shop/show.blade.php index 127d76f0..17f280ee 100644 --- a/resources/views/shop/show.blade.php +++ b/resources/views/shop/show.blade.php @@ -58,7 +58,15 @@

Price:

-

Rs.{{ number_format($product->price) }}

+ @if($product->onSale) +

Rs.{{number_format($product->sale_price)}}

+

+ Rs.{{$product->price}} + {{ floor((($product->price - $product->sale_price)/$product->price)*100) }}% off +

+ @else +

Rs.{{number_format($product->price)}}

+ @endif