Fixed -> When you filter admin locale (add new locale and filter from top right corner) and go to product grid https://prnt.sc/z239b3

This commit is contained in:
devansh bawari 2021-02-11 14:40:34 +05:30
parent a9b803c7f3
commit 8979bad283
1 changed files with 13 additions and 4 deletions

View File

@ -1,12 +1,21 @@
@php
/* all locales */
$locales = core()->getAllLocales();
/* request and fallback handling */
$locale = request()->get('locale') ?: app()->getLocale();
$channel = request()->get('channel') ?: (core()->getCurrentChannelCode() ?: core()->getDefaultChannelCode());
$customer_group = request()->get('customer_group');
if ($channel == 'all') {
$locales = core()->getAllLocales();
} else {
$locales = app('Webkul\Core\Repositories\ChannelRepository')->findOneByField('code', $channel)->locales;
/* handling cases for new locale if not present in current channel */
if ($channel !== 'all') {
$channelLocales = app('Webkul\Core\Repositories\ChannelRepository')->findOneByField('code', $channel)->locales;
if ($channelLocales->contains('code', $locale)) {
$locales = $channelLocales;
} else {
$channel = 'all';
}
}
@endphp