fix category issue and change country,state order

This commit is contained in:
rahulshukla-home 2020-04-28 08:14:53 +05:30
parent 22b4079fdb
commit 837c5d44fa
2 changed files with 46 additions and 44 deletions

View File

@ -145,14 +145,16 @@ class ProductRepository extends Repository
if (isset($params['sort'])) {
$attribute = $this->attributeRepository->findOneByField('code', $params['sort']);
if ($params['sort'] == 'price') {
if ($attribute->code == 'price') {
$qb->orderBy('min_price', $params['order']);
if ($attribute) {
if ($params['sort'] == 'price') {
if ($attribute->code == 'price') {
$qb->orderBy('min_price', $params['order']);
} else {
$qb->orderBy($attribute->code, $params['order']);
}
} else {
$qb->orderBy($attribute->code, $params['order']);
$qb->orderBy($params['sort'] == 'created_at' ? 'product_flat.created_at' : $attribute->code, $params['order']);
}
} else {
$qb->orderBy($params['sort'] == 'created_at' ? 'product_flat.created_at' : $attribute->code, $params['order']);
}
}

View File

@ -161,6 +161,26 @@
</span>
</div>
<div class="control-group" :class="[errors.has('address-form.billing[country]') ? 'has-error' : '']">
<label for="billing[country]" class="required">
{{ __('shop::app.checkout.onepage.country') }}
</label>
<select type="text" v-validate="'required'" class="control" id="billing[country]" name="billing[country]" v-model="address.billing.country" data-vv-as="&quot;{{ __('shop::app.checkout.onepage.country') }}&quot;">
<option value=""></option>
@foreach (core()->countries() as $country)
<option value="{{ $country->code }}">{{ $country->name }}</option>
@endforeach
</select>
<span class="control-error" v-if="errors.has('address-form.billing[country]')">
@{{ errors.first('address-form.billing[country]') }}
</span>
</div>
<div class="control-group" :class="[errors.has('address-form.billing[state]') ? 'has-error' : '']">
<label for="billing[state]" class="required">
{{ __('shop::app.checkout.onepage.state') }}
@ -195,26 +215,6 @@
</span>
</div>
<div class="control-group" :class="[errors.has('address-form.billing[country]') ? 'has-error' : '']">
<label for="billing[country]" class="required">
{{ __('shop::app.checkout.onepage.country') }}
</label>
<select type="text" v-validate="'required'" class="control" id="billing[country]" name="billing[country]" v-model="address.billing.country" data-vv-as="&quot;{{ __('shop::app.checkout.onepage.country') }}&quot;">
<option value=""></option>
@foreach (core()->countries() as $country)
<option value="{{ $country->code }}">{{ $country->name }}</option>
@endforeach
</select>
<span class="control-error" v-if="errors.has('address-form.billing[country]')">
@{{ errors.first('address-form.billing[country]') }}
</span>
</div>
<div class="control-group" :class="[errors.has('address-form.billing[phone]') ? 'has-error' : '']">
<label for="billing[phone]" class="required">
{{ __('shop::app.checkout.onepage.phone') }}
@ -386,6 +386,24 @@
</span>
</div>
<div class="control-group" :class="[errors.has('address-form.shipping[country]') ? 'has-error' : '']">
<label for="shipping[country]" class="required">
{{ __('shop::app.checkout.onepage.country') }}
</label>
<select type="text" v-validate="'required'" class="control" id="shipping[country]" name="shipping[country]" v-model="address.shipping.country" data-vv-as="&quot;{{ __('shop::app.checkout.onepage.country') }}&quot;">
<option value=""></option>
@foreach (core()->countries() as $country)
<option value="{{ $country->code }}">{{ $country->name }}</option>
@endforeach
</select>
<span class="control-error" v-if="errors.has('address-form.shipping[country]')">
@{{ errors.first('address-form.shipping[country]') }}
</span>
</div>
<div class="control-group" :class="[errors.has('address-form.shipping[state]') ? 'has-error' : '']">
<label for="shipping[state]" class="required">
{{ __('shop::app.checkout.onepage.state') }}
@ -421,24 +439,6 @@
</span>
</div>
<div class="control-group" :class="[errors.has('address-form.shipping[country]') ? 'has-error' : '']">
<label for="shipping[country]" class="required">
{{ __('shop::app.checkout.onepage.country') }}
</label>
<select type="text" v-validate="'required'" class="control" id="shipping[country]" name="shipping[country]" v-model="address.shipping.country" data-vv-as="&quot;{{ __('shop::app.checkout.onepage.country') }}&quot;">
<option value=""></option>
@foreach (core()->countries() as $country)
<option value="{{ $country->code }}">{{ $country->name }}</option>
@endforeach
</select>
<span class="control-error" v-if="errors.has('address-form.shipping[country]')">
@{{ errors.first('address-form.shipping[country]') }}
</span>
</div>
<div class="control-group" :class="[errors.has('address-form.shipping[phone]') ? 'has-error' : '']">
<label for="shipping[phone]" class="required">
{{ __('shop::app.checkout.onepage.phone') }}