Merge pull request #5314 from devansh-webkul/wishlist-issue-fixed
Wishlist Issue Fixed #5226
This commit is contained in:
commit
cda58a576f
|
|
@ -22,6 +22,34 @@
|
||||||
/* add translations */
|
/* add translations */
|
||||||
window._translations = @json($velocityHelper->jsonTranslations());
|
window._translations = @json($velocityHelper->jsonTranslations());
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wishist form will dynamically create and execute.
|
||||||
|
*
|
||||||
|
* @param {!string} action
|
||||||
|
* @param {!string} method
|
||||||
|
* @param {!string} csrfToken
|
||||||
|
*/
|
||||||
|
function submitWishlistForm(action, method, csrfToken) {
|
||||||
|
let form = document.createElement('form');
|
||||||
|
form.method = 'POST';
|
||||||
|
form.action = action;
|
||||||
|
|
||||||
|
let _methodElement = document.createElement('input');
|
||||||
|
_methodElement.type = 'hidden';
|
||||||
|
_methodElement.name = '_method';
|
||||||
|
_methodElement.value = method;
|
||||||
|
form.appendChild(_methodElement);
|
||||||
|
|
||||||
|
let _tokenElement = document.createElement('input');
|
||||||
|
_tokenElement.type = 'hidden';
|
||||||
|
_tokenElement.name ='_token';
|
||||||
|
_tokenElement.value = csrfToken;
|
||||||
|
form.appendChild(_tokenElement);
|
||||||
|
|
||||||
|
document.body.appendChild(form);
|
||||||
|
form.submit();
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@stack('scripts')
|
@stack('scripts')
|
||||||
|
|
|
||||||
|
|
@ -14,37 +14,23 @@
|
||||||
$title = $wishlist ? __('velocity::app.shop.wishlist.remove-wishlist-text') : __('velocity::app.shop.wishlist.add-wishlist-text');
|
$title = $wishlist ? __('velocity::app.shop.wishlist.remove-wishlist-text') : __('velocity::app.shop.wishlist.add-wishlist-text');
|
||||||
@endphp
|
@endphp
|
||||||
|
|
||||||
@if($wishlist)
|
|
||||||
<form
|
|
||||||
class="d-none"
|
|
||||||
id="wishlist-{{ $wishlist->id }}"
|
|
||||||
action="{{ $href }}"
|
|
||||||
method="POST">
|
|
||||||
@method('DELETE')
|
|
||||||
|
|
||||||
@csrf
|
|
||||||
</form>
|
|
||||||
@else
|
|
||||||
<form
|
|
||||||
class="d-none"
|
|
||||||
id="wishlist-{{ $product->product_id }}"
|
|
||||||
action="{{ $href }}"
|
|
||||||
method="POST">
|
|
||||||
@csrf
|
|
||||||
</form>
|
|
||||||
@endif
|
|
||||||
|
|
||||||
<a
|
<a
|
||||||
class="unset wishlist-icon {{ $addWishlistClass ?? '' }} text-right"
|
class="unset wishlist-icon {{ $addWishlistClass ?? '' }} text-right"
|
||||||
href="javascript:void(0);"
|
href="javascript:void(0);"
|
||||||
title="{{ $title }}"
|
title="{{ $title }}"
|
||||||
onclick="document.getElementById('wishlist-{{ $wishlist ? $wishlist->id : $product->product_id }}').submit();">
|
onclick="submitWishlistForm(
|
||||||
|
'{{ $href }}',
|
||||||
|
'{{ $wishlist ? 'DELETE' : 'POST' }}',
|
||||||
|
'{{ csrf_token() }}'
|
||||||
|
)"
|
||||||
|
>
|
||||||
|
|
||||||
<wishlist-component active="{{ $wishlist ? false : true }}"></wishlist-component>
|
<wishlist-component active="{{ $wishlist ? false : true }}"></wishlist-component>
|
||||||
|
|
||||||
@if (isset($text))
|
@if (isset($text))
|
||||||
{!! $text !!}
|
{!! $text !!}
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
</a>
|
</a>
|
||||||
@endauth
|
@endauth
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue