wishlist icon is active when item is already in wishlist
This commit is contained in:
parent
599bffdce7
commit
403a9dda4c
|
|
@ -32,11 +32,15 @@ class Wishlist
|
|||
*/
|
||||
public function getWishlistProduct($product)
|
||||
{
|
||||
$wishlist = $this->wishlistRepository->findOneWhere([
|
||||
'channel_id' => core()->getCurrentChannel()->id,
|
||||
'product_id' => $product->product_id,
|
||||
'customer_id' => auth()->guard('customer')->user()->id
|
||||
]);
|
||||
$wishlist = false;
|
||||
|
||||
if (auth()->guard('customer')->user()) {
|
||||
$wishlist = $this->wishlistRepository->findOneWhere([
|
||||
'channel_id' => core()->getCurrentChannel()->id,
|
||||
'product_id' => $product->product_id,
|
||||
'customer_id' => auth()->guard('customer')->user()->id
|
||||
]);
|
||||
}
|
||||
|
||||
if ($wishlist)
|
||||
return true;
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -1,4 +1,4 @@
|
|||
{
|
||||
"/js/shop.js": "/js/shop.js?id=71f03d05d9690fe24784",
|
||||
"/css/shop.css": "/css/shop.css?id=b8a2b5dacaa25c0b0c7d"
|
||||
"/css/shop.css": "/css/shop.css?id=426d876808f107691dc6"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1725,6 +1725,9 @@ section.product-detail {
|
|||
}
|
||||
}
|
||||
|
||||
.add-to-wishlist.already {
|
||||
background-image: url('../images/wishlist-added.svg') !important;
|
||||
}
|
||||
|
||||
.share {
|
||||
position: absolute;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,6 @@
|
|||
@inject ('productImageHelper', 'Webkul\Product\Helpers\ProductImage')
|
||||
@inject ('wishListHelper', 'Webkul\Customer\Helpers\Wishlist')
|
||||
|
||||
<?php $images = $productImageHelper->getGalleryImages($product); ?>
|
||||
|
||||
{!! view_render_event('bagisto.shop.products.view.gallery.before', ['product' => $product]) !!}
|
||||
|
|
@ -41,7 +43,7 @@
|
|||
<img :src="currentLargeImageUrl" id="pro-img" :data-image="currentOriginalImageUrl"/>
|
||||
|
||||
@auth('customer')
|
||||
<a class="add-to-wishlist" href="{{ route('customer.wishlist.add', $product->product_id) }}">
|
||||
<a @if ($wishListHelper->getWishlistProduct($product)) class="add-to-wishlist already" @else class="add-to-wishlist" @endif href="{{ route('customer.wishlist.add', $product->product_id) }}">
|
||||
</a>
|
||||
@endauth
|
||||
</div>
|
||||
|
|
@ -158,8 +160,10 @@
|
|||
$('img#pro-img').data('zoom-image', $('img#pro-img').data('image')).ezPlus();
|
||||
}
|
||||
|
||||
var wishlist = " <?php echo $wishListHelper->getWishlistProduct($product); ?> ";
|
||||
|
||||
$(document).mousemove(function(event) {
|
||||
if ($('.add-to-wishlist').length) {
|
||||
if ($('.add-to-wishlist').length && wishlist != 1) {
|
||||
if (event.pageX > $('.add-to-wishlist').offset().left && event.pageX < $('.add-to-wishlist').offset().left+32 && event.pageY > $('.add-to-wishlist').offset().top && event.pageY < $('.add-to-wishlist').offset().top+32) {
|
||||
|
||||
$(".zoomContainer").addClass("show-wishlist");
|
||||
|
|
|
|||
Loading…
Reference in New Issue