Merge pull request #6439 from Sanjaybhattwebkul/add-discount-precent

Enhancement #6367 done
This commit is contained in:
Glenn Hermans 2022-06-01 20:24:47 +02:00 committed by GitHub
commit 157b9f5f26
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 2 deletions

View File

@ -1,7 +1,18 @@
{!! view_render_event('bagisto.shop.products.price.before', ['product' => $product]) !!}
@php
if($product->getTypeInstance()->haveSpecialPrice()){
$specialPrice = $product->getTypeInstance()->getSpecialPrice();
$price = $product->price;
$Discount_Precent = "(".round(($specialPrice*100)/$price)."% off)";
}else{
$Discount_Precent ='';
}
@endphp
<div class="product-price">
{!! $product->getTypeInstance()->getPriceHtml() !!}
{!! $product->getTypeInstance()->getPriceHtml() !!} {{ $Discount_Precent }}
</div>
{!! view_render_event('bagisto.shop.products.price.after', ['product' => $product]) !!}
{!! view_render_event('bagisto.shop.products.price.after', ['product' => $product]) !!}