Default Functionality Removed
This commit is contained in:
parent
3d060d63d5
commit
be56b09b2f
File diff suppressed because one or more lines are too long
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"/js/velocity.js": "/js/velocity.js?id=c4d3d75a0e1999b9baad",
|
||||
"/js/velocity.js": "/js/velocity.js?id=659f8a379a7006410182",
|
||||
"/css/velocity-admin.css": "/css/velocity-admin.css?id=4322502d80a0e4a0affd",
|
||||
"/css/velocity.css": "/css/velocity.css?id=a37ae1fb6f34223126b8"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
<template>
|
||||
<form method="POST" @submit.prevent="addToCart">
|
||||
|
||||
<!-- for move to cart from wishlist -->
|
||||
<a
|
||||
:href="wishlistMoveRoute"
|
||||
|
|
@ -25,6 +26,7 @@
|
|||
|
||||
<span class="fs14 fw6 text-uppercase text-up-4" v-text="btnText"></span>
|
||||
</button>
|
||||
|
||||
</form>
|
||||
</template>
|
||||
|
||||
|
|
@ -67,15 +69,6 @@
|
|||
if (response.data.status == 'success') {
|
||||
this.$root.miniCartKey++;
|
||||
|
||||
if (this.moveToCart == "true") {
|
||||
let existingItems = this.getStorageValue('wishlist_product');
|
||||
|
||||
let updatedItems = existingItems.filter(item => item != this.productFlatId);
|
||||
|
||||
this.$root.headerItemsCount++;
|
||||
this.setStorageValue('wishlist_product', updatedItems);
|
||||
}
|
||||
|
||||
window.showAlert(`alert-success`, this.__('shop.general.alert.success'), response.data.message);
|
||||
|
||||
if (this.reloadPage == "1") {
|
||||
|
|
|
|||
|
|
@ -7,39 +7,13 @@
|
|||
|
||||
{{ isActive ? 'favorite_border' : 'favorite' }}
|
||||
</i>
|
||||
|
||||
<a
|
||||
v-else
|
||||
:title="`${isActive ? addTooltip : removeTooltip}`"
|
||||
@click="toggleProductWishlist(productId)"
|
||||
:class="`unset wishlist-icon ${addClass ? addClass : ''} text-right`">
|
||||
|
||||
<i
|
||||
@mouseout="! isStateChanged ? isActive = !isActive : isStateChanged = false"
|
||||
@mouseover="! isStateChanged ? isActive = !isActive : isStateChanged = false"
|
||||
:class="`material-icons ${addClass ? addClass : ''}`">
|
||||
|
||||
{{ isActive ? 'favorite' : 'favorite_border' }}
|
||||
</i>
|
||||
|
||||
<span style="vertical-align: super;" v-html="text"></span>
|
||||
</a>
|
||||
</template>
|
||||
|
||||
<script type="text/javascript">
|
||||
export default {
|
||||
props: [
|
||||
'text',
|
||||
'active',
|
||||
'addClass',
|
||||
'addedText',
|
||||
'productId',
|
||||
'removeText',
|
||||
'isCustomer',
|
||||
'productSlug',
|
||||
'moveToWishlist',
|
||||
'addTooltip',
|
||||
'removeTooltip'
|
||||
],
|
||||
|
||||
data: function () {
|
||||
|
|
@ -47,60 +21,6 @@
|
|||
isStateChanged: false,
|
||||
isActive: this.active,
|
||||
}
|
||||
},
|
||||
|
||||
created: function () {
|
||||
if (this.isCustomer == 'false') {
|
||||
this.isActive = this.isWishlisted(this.productId);
|
||||
}
|
||||
},
|
||||
|
||||
methods: {
|
||||
toggleProductWishlist: function (productId) {
|
||||
var updatedValue = [productId];
|
||||
let existingValue = this.getStorageValue('wishlist_product');
|
||||
|
||||
if (existingValue) {
|
||||
var valueIndex = existingValue.indexOf(productId);
|
||||
|
||||
if (valueIndex == -1) {
|
||||
this.isActive = true;
|
||||
existingValue.push(productId);
|
||||
} else {
|
||||
this.isActive = false;
|
||||
existingValue.splice(valueIndex, 1);
|
||||
}
|
||||
|
||||
updatedValue = existingValue;
|
||||
}
|
||||
|
||||
this.$root.headerItemsCount++;
|
||||
this.isStateChanged = true;
|
||||
|
||||
this.setStorageValue('wishlist_product', updatedValue);
|
||||
|
||||
window.showAlert(
|
||||
'alert-success',
|
||||
this.__('shop.general.alert.success'),
|
||||
this.isActive ? this.addedText : this.removeText
|
||||
);
|
||||
|
||||
if (this.moveToWishlist && valueIndex == -1) {
|
||||
window.location.href = this.moveToWishlist;
|
||||
}
|
||||
|
||||
return true;
|
||||
},
|
||||
|
||||
isWishlisted: function (productId) {
|
||||
let existingValue = this.getStorageValue('wishlist_product');
|
||||
|
||||
if (existingValue) {
|
||||
return ! (existingValue.indexOf(productId) == -1);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
@ -513,11 +513,6 @@
|
|||
updateHeaderItemsCount: function () {
|
||||
if (! this.isCustomer) {
|
||||
let comparedItems = this.getStorageValue('compared_product');
|
||||
let wishlistedItems = this.getStorageValue('wishlist_product');
|
||||
|
||||
if (wishlistedItems) {
|
||||
this.wishlistCount = wishlistedItems.length;
|
||||
}
|
||||
|
||||
if (comparedItems) {
|
||||
this.compareCount = comparedItems.length;
|
||||
|
|
|
|||
|
|
@ -325,11 +325,6 @@
|
|||
'updateHeaderItemsCount': function () {
|
||||
if (! this.isCustomer) {
|
||||
let comparedItems = this.getStorageValue('compared_product');
|
||||
let wishlistedItems = this.getStorageValue('wishlist_product');
|
||||
|
||||
if (wishlistedItems) {
|
||||
this.wishlistCount = wishlistedItems.length;
|
||||
}
|
||||
|
||||
if (comparedItems) {
|
||||
this.compareCount = comparedItems.length;
|
||||
|
|
|
|||
|
|
@ -5,126 +5,9 @@
|
|||
@endsection
|
||||
|
||||
@section('content-wrapper')
|
||||
@guest('customer')
|
||||
<wishlist-product></wishlist-product>
|
||||
@endguest
|
||||
|
||||
@auth('customer')
|
||||
@push('scripts')
|
||||
<script>
|
||||
window.location = '{{ route('customer.wishlist.index') }}';
|
||||
</script>
|
||||
@endpush
|
||||
@endauth
|
||||
@endsection
|
||||
|
||||
@push('scripts')
|
||||
<script type="text/x-template" id="wishlist-product-template">
|
||||
<section class="cart-details row no-margin col-12">
|
||||
<h1 class="fw6 col-6">
|
||||
{{ __('shop::app.customer.account.wishlist.title') }}
|
||||
</h1>
|
||||
|
||||
<div class="col-6" v-if="products.length > 0">
|
||||
<button
|
||||
class="theme-btn light pull-right"
|
||||
@click="removeProduct('all')">
|
||||
{{ __('shop::app.customer.account.wishlist.deleteall') }}
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{!! view_render_event('bagisto.shop.customers.account.guest-customer.view.before') !!}
|
||||
|
||||
<div class="row products-collection col-12 ml0">
|
||||
<shimmer-component v-if="!isProductListLoaded && !isMobile()"></shimmer-component>
|
||||
|
||||
<template v-else-if="isProductListLoaded && products.length > 0">
|
||||
<carousel-component
|
||||
slides-per-page="6"
|
||||
navigation-enabled="hide"
|
||||
pagination-enabled="hide"
|
||||
id="wishlist-products-carousel"
|
||||
locale-direction="{{ core()->getCurrentLocale()->direction == 'rtl' ? 'rtl' : 'ltr' }}"
|
||||
:slides-count="products.length">
|
||||
|
||||
<slide
|
||||
:key="index"
|
||||
:slot="`slide-${index}`"
|
||||
v-for="(product, index) in products">
|
||||
<product-card :product="product"></product-card>
|
||||
</slide>
|
||||
</carousel-component>
|
||||
</template>
|
||||
|
||||
<span v-else-if="isProductListLoaded">{{ __('customer::app.wishlist.empty') }}</span>
|
||||
</div>
|
||||
|
||||
{!! view_render_event('bagisto.shop.customers.account.guest-customer.view.after') !!}
|
||||
</section>
|
||||
</script>
|
||||
|
||||
<script>
|
||||
Vue.component('wishlist-product', {
|
||||
template: '#wishlist-product-template',
|
||||
|
||||
data: function () {
|
||||
return {
|
||||
'products': [],
|
||||
'isProductListLoaded': false,
|
||||
}
|
||||
},
|
||||
|
||||
watch: {
|
||||
'$root.headerItemsCount': function () {
|
||||
this.getProducts();
|
||||
}
|
||||
},
|
||||
|
||||
mounted: function () {
|
||||
this.getProducts();
|
||||
},
|
||||
|
||||
methods: {
|
||||
'getProducts': function () {
|
||||
let items = this.getStorageValue('wishlist_product');
|
||||
items = items ? items.join('&') : '';
|
||||
|
||||
if (items != "") {
|
||||
this.$http
|
||||
.get(`${this.$root.baseUrl}/detailed-products`, {
|
||||
params: { moveToCart: true, items }
|
||||
})
|
||||
.then(response => {
|
||||
this.isProductListLoaded = true;
|
||||
this.products = response.data.products;
|
||||
})
|
||||
.catch(error => {
|
||||
this.isProductListLoaded = true;
|
||||
console.log(this.__('error.something_went_wrong'));
|
||||
});
|
||||
} else {
|
||||
this.products = [];
|
||||
this.isProductListLoaded = true;
|
||||
}
|
||||
},
|
||||
|
||||
'removeProduct': function (productId) {
|
||||
let existingItems = this.getStorageValue('wishlist_product');
|
||||
|
||||
if (productId == "all") {
|
||||
updatedItems = [];
|
||||
this.$set(this, 'products', []);
|
||||
} else {
|
||||
updatedItems = existingItems.filter(item => item != productId);
|
||||
this.$set(this, 'products', this.products.filter(product => product.slug != productId));
|
||||
}
|
||||
|
||||
this.$root.headerItemsCount++;
|
||||
this.setStorageValue('wishlist_product', updatedItems);
|
||||
|
||||
window.showAlert(`alert-success`, this.__('shop.general.alert.success'), `${this.__('customer.wishlist.remove-all-success')}`);
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
@push('scripts')
|
||||
<script>
|
||||
window.location = '{{ route('customer.wishlist.index') }}';
|
||||
</script>
|
||||
@endpush
|
||||
@endsection
|
||||
|
|
@ -1,6 +1,7 @@
|
|||
@inject ('wishListHelper', 'Webkul\Customer\Helpers\Wishlist')
|
||||
|
||||
{!! view_render_event('bagisto.shop.products.wishlist.before') !!}
|
||||
|
||||
@auth('customer')
|
||||
@php
|
||||
$isWished = $wishListHelper->getWishlistProduct($product);
|
||||
|
|
@ -18,7 +19,7 @@
|
|||
title="{{ __('velocity::app.shop.wishlist.remove-wishlist-text') }}"
|
||||
@endif>
|
||||
|
||||
<wishlist-component active="{{ !$isWished }}" is-customer="true"></wishlist-component>
|
||||
<wishlist-component active="{{ !$isWished }}"></wishlist-component>
|
||||
|
||||
@if (isset($text))
|
||||
{!! $text !!}
|
||||
|
|
@ -26,20 +27,4 @@
|
|||
</a>
|
||||
@endauth
|
||||
|
||||
@guest('customer')
|
||||
<wishlist-component
|
||||
active="false"
|
||||
is-customer="false"
|
||||
text="{{ $text ?? null }}"
|
||||
product-id="{{ $product->id }}"
|
||||
item-id="{{ $item->id ?? null}}"
|
||||
product-slug="{{ $product->url_key }}"
|
||||
add-class="{{ $addWishlistClass ?? '' }}"
|
||||
move-to-wishlist="{{ $isMoveToWishlist ?? null}}"
|
||||
added-text="{{ __('shop::app.customer.account.wishlist.add') }}"
|
||||
remove-text="{{ __('shop::app.customer.account.wishlist.remove') }}"
|
||||
add-tooltip="{{ __('velocity::app.shop.wishlist.add-wishlist-text') }}"
|
||||
remove-tooltip="{{ __('velocity::app.shop.wishlist.remove-wishlist-text') }}">
|
||||
</wishlist-component>
|
||||
@endauth
|
||||
{!! view_render_event('bagisto.shop.products.wishlist.after') !!}
|
||||
Loading…
Reference in New Issue