Merge branch 'master' into variant_issue

Merged With Master
This commit is contained in:
devansh bawari 2020-10-08 17:28:28 +05:30
commit 64c0c46496
13 changed files with 72 additions and 16 deletions

View File

@ -170,7 +170,7 @@ class AddressController extends Controller
session()->flash('success', trans('admin::app.customers.addresses.success-delete'));
return redirect()->back();
return redirect()->route($this->_config['redirect']);
}
/**

View File

@ -938,6 +938,7 @@ return [
'gender' => 'Gender',
'email' => 'Email',
'date_of_birth' => 'Date of Birth',
'date_of_birth_placeholder' => 'yyyy-mm-dd',
'phone' => 'Phone',
'customer_group' => 'Customer Group',
'save-btn-title' => 'Save Customer',

View File

@ -72,7 +72,7 @@
<div class="control-group" :class="[errors.has('date_of_birth') ? 'has-error' : '']">
<label for="dob">{{ __('admin::app.customers.customers.date_of_birth') }}</label>
<input type="date" class="control" name="date_of_birth" v-validate="" value="{{ old('date_of_birth') }}" data-vv-as="&quot;{{ __('admin::app.customers.customers.date_of_birth') }}&quot;">
<input type="date" class="control" name="date_of_birth" v-validate="" value="{{ old('date_of_birth') }}" placeholder="{{ __('admin::app.customers.customers.date_of_birth_placeholder') }}" data-vv-as="&quot;{{ __('admin::app.customers.customers.date_of_birth') }}&quot;">
<span class="control-error" v-if="errors.has('date_of_birth')">@{{ errors.first('date_of_birth') }}</span>
</div>

View File

@ -1,16 +1,14 @@
{!! view_render_event('bagisto.admin.customer.edit.before', ['customer' => $customer]) !!}
<form method="POST" action="{{ route('admin.customer.update', $customer->id) }}">
<div class="page-content">
<div class="form-container">
@csrf()
<input name="_method" type="hidden" value="PUT">
<div class="style:overflow: auto;">&nbsp;</div>
<div slot="body">
{!! view_render_event('bagisto.admin.customer.edit.form.before', ['customer' => $customer]) !!}
<div class="control-group" :class="[errors.has('first_name') ? 'has-error' : '']">
<label for="first_name" class="required"> {{ __('admin::app.customers.customers.first_name') }}</label>
<input type="text" class="control" name="first_name" v-validate="'required'" value="{{old('first_name') ?:$customer->first_name}}"
@ -19,7 +17,7 @@
</div>
{!! view_render_event('bagisto.admin.customer.edit.first_name.after', ['customer' => $customer]) !!}
<div class="control-group" :class="[errors.has('last_name') ? 'has-error' : '']">
<label for="last_name" class="required"> {{ __('admin::app.customers.customers.last_name') }}</label>
<input type="text" class="control" name="last_name" v-validate="'required'" value="{{old('last_name') ?:$customer->last_name}}" data-vv-as="&quot;{{ __('shop::app.customer.signup-form.lastname') }}&quot;">
@ -95,11 +93,13 @@
@endforeach
</select>
</div>
{!! view_render_event('bagisto.admin.customer.edit.form.after', ['customer' => $customer]) !!}
</div>
<button type="submit" class="btn btn-lg btn-primary">
{{ __('admin::app.customers.customers.save-btn-title') }}
</button>
</div>
</div>
</form>
{!! view_render_event('bagisto.admin.customer.edit.after', ['customer' => $customer]) !!}
</form>

View File

@ -15,6 +15,7 @@ return [
'code' => 'paypal_smart_button',
'title' => 'Paypal Smart Button',
'description' => 'Paypal Smart Button',
'client_id' => 'sb',
'class' => 'Webkul\Paypal\Payment\SmartButton',
'sandbox' => true,
'active' => true,

View File

@ -87,6 +87,42 @@ class ProductFlatRepository extends Repository
return $filterAttributes;
}
/**
* filter attributes according to products
*
* @param array $category
* @return \Illuminate\Support\Collection
*/
public function getProductsRelatedFilterableAttributes($category) {
$products = app('Webkul\Product\Repositories\ProductRepository')->getProductsRelatedToCategory($category->id);
$filterAttributes = $this->getFilterableAttributes($category, $products);
$allProductAttributeOptionsCode = [];
foreach ($products as $key => $product) {
foreach ($filterAttributes as $attribute) {
if ($attribute->code <> 'price') {
if (isset($product[$attribute->code])) {
if (! in_array($product[$attribute->code], $allProductAttributeOptionsCode)) {
array_push($allProductAttributeOptionsCode, $product[$attribute->code]);
}
}
}
}
}
foreach ($filterAttributes as $attribute) {
foreach ($attribute->options as $key => $option) {
if (! in_array($option->id, $allProductAttributeOptionsCode)) {
unset($attribute->options[$key]);
}
}
}
return $filterAttributes;
}
/**
* update product_flat custom column

View File

@ -110,6 +110,23 @@ class ProductRepository extends Repository
Event::dispatch('catalog.product.delete.after', $id);
}
/**
* @param int $categoryId
*
* @return \Illuminate\Support\Collection
*/
public function getProductsRelatedToCategory($categoryId = null)
{
$qb = $this->model
->leftJoin('product_categories', 'products.id', '=', 'product_categories.product_id');
if ($categoryId) {
$qb->where('product_categories.category_id', $categoryId);
}
return $qb->get();
}
/**
* @param int $categoryId
*

View File

@ -67,7 +67,7 @@ export default {
self.images.push({
'path': self.public_path + '/storage/' + slider.path,
'title' : slider.title,
'slider_path': slider.slider_path ? self.public_path+'/'+slider.slider_path : null
'slider_path': slider.slider_path ? slider.slider_path : null
});
self.content.push(slider.content);

View File

@ -1,4 +1,4 @@
@if (app('Webkul\Product\Repositories\ProductRepository')->getFeaturedProducts())
@if (count(app('Webkul\Product\Repositories\ProductRepository')->getFeaturedProducts()))
<section class="featured-products">
<div class="featured-heading">

View File

@ -1,4 +1,4 @@
@if (app('Webkul\Product\Repositories\ProductRepository')->getNewProducts())
@if (count(app('Webkul\Product\Repositories\ProductRepository')->getNewProducts()))
<section class="featured-products">
<div class="featured-heading">

View File

@ -11,7 +11,7 @@
if (isset($category)) {
$products = $productRepository->getAll($category->id);
$filterAttributes = $productFlatRepository->getFilterableAttributes($category, $products);
$filterAttributes = $productFlatRepository->getProductsRelatedFilterableAttributes($category);
$maxPrice = core()->convertPrice($productFlatRepository->getCategoryProductMaximumPrice($category));
}

View File

@ -1,6 +1,7 @@
@php
$locale = request()->get('locale') ?: app()->getLocale();
$channel = request()->get('channel') ?: (core()->getCurrentChannelCode() ?: core()->getDefaultChannelCode());
$customer_group = request()->get('customer_group');
@endphp
<div class="table">
@ -27,7 +28,7 @@
@foreach ($results['extraFilters']['channels'] as $channelModel)
<option
value="{{ $channelModel->id }}"
{{ (isset($channel) && ($channelModel->code) == $channel) ? 'selected' : '' }}>
{{ (isset($channel) && ($channelModel->id) == $channel) ? 'selected' : '' }}>
{{ $channelModel->name }}
</option>
@endforeach

View File

@ -9,7 +9,7 @@
if (isset($category)) {
$products = $productRepository->getAll($category->id);
$filterAttributes = $productFlatRepository->getFilterableAttributes($category, $products);
$filterAttributes = $productFlatRepository->getProductsRelatedFilterableAttributes($category);
$maxPrice = core()->convertPrice($productFlatRepository->getCategoryProductMaximumPrice($category));
}