Skip to content

Commit

Permalink
Add sale price
Browse files Browse the repository at this point in the history
  • Loading branch information
MilesChou committed Jul 9, 2023
1 parent 26ef7fb commit a681d7a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
7 changes: 6 additions & 1 deletion resources/views/shop/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,12 @@
alt="">
<div class="card-body ">
<p class="product-title">{{ substr($product->title,0,35) }}..</p>
<p class="product-price">Rs.{{ number_format($product->price) }}</p>
@if($product->onSale)
<small class="line-through text-dark">Rs. {{ $product->price }}</small>
<p class="product-price">Rs.{{ number_format($product->sale_price) }}</p>
@else
<p class="product-price">Rs.{{ number_format($product->price) }}</p>
@endif
</div>
</div>
</a>
Expand Down
10 changes: 9 additions & 1 deletion resources/views/shop/show.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,15 @@

<div class="my-2">
<h4>Price:</h4>
<p class="text-orange h4">Rs.{{ number_format($product->price) }}</p>
@if($product->onSale)
<p class="text-orange h4">Rs.{{number_format($product->sale_price)}}</p>
<p>
<span class="line-through h5"> Rs.{{$product->price}}</span>
<span class="btn btn-primary disabled ml-3"> {{ floor((($product->price - $product->sale_price)/$product->price)*100) }}% off</span>
</p>
@else
<p class="text-orange h4">Rs.{{number_format($product->price)}}</p>
@endif
</div>

<div class="my-3">
Expand Down

0 comments on commit a681d7a

Please sign in to comment.