This commit is contained in:
rahul shukla 2021-01-20 20:55:12 +05:30
parent 4ba2ed0e3b
commit 54002459f3
3 changed files with 44 additions and 0 deletions

View File

@ -924,4 +924,32 @@ abstract class AbstractType
return false;
}
/**
* Get more offers for customer group pricing.
*
* @return array
*/
public function getCustomerGroupPricingOffers() {
$offerLines = [];
if ($this->haveSpecialPrice()) {
$customerGroupPrices = $this->product->customer_group_prices()->get()->sortBy('qty')->values()->all();
$rulePrice = app('Webkul\CatalogRule\Helpers\CatalogRuleProductPrice')->getRulePrice($this->product);
if ($rulePrice && $rulePrice->price > $this->product->special_price) {
foreach ($customerGroupPrices as $key => $customerGroupPrice) {
if ($key > 0) {
$price = $this->getCustomerGroupPrice($this->product, $customerGroupPrice->qty);
$save = (($this->product->price - $price)*100)/($this->product->price);
$offerLines[] = 'Buy' .' '. $customerGroupPrice->qty .' '.'for'.' '. core()->currency($price).' '. 'each and save'.' '.$save.'%';
}
}
}
}
return $offerLines;
}
}

View File

@ -63,6 +63,14 @@
@include ('shop::products.price', ['product' => $product])
@if (count($product->getTypeInstance()->getCustomerGroupPricingOffers()) > 0)
<div class="regular-price">
@foreach ($product->getTypeInstance()->getCustomerGroupPricingOffers() as $offers)
<p> {{ $offers }} </p>
@endforeach
</div>
@endif
@include ('shop::products.view.stock', ['product' => $product])
{!! view_render_event('bagisto.shop.products.view.short_description.before', ['product' => $product]) !!}

View File

@ -123,6 +123,14 @@
@include ('shop::products.price', ['product' => $product])
</div>
@if (count($product->getTypeInstance()->getCustomerGroupPricingOffers()) > 0)
<div class="col-12">
@foreach ($product->getTypeInstance()->getCustomerGroupPricingOffers() as $offers)
{{ $offers }} </br>
@endforeach
</div>
@endif
<div class="product-actions">
@if (core()->getConfigData('catalog.products.storefront.buy_now_button_display'))
@include ('shop::products.buy-now', [