Merge pull request #495 from rahulshukla-webkul/development

Development
This commit is contained in:
JItendra Singh 2019-01-29 16:21:28 +05:30 committed by GitHub
commit ae4b1cebe2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 48 additions and 86 deletions

View File

@ -22,8 +22,12 @@ class CategoryDataGrid extends DataGrid
public function prepareQueryBuilder()
{
$queryBuilder = DB::table('categories as cat')
->select('cat.id as category_id', 'ct.name', 'cat.position', 'cat.status', 'ct.locale')
->leftJoin('category_translations as ct', 'cat.id', '=', 'ct.category_id');
->select('cat.id as category_id', 'ct.name', 'cat.position', 'cat.status', 'ct.locale',
DB::raw('COUNT(DISTINCT pc.product_id) as count'))
->leftJoin('category_translations as ct', 'cat.id', '=', 'ct.category_id')
->leftJoin('product_categories as pc', 'cat.id', '=', 'pc.category_id')
->groupBy('cat.id');
$this->addFilter('category_id', 'cat.id');
@ -77,6 +81,14 @@ class CategoryDataGrid extends DataGrid
'sortable' => true,
'searchable' => true,
]);
$this->addColumn([
'index' => 'count',
'label' => trans('admin::app.datagrid.no-of-products'),
'type' => 'number',
'sortable' => true,
'searchable' => true,
]);
}
public function prepareActions() {

View File

@ -131,6 +131,8 @@ class CustomerGroupController extends Controller
if ($group->is_user_defined == 0) {
session()->flash('warning', trans('admin::app.customers.customers.group-default'));
} else if (count($group->customer) > 0) {
session()->flash('warning', trans('admin::app.response.customer-associate', ['name' => 'Customer Group']));
} else {
session()->flash('success', trans('admin::app.response.delete-success', ['name' => 'Customer Group']));

View File

@ -145,7 +145,8 @@ return [
'country' => 'Country',
'tax-rate' => 'Rate',
'role' => 'Role',
'sub-total' => 'Sub Total'
'sub-total' => 'Sub Total',
'no-of-products' => 'Number of Products',
],
'account' => [
@ -755,6 +756,7 @@ return [
'last-delete-error' => 'At least one :name is required.',
'user-define-error' => 'Can not delete system :name',
'attribute-error' => ':name is used in configurable products.',
'attribute-product-error' => ':name is used in products.'
'attribute-product-error' => ':name is used in products.',
'customer-associate' => ':name can not be deleted because customer is associated with this group.'
],
];

View File

@ -2,10 +2,19 @@
namespace Webkul\Customer\Models;
use Illuminate\Database\Eloquent\Model;
use Webkul\Customer\Models\Customer;
class CustomerGroup extends Model
{
protected $table = 'customer_groups';
protected $fillable = ['name', 'is_user_defined'];
/**
* Get the customer for this group.
*/
public function customer()
{
return $this->hasMany(Customer::class);
}
}

View File

@ -16,13 +16,25 @@ class View extends AbstractProduct
$attributes = $product->attribute_family->custom_attributes;
$attributeOptionReposotory = app('Webkul\Attribute\Repositories\AttributeOptionRepository');
foreach ($attributes as $attribute) {
if ($attribute->is_visible_on_front && $product->{$attribute->code}) {
$value = $product->{$attribute->code};
if ($attribute->type == 'select') {
$attributeOption = $attributeOptionReposotory->find($value);
if ($attributeOption) {
$value = $attributeOption->translate(app()->getLocale())->label;
}
}
$data[] = [
'code' => $attribute->code,
'label' => $attribute->name,
'value' => $product->{$attribute->code},
];
'value' => $value,
];
}
}

View File

@ -30,7 +30,6 @@
<div class="right-content">
<ul class="right-content-menu">
@if (core()->getCurrentChannel()->currencies->count() > 1)
<li class="list">
<span class="dropdown-toggle">
@ -101,81 +100,6 @@
</li>
</ul>
</div>
{{-- <div class="right-content">
@if (core()->getCurrentChannel()->currencies->count() > 1)
<ul class="currency-switcher">
<div class="dropdown-toggle">
{{ core()->getCurrentCurrencyCode() }}
<i class="icon arrow-down-icon active"></i>
</div>
<div class="dropdown-list bottom-right">
<div class="dropdown-container">
<ul>
@foreach (core()->getCurrentChannel()->currencies as $currency)
<li>
<a href="?currency={{ $currency->code }}">{{ $currency->code }}</a>
</li>
@endforeach
</ul>
</div>
</div>
</ul>
@endif
<ul class="account-dropdown-container">
<li class="account-dropdown">
<div class="dropdown-toggle account">
<span class="icon account-icon"></span>
<i class="icon arrow-down-icon active"></i>
</div>
@guest('customer')
<div class="dropdown-list bottom-right" style="display: none;">
<div class="dropdown-container">
<label>{{ __('shop::app.header.title') }}</label><br/>
<span style="font-size: 12px;">{{ __('shop::app.header.dropdown-text') }}</span>
<ul class="account-dropdown-list">
<li><a class="btn btn-primary btn-sm" href="{{ route('customer.session.index') }}">{{ __('shop::app.header.sign-in') }}</a></li>
<li><a class="btn btn-primary btn-sm" href="{{ route('customer.register.index') }}">{{ __('shop::app.header.sign-up') }}</a></li>
</ul>
</div>
</div>
@endguest
@auth('customer')
<div class="dropdown-list bottom-right" style="display: none; max-width: 230px;">
<div class="dropdown-container">
<label>{{ auth()->guard('customer')->user()->first_name }}</label>
<ul>
<li><a href="{{ route('customer.profile.index') }}">{{ __('shop::app.header.profile') }}</a></li>
<li><a href="{{ route('customer.wishlist.index') }}">{{ __('shop::app.header.wishlist') }}</a></li>
<li><a href="{{ route('shop.checkout.cart.index') }}">{{ __('shop::app.header.cart') }}</a></li>
<li><a href="{{ route('customer.session.destroy') }}">{{ __('shop::app.header.logout') }}</a></li>
</ul>
</div>
</div>
@endauth
</li>
</ul>
<ul class="cart-dropdown-container">
@inject ('productImageHelper', 'Webkul\Product\Helpers\ProductImage')
<li class="cart-dropdown">
<span class="icon cart-icon"></span>
@include('shop::checkout.cart.mini-cart')
</li>
</ul>
</div> --}}
</div>
<div class="header-bottom" id="header-bottom">
@ -202,7 +126,6 @@
</div>
</div>
@push('scripts')
<script>
$(document).ready(function() {
@ -211,8 +134,10 @@
var searchResponsive = document.getElementsByClassName('search-responsive')[0];
var navResponsive = document.getElementsByClassName('header-bottom')[0];
search.addEventListener("click", header);
hamMenu.addEventListener("click", header);
if (search && hamMenu) {
search.addEventListener("click", header);
hamMenu.addEventListener("click", header);
}
function header() {
var className = document.getElementById(this.id).className;

View File

@ -49,7 +49,7 @@
@foreach ($products as $product)
@include ('shop::products.list.card', ['product' => $productFlat->product])
@endforeach
</div>
@endif