diff --git a/packages/Webkul/Product/src/Type/AbstractType.php b/packages/Webkul/Product/src/Type/AbstractType.php index 5ac820274..f5c30cad4 100644 --- a/packages/Webkul/Product/src/Type/AbstractType.php +++ b/packages/Webkul/Product/src/Type/AbstractType.php @@ -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; + } } \ No newline at end of file diff --git a/packages/Webkul/Shop/src/Resources/views/products/view.blade.php b/packages/Webkul/Shop/src/Resources/views/products/view.blade.php index 0f378be6d..f37336ac4 100755 --- a/packages/Webkul/Shop/src/Resources/views/products/view.blade.php +++ b/packages/Webkul/Shop/src/Resources/views/products/view.blade.php @@ -63,6 +63,14 @@ @include ('shop::products.price', ['product' => $product]) + @if (count($product->getTypeInstance()->getCustomerGroupPricingOffers()) > 0) +
+ @foreach ($product->getTypeInstance()->getCustomerGroupPricingOffers() as $offers) +

{{ $offers }}

+ @endforeach +
+ @endif + @include ('shop::products.view.stock', ['product' => $product]) {!! view_render_event('bagisto.shop.products.view.short_description.before', ['product' => $product]) !!} diff --git a/packages/Webkul/Velocity/src/Resources/views/shop/products/view.blade.php b/packages/Webkul/Velocity/src/Resources/views/shop/products/view.blade.php index b9fe70ce5..89af6057a 100644 --- a/packages/Webkul/Velocity/src/Resources/views/shop/products/view.blade.php +++ b/packages/Webkul/Velocity/src/Resources/views/shop/products/view.blade.php @@ -123,6 +123,14 @@ @include ('shop::products.price', ['product' => $product]) + @if (count($product->getTypeInstance()->getCustomerGroupPricingOffers()) > 0) +
+ @foreach ($product->getTypeInstance()->getCustomerGroupPricingOffers() as $offers) + {{ $offers }}
+ @endforeach +
+ @endif +
@if (core()->getConfigData('catalog.products.storefront.buy_now_button_display')) @include ('shop::products.buy-now', [