Issue #3572 done
This commit is contained in:
parent
4ba2ed0e3b
commit
54002459f3
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
@ -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]) !!}
|
||||
|
|
|
|||
|
|
@ -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', [
|
||||
|
|
|
|||
Loading…
Reference in New Issue