Merge pull request #2783 from shubhwebkul/patch-1

misc. bug fixes
This commit is contained in:
Jitendra Singh 2020-03-29 15:43:00 +05:30 committed by GitHub
commit 44672cff67
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 148 additions and 46 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 153 B

View File

@ -26,16 +26,21 @@ return [
'name' => 'shop::app.layouts.wishlist',
'route' =>'customer.wishlist.index',
'sort' => 4,
], [
'key' => 'account.compare',
'name' => 'velocity::app.customer.compare.text',
'route' =>'velocity.customer.product.compare',
'sort' => 5,
], [
'key' => 'account.orders',
'name' => 'shop::app.layouts.orders',
'route' =>'customer.orders.index',
'sort' => 5,
'sort' => 6,
], [
'key' => 'account.downloadables',
'name' => 'shop::app.layouts.downloadable-products',
'route' =>'customer.downloadable_products.index',
'sort' => 6,
'sort' => 7,
]
];

View File

@ -8,5 +8,7 @@
@include('shop::products.wishlist')
@include('shop::products.compare')
@include('shop::products.compare', [
'productId' => $product->id
])
</div>

View File

@ -1,11 +1,101 @@
{{-- @inject ('wishListHelper', 'Webkul\Customer\Helpers\Wishlist')
<compare-component product-id="{{ $productId }}"></compare-component>
@auth('customer')
{!! view_render_event('bagisto.shop.products.wishlist.before') !!}
@push('scripts')
<a @if ($wishListHelper->getWishlistProduct($product)) class="add-to-wishlist already" @else class="add-to-wishlist" @endif href="{{ route('customer.wishlist.add', $product->product_id) }}" id="wishlist-changer">
<span class="icon wishlist-icon"></span>
</a>
<script type="text/x-template" id="compare-component-template">
<a class="unset compare-icon text-right" @click="addProductToCompare" style="cursor: pointer">
<img src="{{ asset('themes/default/assets/images/compare_arrows.png') }}" />
</a>
</script>
{!! view_render_event('bagisto.shop.products.wishlist.after') !!}
@endauth --}}
<script>
Vue.component('compare-component', {
props: ['productId'],
template: '#compare-component-template',
data: function () {
return {
'baseUrl': "{{ url()->to('/') }}",
'customer': '{{ auth()->guard('customer')->user() ? "true" : "false" }}' == "true",
}
},
methods: {
'addProductToCompare': function () {
if (this.customer == "true" || this.customer == true) {
this.$http.put(
`${this.baseUrl}/comparison`, {
productId: this.productId,
}
).then(response => {
window.flashMessages = [{
'type': `alert-${response.data.status}`,
'message': response.data.message
}];
this.$root.addFlashMessages()
}).catch(error => {
window.flashMessages = [{
'type': `alert-danger`,
'message': "{{ __('velocity::app.error.something_went_wrong') }}"
}];
this.$root.addFlashMessages()
});
} else {
let updatedItems = [this.productId];
let existingItems = this.getStorageValue('compared_product');
if (existingItems) {
if (existingItems.indexOf(this.productId) == -1) {
updatedItems = existingItems.concat(updatedItems);
this.setStorageValue('compared_product', updatedItems);
window.flashMessages = [{
'type': `alert-success`,
'message': "{{ __('velocity::app.customer.compare.added') }}"
}];
this.$root.addFlashMessages()
} else {
window.flashMessages = [{
'type': `alert-success`,
'message': "{{ __('velocity::app.customer.compare.already_added') }}"
}];
this.$root.addFlashMessages()
}
} else {
this.setStorageValue('compared_product', updatedItems);
window.flashMessages = [{
'type': `alert-success`,
'message': "{{ __('velocity::app.customer.compare.added') }}"
}];
this.$root.addFlashMessages()
}
}
},
'getStorageValue': function (key) {
let value = window.localStorage.getItem(key);
if (value) {
value = JSON.parse(value);
}
return value;
},
'setStorageValue': function (key, value) {
window.localStorage.setItem(key, JSON.stringify(value));
return true;
},
}
});
</script>
@endpush

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,5 +1,5 @@
{
"/js/velocity.js": "/js/velocity.js?id=b795a54f5795ed77fa28",
"/js/velocity.js": "/js/velocity.js?id=d1e8a6d2c78f6d0657a7",
"/css/velocity-admin.css": "/css/velocity-admin.css?id=612d35e452446366eef7",
"/css/velocity.css": "/css/velocity.css?id=a68c6d04ce36e1455e1e"
"/css/velocity.css": "/css/velocity.css?id=16024aee144fa5e1275e"
}

View File

@ -34,11 +34,13 @@ Route::group(['middleware' => ['web', 'locale', 'theme', 'currency']], function
'view' => 'shop::guest.compare.index'
]);
Route::get('/customer/account/comparison', 'ComparisonController@getComparisonList')
->name('velocity.customer.product.compare')
->defaults('_config', [
'view' => 'shop::customers.account.compare.index'
]);
Route::group(['middleware' => ['customer']], function () {
Route::get('/customer/account/comparison', 'ComparisonController@getComparisonList')
->name('velocity.customer.product.compare')
->defaults('_config', [
'view' => 'shop::customers.account.compare.index'
]);
});
Route::put('/comparison', 'ComparisonController@addCompareProduct')
->name('customer.product.add.compare');

View File

@ -10,7 +10,7 @@
methods: {
addProductToCompare: function () {
if (this.customer == "true") {
if (this.customer == "true" || this.customer == true) {
this.$http.put(
`${this.$root.baseUrl}/comparison`, {
productId: this.productId,

View File

@ -491,9 +491,8 @@
.customer-options{
top: 40px;
float: right;
height: 100%;
padding: 20px;
height: 150px;
overflow-y: scroll;
width: 200px !important;
@ -2311,6 +2310,10 @@
margin-left: 0 !important;
margin-right: 10px !important;
tr {
width: 100%;
}
td {
padding: 15px;
min-width: 250px;

View File

@ -309,19 +309,15 @@
},
loginCustomer: function() {
var this_this = this;
this_this.$http.post("{{ route('customer.checkout.login') }}", {
email: this_this.address.billing.email,
password: this_this.address.billing.password
this.$http.post("{{ route('customer.checkout.login') }}", {
email: this.address.billing.email,
password: this.address.billing.password
})
.then(function(response) {
.then(response => {
if (response.data.success) {
window.location.href = "{{ route('shop.checkout.onepage.index') }}";
} else {
window.flashMessages = [{'type': 'alert-error', 'message': response.data.error }];
this_this.$root.addFlashMessages()
window.showAlert(`alert-danger`, this.__('shop.general.alert.danger'), response.data.error);
}
})
.catch(function (error) {})
@ -449,9 +445,7 @@
.catch(error => {
this.disable_button = true;
window.flashMessages = [{'type': 'alert-error', 'message': "{{ __('shop::app.common.error') }}" }];
this.$root.addFlashMessages();
window.showAlert(`alert-danger`, this.__('shop.general.alert.danger'), "{{ __('shop::app.common.error') }}");
})
} else {
this.disable_button = true;

View File

@ -272,11 +272,6 @@
</span>
</div>
{{-- for customer login checkout --}}
@if (! $isCustomer)
@include('shop::checkout.onepage.customer-checkout')
@endif
<div :class="`col-12 form-field ${errors.has('address-form.billing[first_name]') ? 'has-error' : ''}`">
<label for="billing[first_name]" class="mandatory">
{{ __('shop::app.checkout.onepage.first-name') }}
@ -338,6 +333,11 @@
</span>
</div>
{{-- for customer login checkout --}}
@if (! $isCustomer)
@include('shop::checkout.onepage.customer-checkout')
@endif
<div :class="`col-12 form-field ${errors.has('address-form.billing[address1][]') ? 'has-error' : ''}`" style="margin-bottom: 0;">
<label for="billing_address_0" class="mandatory">
{{ __('shop::app.checkout.onepage.address1') }}

View File

@ -10,4 +10,14 @@
@yield('page-detail-wrapper')
</div>
</div>
@endsection
@endsection
@push('scripts')
<script>
$(document).ready(function() {
let height = $('.customer-sidebar').css('height');
$('.account-content').css('height', height);
});
</script>
@endpush

View File

@ -18,11 +18,7 @@
$subMenuCollection['orders'] = $menuItem['children']['orders'];
$subMenuCollection['downloadables'] = $menuItem['children']['downloadables'];
$subMenuCollection['wishlist'] = $menuItem['children']['wishlist'];
$subMenuCollection['compare'] = [
'key' => 'account.compare',
'name' => 'velocity::app.customer.compare.text',
'url' => route('velocity.customer.product.compare'),
];
$subMenuCollection['compare'] = $menuItem['children']['compare'];
$subMenuCollection['reviews'] = $menuItem['children']['reviews'];
$subMenuCollection['address'] = $menuItem['children']['address'];
} catch (\Exception $exception) {