Merge pull request #3955 from devansh-webkul/name_issue

Fixed Name Issue #3656 and #3909
This commit is contained in:
Jitendra Singh 2020-09-24 15:23:34 +05:30 committed by GitHub
commit 837942fb3d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 11 additions and 9 deletions

View File

@ -3,9 +3,9 @@
namespace Webkul\Admin\DataGrids;
use Webkul\Core\Models\Locale;
use Webkul\Core\Models\Channel;
use Webkul\Ui\DataGrid\DataGrid;
use Illuminate\Support\Facades\DB;
use Webkul\Core\Models\Channel;
class ProductDataGrid extends DataGrid
{
@ -30,10 +30,10 @@ class ProductDataGrid extends DataGrid
parent::__construct();
/* locale */
$this->locale = request()->get('locale') ?? 'all';
$this->locale = request()->get('locale') ?? app()->getLocale();
/* channel */
$this->channel = request()->get('channel') ?? 'all';
$this->channel = request()->get('channel') ?? (core()->getCurrentChannelCode() ?: core()->getDefaultChannelCode());
/* finding channel code */
if ($this->channel !== 'all') {
@ -74,11 +74,10 @@ class ProductDataGrid extends DataGrid
DB::raw('SUM(DISTINCT ' . DB::getTablePrefix() . 'product_inventories.qty) as quantity')
);
$queryBuilder->groupBy('product_flat.product_id', 'product_flat.channel');
$queryBuilder->groupBy('product_flat.product_id', 'product_flat.locale', 'product_flat.channel');
$queryBuilder->whereIn('product_flat.locale', $whereInLocales);
$queryBuilder->whereIn('product_flat.channel', $whereInChannels);
// $queryBuilder->whereNotNull('product_flat.name');
$this->addFilter('product_id', 'product_flat.product_id');
$this->addFilter('product_name', 'product_flat.name');

View File

@ -6,8 +6,6 @@
@section('content')
<div class="content" style="height: 100%;">
<?php $locale = request()->get('locale') ?: null; ?>
<?php $channel = request()->get('channel') ?: null; ?>
<div class="page-header">
<div class="page-title">
<h1>{{ __('admin::app.catalog.products.title') }}</h1>

View File

@ -1,3 +1,8 @@
@php
$locale = request()->get('locale') ?: app()->getLocale();
$channel = request()->get('channel') ?: (core()->getCurrentChannelCode() ?: core()->getDefaultChannelCode());
@endphp
<div class="table">
<datagrid-filters></datagrid-filters>
@ -22,7 +27,7 @@
@foreach ($results['extraFilters']['channels'] as $channelModel)
<option
value="{{ $channelModel->id }}"
{{ (isset($channel) && ($channelModel->id) == $channel) ? 'selected' : '' }}>
{{ (isset($channel) && ($channelModel->code) == $channel) ? 'selected' : '' }}>
{{ $channelModel->name }}
</option>
@endforeach
@ -385,7 +390,7 @@
},
filterNumberInput: function(e){
this.numberValue = e.target.value.replace(/[^0-9\,\.]+/g, '');
this.numberValue = e.target.value.replace(/[^0-9\,\.]+/g, '');
},
getResponse: function() {