resolved issues
This commit is contained in:
commit
828aedf028
|
|
@ -1,6 +1,6 @@
|
|||
APP_NAME=Bagisto
|
||||
APP_ENV=local
|
||||
APP_VERSION=0.1.8
|
||||
APP_VERSION=1.0.0
|
||||
APP_KEY=
|
||||
APP_DEBUG=true
|
||||
APP_URL=http://localhost
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
APP_NAME=Laravel
|
||||
APP_ENV=local
|
||||
APP_VERSION=0.1.5
|
||||
APP_VERSION=1.0.0
|
||||
APP_KEY=base64:G4KY3tUsTaY9ONo1n/QyJvVLQZdJDgbIkSJswFK01HE=
|
||||
APP_DEBUG=true
|
||||
APP_URL=http://localhost
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
#### This changelog consists the bug & security fixes and new features being included in the releases listed below.
|
||||
|
||||
## **v0.1.0(28th of January 2020)** - *Release*
|
||||
## **v1.0.0-BETA1(5th of February 2020)** - *Release*
|
||||
|
||||
* [feature] Updated to laravel version 6.
|
||||
|
||||
|
|
|
|||
|
|
@ -146,7 +146,7 @@ class AttributeDataGrid extends DataGrid
|
|||
$this->addMassAction([
|
||||
'type' => 'delete',
|
||||
'action' => route('admin.catalog.attributes.massdelete'),
|
||||
'label' => 'Delete',
|
||||
'label' => trans('admin::app.datagrid.delete'),
|
||||
'index' => 'admin_name',
|
||||
'method' => 'DELETE'
|
||||
]);
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ class CMSPageDataGrid extends DataGrid
|
|||
{
|
||||
$this->addMassAction([
|
||||
'type' => 'delete',
|
||||
'label' => 'Delete',
|
||||
'label' => trans('admin::app.datagrid.delete'),
|
||||
'action' => route('admin.cms.mass-delete'),
|
||||
'method' => 'DELETE'
|
||||
]);
|
||||
|
|
|
|||
|
|
@ -89,7 +89,7 @@ class CartRuleCouponsDataGrid extends DataGrid
|
|||
// $this->addMassAction([
|
||||
// 'type' => 'delete',
|
||||
// 'action' => route('admin.catalog.attributes.massdelete'),
|
||||
// 'label' => 'Delete',
|
||||
// 'label' => trans('admin::app.datagrid.delete'),
|
||||
// 'method' => 'DELETE'
|
||||
// ]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -161,14 +161,14 @@ class CustomerDataGrid extends DataGrid
|
|||
{
|
||||
$this->addMassAction([
|
||||
'type' => 'delete',
|
||||
'label' => 'Delete',
|
||||
'label' => trans('admin::app.datagrid.delete'),
|
||||
'action' => route('admin.customer.mass-delete'),
|
||||
'method' => 'PUT',
|
||||
]);
|
||||
|
||||
$this->addMassAction([
|
||||
'type' => 'update',
|
||||
'label' => 'Update Status',
|
||||
'label' => trans('admin::app.datagrid.update-status'),
|
||||
'action' => route('admin.customer.mass-update'),
|
||||
'method' => 'PUT',
|
||||
'options' => [
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ class CustomerGroupDataGrid extends DataGrid
|
|||
{
|
||||
$this->addColumn([
|
||||
'index' => 'id',
|
||||
'label' => 'ID',
|
||||
'label' => trans('admin::app.datagrid.id'),
|
||||
'type' => 'number',
|
||||
'searchable' => false,
|
||||
'sortable' => true,
|
||||
|
|
@ -37,7 +37,7 @@ class CustomerGroupDataGrid extends DataGrid
|
|||
|
||||
$this->addColumn([
|
||||
'index' => 'code',
|
||||
'label' => 'Code',
|
||||
'label' => trans('admin::app.datagrid.code'),
|
||||
'type' => 'string',
|
||||
'searchable' => false,
|
||||
'sortable' => true,
|
||||
|
|
@ -46,7 +46,7 @@ class CustomerGroupDataGrid extends DataGrid
|
|||
|
||||
$this->addColumn([
|
||||
'index' => 'name',
|
||||
'label' => 'Name',
|
||||
'label' => trans('admin::app.datagrid.name'),
|
||||
'type' => 'string',
|
||||
'searchable' => true,
|
||||
'sortable' => true,
|
||||
|
|
|
|||
|
|
@ -109,14 +109,14 @@ class CustomerReviewDataGrid extends DataGrid
|
|||
public function prepareMassActions() {
|
||||
$this->addMassAction([
|
||||
'type' => 'delete',
|
||||
'label' => 'Delete',
|
||||
'label' => trans('admin::app.datagrid.delete'),
|
||||
'action' => route('admin.customer.review.massdelete'),
|
||||
'method' => 'DELETE'
|
||||
]);
|
||||
|
||||
$this->addMassAction([
|
||||
'type' => 'update',
|
||||
'label' => 'Update Status',
|
||||
'label' => trans('admin::app.datagrid.update-status'),
|
||||
'action' => route('admin.customer.review.massupdate'),
|
||||
'method' => 'PUT',
|
||||
'options' => [
|
||||
|
|
|
|||
|
|
@ -180,14 +180,14 @@ class ProductDataGrid extends DataGrid
|
|||
public function prepareMassActions() {
|
||||
$this->addMassAction([
|
||||
'type' => 'delete',
|
||||
'label' => 'Delete',
|
||||
'label' => trans('admin::app.datagrid.delete'),
|
||||
'action' => route('admin.catalog.products.massdelete'),
|
||||
'method' => 'DELETE'
|
||||
]);
|
||||
|
||||
$this->addMassAction([
|
||||
'type' => 'update',
|
||||
'label' => 'Update Status',
|
||||
'label' => trans('admin::app.datagrid.update-status'),
|
||||
'action' => route('admin.catalog.products.massupdate'),
|
||||
'method' => 'PUT',
|
||||
'options' => [
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ use Illuminate\Support\Facades\Event;
|
|||
use Webkul\Core\Repositories\CoreConfigRepository;
|
||||
use Webkul\Core\Tree;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Webkul\Admin\Http\Requests\ConfigurationForm;
|
||||
|
||||
/**
|
||||
* Configuration controller
|
||||
|
|
@ -116,16 +117,10 @@ class ConfigurationController extends Controller
|
|||
* @param \Webkul\Admin\Http\Requests\ConfigurationForm $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store()
|
||||
public function store(ConfigurationForm $request)
|
||||
{
|
||||
Event::dispatch('core.configuration.save.before');
|
||||
|
||||
if (request()->has('general.design.admin_logo.logo_image') && ! request()->input('general.design.admin_logo.logo_image.delete')) {
|
||||
$this->validate(request(), [
|
||||
'general.design.admin_logo.logo_image' => 'required|mimes:jpeg,bmp,png,jpg'
|
||||
]);
|
||||
}
|
||||
|
||||
$this->coreConfigRepository->create(request()->all());
|
||||
|
||||
Event::dispatch('core.configuration.save.after');
|
||||
|
|
|
|||
|
|
@ -24,12 +24,20 @@ class ConfigurationForm extends FormRequest
|
|||
*/
|
||||
public function rules()
|
||||
{
|
||||
$this->rules = [
|
||||
'sales.*.*.title' => 'required',
|
||||
'sales.*.*.active' => 'required',
|
||||
'sales.*.*.order_status' => 'required',
|
||||
'sales.*.*.file' => 'max:2048',
|
||||
];
|
||||
$this->rules = [];
|
||||
|
||||
// if (request()->has('sales.orderSettings.order_number')) {
|
||||
// $this->rules = [
|
||||
// 'sales.orderSettings.order_number.order_number_prefix' => 'required|regex:/^[a-zA-Z0-9$%^&*@]+$/u',
|
||||
// 'sales.orderSettings.order_number.order_number_suffix' => 'required|regex:/^[a-zA-Z0-9$%^&*@]+$/u',
|
||||
// ];
|
||||
// }
|
||||
|
||||
if (request()->has('general.design.admin_logo.logo_image') && ! request()->input('general.design.admin_logo.logo_image.delete')) {
|
||||
$this->rules = [
|
||||
'general.design.admin_logo.logo_image' => 'required|mimes:jpeg,bmp,png,jpg'
|
||||
];
|
||||
}
|
||||
|
||||
return $this->rules;
|
||||
}
|
||||
|
|
@ -42,9 +50,9 @@ class ConfigurationForm extends FormRequest
|
|||
public function messages()
|
||||
{
|
||||
return [
|
||||
'sales.*.*.title.required' => 'The title field is required.',
|
||||
'sales.*.*.active.required' => 'The status field is required.',
|
||||
'sales.*.*.order_status.required' => 'Order Status field is required',
|
||||
// 'sales.orderSettings.order_number.order_number_prefix.regex' => 'Invalid format. Can not use #.',
|
||||
// 'sales.orderSettings.order_number.order_number_suffix.regex' => 'Invalid format. Can not use #.',
|
||||
'general.design.admin_logo.logo_image.mimes' => 'Invalid file format. Use only jpeg, bmp, png, jpg.'
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -153,6 +153,7 @@ return [
|
|||
'refunded' => 'Refunded',
|
||||
'rtl' => 'RTL',
|
||||
'ltr' => 'LTR',
|
||||
'update-status' => 'Update Status'
|
||||
],
|
||||
|
||||
'account' => [
|
||||
|
|
|
|||
|
|
@ -216,6 +216,7 @@ return [
|
|||
'delete' => 'Delete',
|
||||
'rtl' => 'RTL',
|
||||
'ltr' => 'LTR',
|
||||
'update-status' => 'Update Status'
|
||||
],
|
||||
|
||||
'account' => [
|
||||
|
|
|
|||
|
|
@ -170,6 +170,7 @@ return [
|
|||
'refunded' => 'Refunded',
|
||||
'rtl' => 'RTL',
|
||||
'ltr' => 'LTR',
|
||||
'update-status' => 'Update Status'
|
||||
],
|
||||
|
||||
'account' => [
|
||||
|
|
|
|||
|
|
@ -158,6 +158,7 @@ return [
|
|||
'refunded' => 'Refunded',
|
||||
'rtl' => 'RTL',
|
||||
'ltr' => 'LTR',
|
||||
'update-status' => 'Update Status'
|
||||
],
|
||||
'account' => [
|
||||
'title' => 'Minha Conta',
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
{!! view_render_event('bagisto.admin.catalog.product.edit_form_accordian.downloadable.links.controls.before', ['product' => $product]) !!}
|
||||
|
||||
<div class="section">
|
||||
<div id="downloadable-link-list-section" class="section">
|
||||
<div class="secton-title">
|
||||
<span>{{ __('admin::app.catalog.products.links') }}</span>
|
||||
</div>
|
||||
|
|
@ -19,7 +19,7 @@
|
|||
|
||||
{!! view_render_event('bagisto.admin.catalog.product.edit_form_accordian.downloadable.samples.controls.before', ['product' => $product]) !!}
|
||||
|
||||
<div class="section">
|
||||
<div id="downloadable-sample-list-section" class="section">
|
||||
<div class="secton-title">
|
||||
<span>{{ __('admin::app.catalog.products.samples') }}</span>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -268,10 +268,47 @@
|
|||
data: function() {
|
||||
return {
|
||||
variants: variants,
|
||||
|
||||
old_variants: @json(old('variants')),
|
||||
|
||||
superAttributes: super_attributes
|
||||
}
|
||||
},
|
||||
|
||||
created: function () {
|
||||
var index = 0;
|
||||
|
||||
for (var key in this.old_variants) {
|
||||
var variant = this.old_variants[key];
|
||||
|
||||
if (key.indexOf('variant_') !== -1) {
|
||||
var inventories = [];
|
||||
|
||||
for (var inventorySourceId in variant['inventories']) {
|
||||
inventories.push({'qty': variant['inventories'][inventorySourceId], 'inventory_source_id': inventorySourceId})
|
||||
}
|
||||
|
||||
variant['inventories'] = inventories;
|
||||
|
||||
variants.push(variant);
|
||||
} else {
|
||||
for (var code in variant) {
|
||||
if (code != 'inventories') {
|
||||
variants[index][code] = variant[code];
|
||||
} else {
|
||||
variants[index][code] = [];
|
||||
|
||||
for (var inventorySourceId in variant[code]) {
|
||||
variants[index][code].push({'qty': variant[code][inventorySourceId], 'inventory_source_id': inventorySourceId})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
index++;
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
removeVariant: function(variant) {
|
||||
let index = this.variants.indexOf(variant)
|
||||
|
|
@ -301,6 +338,7 @@
|
|||
|
||||
created: function () {
|
||||
var this_this = this;
|
||||
|
||||
this.inventorySources.forEach(function(inventorySource) {
|
||||
this_this.inventories[inventorySource.id] = this_this.sourceInventoryQty(inventorySource.id)
|
||||
this_this.totalQty += parseInt(this_this.inventories[inventorySource.id]);
|
||||
|
|
@ -336,8 +374,11 @@
|
|||
},
|
||||
|
||||
sourceInventoryQty: function (inventorySourceId) {
|
||||
if (! Array.isArray(this.variant.inventories))
|
||||
return 0;
|
||||
|
||||
var inventories = this.variant.inventories.filter(function(inventory) {
|
||||
return inventorySourceId === inventory.inventory_source_id;
|
||||
return inventorySourceId === parseInt(inventory.inventory_source_id);
|
||||
})
|
||||
|
||||
if (inventories.length)
|
||||
|
|
@ -348,6 +389,7 @@
|
|||
|
||||
updateTotalQty: function () {
|
||||
this.totalQty = 0;
|
||||
|
||||
for (var key in this.inventories) {
|
||||
this.totalQty += parseInt(this.inventories[key]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -74,9 +74,11 @@
|
|||
<span class="control-error" v-if="errors.has('root_category_id')">@{{ errors.first('root_category_id') }}</span>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<div class="control-group" :class="[errors.has('hostname') ? 'has-error' : '']">
|
||||
<label for="hostname">{{ __('admin::app.settings.channels.hostname') }}</label>
|
||||
<input class="control" id="hostname" name="hostname" value="{{ old('hostname') }}" placeholder="https://www.example.com"/>
|
||||
<input class="control" v-validate="''" id="hostname" name="hostname" value="{{ old('hostname') }}" placeholder="https://www.example.com"/>
|
||||
|
||||
<span class="control-error" v-if="errors.has('hostname')">@{{ errors.first('hostname') }}</span>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -78,9 +78,11 @@
|
|||
<span class="control-error" v-if="errors.has('root_category_id')">@{{ errors.first('root_category_id') }}</span>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<div class="control-group" :class="[errors.has('hostname') ? 'has-error' : '']">
|
||||
<label for="hostname">{{ __('admin::app.settings.channels.hostname') }}</label>
|
||||
<input type="text" class="control" id="hostname" name="hostname" value="{{ $channel->hostname }}" placeholder="https://www.example.com"/>
|
||||
<input type="text" v-validate="''" class="control" id="hostname" name="hostname" value="{{ $channel->hostname }}" placeholder="https://www.example.com"/>
|
||||
|
||||
<span class="control-error" v-if="errors.has('hostname')">@{{ errors.first('hostname') }}</span>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -79,7 +79,8 @@ class ChannelController extends Controller
|
|||
'favicon.*' => 'mimes:jpeg,jpg,bmp,png',
|
||||
'seo_title' => 'required|string',
|
||||
'seo_description' => 'required|string',
|
||||
'seo_keywords' => 'required|string'
|
||||
'seo_keywords' => 'required|string',
|
||||
'hostname' => 'unique:channels,hostname',
|
||||
]);
|
||||
|
||||
$data = request()->all();
|
||||
|
|
@ -138,7 +139,8 @@ class ChannelController extends Controller
|
|||
'base_currency_id' => 'required',
|
||||
'root_category_id' => 'required',
|
||||
'logo.*' => 'mimes:jpeg,jpg,bmp,png',
|
||||
'favicon.*' => 'mimes:jpeg,jpg,bmp,png'
|
||||
'favicon.*' => 'mimes:jpeg,jpg,bmp,png',
|
||||
'hostname' => 'unique:channels,hostname,' . $id,
|
||||
]);
|
||||
|
||||
$data = request()->all();
|
||||
|
|
|
|||
|
|
@ -15,5 +15,7 @@ return [
|
|||
'filter-fields-missing' => 'بعض الحقل المطلوب هو لاغ ، رجاء تفقد عمود ، حالة و قيمة صحيح',
|
||||
'click_on_action' => 'هل تريد حقا أن تؤدي هذا العمل؟',
|
||||
'items-per-page' => 'Items Per Page',
|
||||
'value-here' => 'Value here',
|
||||
'numeric-value-here' => 'Numeric Value here'
|
||||
]
|
||||
];
|
||||
|
|
@ -37,5 +37,7 @@ return [
|
|||
'between' => 'Is between',
|
||||
'apply' => 'Apply',
|
||||
'items-per-page' => 'Items Per Page',
|
||||
'value-here' => 'Value here',
|
||||
'numeric-value-here' => 'Numeric Value here'
|
||||
]
|
||||
];
|
||||
|
|
@ -33,5 +33,7 @@ return [
|
|||
'between' => 'ما بین',
|
||||
'apply' => 'درخواست',
|
||||
'items-per-page' => 'Items Per Page',
|
||||
'value-here' => 'Value here',
|
||||
'numeric-value-here' => 'Numeric Value here'
|
||||
]
|
||||
];
|
||||
|
|
|
|||
|
|
@ -33,5 +33,7 @@ return [
|
|||
'between' => 'Está entre',
|
||||
'apply' => 'Aplicar',
|
||||
'items-per-page' => 'Items Per Page',
|
||||
'value-here' => 'Value here',
|
||||
'numeric-value-here' => 'Numeric Value here'
|
||||
]
|
||||
];
|
||||
|
|
@ -58,7 +58,7 @@
|
|||
{{-- Response fields based on the type of columns to be filtered --}}
|
||||
<li v-if='stringCondition != null'>
|
||||
<div class="control-group">
|
||||
<input type="text" class="control response-string" placeholder="Value here" v-model="stringValue" />
|
||||
<input type="text" class="control response-string" placeholder="{{ __('ui::app.datagrid.value-here') }}" v-model="stringValue" />
|
||||
</div>
|
||||
</li>
|
||||
|
||||
|
|
@ -79,7 +79,7 @@
|
|||
|
||||
<li v-if='numberCondition != null'>
|
||||
<div class="control-group">
|
||||
<input type="number" class="control response-number" placeholder="Numeric Value here" v-model="numberValue"/>
|
||||
<input type="number" class="control response-number" placeholder="{{ __('ui::app.datagrid.numeric-value-here') }}" v-model="numberValue"/>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ class CategoryDataGrid extends DataGrid
|
|||
public function prepareQueryBuilder()
|
||||
{
|
||||
$defaultChannel = core()->getCurrentChannel();
|
||||
|
||||
|
||||
$queryBuilder = DB::table('velocity_category as v_cat')
|
||||
->select('v_cat.id as category_menu_id', 'v_cat.category_id', 'ct.name', 'v_cat.icon', 'v_cat.tooltip', 'v_cat.status')
|
||||
->leftJoin('categories as c', 'c.id', '=', 'v_cat.category_id')
|
||||
|
|
@ -109,7 +109,7 @@ class CategoryDataGrid extends DataGrid
|
|||
$this->addMassAction([
|
||||
'type' => 'delete',
|
||||
'action' => route('velocity.admin.category.mass-delete'),
|
||||
'label' => 'Delete',
|
||||
'label' => trans('admin::app.datagrid.delete'),
|
||||
'method' => 'DELETE'
|
||||
]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -116,7 +116,7 @@ class ContentDataGrid extends DataGrid
|
|||
$this->addMassAction([
|
||||
'type' => 'delete',
|
||||
'action' => route('velocity.admin.content.mass-delete'),
|
||||
'label' => 'Delete',
|
||||
'label' => trans('admin::app.datagrid.delete'),
|
||||
'method' => 'DELETE'
|
||||
]);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ class VelocityMetaDataSeeder extends Seeder
|
|||
|
||||
'subscription_bar_content' => '<div class="social-icons col-lg-6"><a href="https://webkul.com" target="_blank" class="unset" rel="noopener noreferrer"><i class="fs24 within-circle rango-facebook" title="facebook"></i> </a> <a href="https://webkul.com" target="_blank" class="unset" rel="noopener noreferrer"><i class="fs24 within-circle rango-twitter" title="twitter"></i> </a> <a href="https://webkul.com" target="_blank" class="unset" rel="noopener noreferrer"><i class="fs24 within-circle rango-linked-in" title="linkedin"></i> </a> <a href="https://webkul.com" target="_blank" class="unset" rel="noopener noreferrer"><i class="fs24 within-circle rango-pintrest" title="Pinterest"></i> </a> <a href="https://webkul.com" target="_blank" class="unset" rel="noopener noreferrer"><i class="fs24 within-circle rango-youtube" title="Youtube"></i> </a> <a href="https://webkul.com" target="_blank" class="unset" rel="noopener noreferrer"><i class="fs24 within-circle rango-instagram" title="instagram"></i></a></div>',
|
||||
|
||||
'product_policy' => '<div class="row col-12 remove-padding-margin"><div class="col-lg-4 col-sm-12 product-policy-wrapper"><div class="card"><div class="policy"><div class="left"><i class="rango-van-ship fs40"></i></div> <div class="right"><span class="font-setting fs20">Free Shippingon Order $20 or More</span></div></div></div></div> <div class="col-lg-4 col-sm-12 product-policy-wrapper"><div class="card"><div class="policy"><div class="left"><i class="rango-exchnage fs40"></i></div> <div class="right"><span class="font-setting fs20">Product Replace & Return Available </span></div></div></div></div> <div class="col-lg-4 col-sm-12 product-policy-wrapper"><div class="card"><div class="policy"><div class="left"><i class="rango-exchnage fs40"></i></div> <div class="right"><span class="font-setting fs20">Product Exchange and EMI Available </span></div></div></div></div></div>',
|
||||
'product_policy' => '<div class="row col-12 remove-padding-margin"><div class="col-lg-4 col-sm-12 product-policy-wrapper"><div class="card"><div class="policy"><div class="left"><i class="rango-van-ship fs40"></i></div> <div class="right"><span class="font-setting fs20">Free Shipping on Order $20 or More</span></div></div></div></div> <div class="col-lg-4 col-sm-12 product-policy-wrapper"><div class="card"><div class="policy"><div class="left"><i class="rango-exchnage fs40"></i></div> <div class="right"><span class="font-setting fs20">Product Replace & Return Available </span></div></div></div></div> <div class="col-lg-4 col-sm-12 product-policy-wrapper"><div class="card"><div class="policy"><div class="left"><i class="rango-exchnage fs40"></i></div> <div class="right"><span class="font-setting fs20">Product Exchange and EMI Available </span></div></div></div></div></div>',
|
||||
]);
|
||||
|
||||
DB::table('locales')->where('code', 'en')->update([
|
||||
|
|
|
|||
|
|
@ -3,10 +3,35 @@
|
|||
namespace Webkul\Velocity\Repositories\Product;
|
||||
|
||||
use Webkul\Core\Eloquent\Repository;
|
||||
use Illuminate\Container\Container as App;
|
||||
use Webkul\Product\Repositories\ProductFlatRepository;
|
||||
use Webkul\Attribute\Repositories\AttributeRepository;
|
||||
|
||||
class ProductRepository extends Repository
|
||||
{
|
||||
/**
|
||||
* AttributeRepository object
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $attributeRepository;
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
*
|
||||
* @param Webkul\Attribute\Repositories\AttributeRepository $attributeRepository
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(
|
||||
AttributeRepository $attributeRepository,
|
||||
App $app
|
||||
)
|
||||
{
|
||||
$this->attributeRepository = $attributeRepository;
|
||||
|
||||
parent::__construct($app);
|
||||
}
|
||||
|
||||
/**
|
||||
* Specify Model class name
|
||||
*
|
||||
|
|
@ -78,20 +103,23 @@ class ProductRepository extends Repository
|
|||
$term = $params['term'];
|
||||
$categoryId = $params['category'];
|
||||
|
||||
$results = app(ProductFlatRepository::class)->scopeQuery(function($query) use($term, $categoryId) {
|
||||
$results = app(ProductFlatRepository::class)->scopeQuery(function($query) use($term, $categoryId, $params) {
|
||||
$channel = request()->get('channel') ?: (core()->getCurrentChannelCode() ?: core()->getDefaultChannelCode());
|
||||
|
||||
$locale = request()->get('locale') ?: app()->getLocale();
|
||||
|
||||
$query = $query->distinct()
|
||||
->addSelect('product_flat.*')
|
||||
->leftJoin('products', 'product_flat.product_id', '=', 'products.id')
|
||||
->leftJoin('product_categories', 'products.id', '=', 'product_categories.product_id')
|
||||
->where('product_flat.status', 1)
|
||||
->where('product_flat.visible_individually', 1)
|
||||
->where('product_flat.channel', $channel)
|
||||
->where('product_flat.locale', $locale)
|
||||
->whereNotNull('product_flat.url_key')
|
||||
->where('product_flat.name', 'like', '%' . urldecode($term) . '%')
|
||||
->orderBy('product_id', 'desc');
|
||||
->whereNotNull('product_flat.url_key');
|
||||
|
||||
if ( $term )
|
||||
$query->where('product_flat.name', 'like', '%' . urldecode($term) . '%');
|
||||
|
||||
if ($categoryId && $categoryId !== "") {
|
||||
$query = $query
|
||||
|
|
@ -100,8 +128,63 @@ class ProductRepository extends Repository
|
|||
->where('product_categories.category_id', $categoryId);
|
||||
}
|
||||
|
||||
return $query;
|
||||
})->paginate(16);
|
||||
if (isset($params['sort'])) {
|
||||
$attribute = $this->attributeRepository->findOneByField('code', $params['sort']);
|
||||
|
||||
if ($params['sort'] == 'price') {
|
||||
if ($attribute->code == 'price') {
|
||||
$query->orderBy('min_price', $params['order']);
|
||||
} else {
|
||||
$query->orderBy($attribute->code, $params['order']);
|
||||
}
|
||||
} else {
|
||||
$query->orderBy($params['sort'] == 'created_at' ? 'product_flat.created_at' : $attribute->code, $params['order']);
|
||||
}
|
||||
}
|
||||
|
||||
$query = $query->leftJoin('products as variants', 'products.id', '=', 'variants.parent_id');
|
||||
|
||||
$query = $query->where(function($query1) use($query) {
|
||||
$aliases = [
|
||||
'products' => 'filter_',
|
||||
'variants' => 'variant_filter_'
|
||||
];
|
||||
|
||||
foreach($aliases as $table => $alias) {
|
||||
$query1 = $query1->orWhere(function($query2) use ($query, $table, $alias) {
|
||||
|
||||
foreach ($this->attributeRepository->getProductDefaultAttributes(array_keys(request()->input())) as $code => $attribute) {
|
||||
$aliasTemp = $alias . $attribute->code;
|
||||
|
||||
$query = $query->leftJoin('product_attribute_values as ' . $aliasTemp, $table . '.id', '=', $aliasTemp . '.product_id');
|
||||
|
||||
$column = ProductAttributeValue::$attributeTypeFields[$attribute->type];
|
||||
|
||||
$temp = explode(',', request()->get($attribute->code));
|
||||
|
||||
if ($attribute->type != 'price') {
|
||||
$query2 = $query2->where($aliasTemp . '.attribute_id', $attribute->id);
|
||||
|
||||
$query2 = $query2->where(function($query3) use($aliasTemp, $column, $temp) {
|
||||
foreach($temp as $code => $filterValue) {
|
||||
if (! is_numeric($filterValue))
|
||||
continue;
|
||||
|
||||
$columns = $aliasTemp . '.' . $column;
|
||||
$query3 = $query3->orwhereRaw("find_in_set($filterValue, $columns)");
|
||||
}
|
||||
});
|
||||
} else {
|
||||
$query2->where('product_flat.min_price', '>=', core()->convertToBasePrice(current($temp)))
|
||||
->where('product_flat.min_price', '<=', core()->convertToBasePrice(end($temp)));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
return $query->groupBy('product_flat.id');
|
||||
})->paginate(isset($params['limit']) ? $params['limit'] : 9);
|
||||
|
||||
return $results;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -106,6 +106,10 @@
|
|||
methods: {
|
||||
togglePopup: function (event) {
|
||||
let accountModal = this.$el.querySelector('.account-modal');
|
||||
let modal = $('#cart-modal-content')[0];
|
||||
if (modal)
|
||||
modal.classList.toggle('hide');
|
||||
|
||||
accountModal.classList.toggle('hide');
|
||||
|
||||
event.stopPropagation();
|
||||
|
|
|
|||
|
|
@ -49,7 +49,6 @@
|
|||
|
||||
<option
|
||||
:value="option.id"
|
||||
:key="`index-${Math.random()}`"
|
||||
v-for='(option, index) in attribute.options'>
|
||||
@{{ option.label }}
|
||||
</option>
|
||||
|
|
|
|||
|
|
@ -21,6 +21,6 @@ class CustomerCest
|
|||
|
||||
$I->seeCurrentRouteIs('admin.customer.index');
|
||||
$I->see($customer->id, '//script[@type="text/x-template"]');
|
||||
$I->see($customer->name, '//script[@type="text/x-template"]');
|
||||
$I->see($customer->last_name, '//script[@type="text/x-template"]');
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue