Issue #3572 fixes according to comment

This commit is contained in:
rahul shukla 2021-01-27 14:58:54 +05:30
parent 5620817db2
commit 5b05cf75f4
1 changed files with 16 additions and 1 deletions

View File

@ -932,8 +932,23 @@ abstract class AbstractType
public function getCustomerGroupPricingOffers() {
$offerLines = [];
$haveOffers = true;
$customerGroupId = null;
$customerGroupPrices = $this->product->customer_group_prices()->get()->sortBy('qty')->values()->all();
if (Cart::getCurrentCustomer()->check()) {
$customerGroupId = Cart::getCurrentCustomer()->user()->customer_group_id;
} else {
$customerGroupRepository = app('Webkul\Customer\Repositories\CustomerGroupRepository');
if ($customerGuestGroup = $customerGroupRepository->findOneByField('code', 'guest')) {
$customerGroupId = $customerGuestGroup->id;
}
}
$customerGroupPrices = $this->product->customer_group_prices()->where(function ($query) use ($customerGroupId) {
$query->where('customer_group_id', $customerGroupId)
->orWhereNull('customer_group_id');
}
)->groupBy('qty')->get()->sortBy('qty')->values()->all();
if ($this->haveSpecialPrice()) {
$rulePrice = app('Webkul\CatalogRule\Helpers\CatalogRuleProductPrice')->getRulePrice($this->product);