Display None Added To Form
This commit is contained in:
parent
647086ae6a
commit
28af2908cd
|
|
@ -141,7 +141,7 @@ class CartController extends Controller
|
|||
* Function to move a already added product to wishlist will run only on customer authentication.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return mixed
|
||||
*/
|
||||
public function moveToWishlist($id)
|
||||
{
|
||||
|
|
@ -153,7 +153,9 @@ class CartController extends Controller
|
|||
session()->flash('warning', trans('shop::app.checkout.cart.move-to-wishlist-error'));
|
||||
}
|
||||
|
||||
return redirect()->back();
|
||||
return request()->get('redirect') !== false
|
||||
? redirect()->back()
|
||||
: response()->json([]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ Route::group(['middleware' => ['web', 'locale', 'theme', 'currency']], function
|
|||
])->name('shop.checkout.success');
|
||||
|
||||
//Shop buynow button action
|
||||
Route::get('move/wishlist/{id}', 'Webkul\Shop\Http\Controllers\CartController@moveToWishlist')->name('shop.movetowishlist');
|
||||
Route::post('move/wishlist/{id}', 'Webkul\Shop\Http\Controllers\CartController@moveToWishlist')->name('shop.movetowishlist');
|
||||
|
||||
Route::get('/downloadable/download-sample/{type}/{id}', 'Webkul\Shop\Http\Controllers\ProductController@downloadSample')->name('shop.downloadable.download_sample');
|
||||
|
||||
|
|
|
|||
|
|
@ -93,9 +93,17 @@
|
|||
@if ($showWishlist)
|
||||
<span class="towishlist">
|
||||
@if ($item->parent_id != 'null' ||$item->parent_id != null)
|
||||
<a href="{{ route('shop.movetowishlist', $item->id) }}" onclick="removeLink('{{ __('shop::app.checkout.cart.cart-remove-action') }}')">{{ __('shop::app.checkout.cart.move-to-wishlist') }}</a>
|
||||
<a
|
||||
href="javascript:void(0);"
|
||||
onclick="moveToWishlist('{{ __('shop::app.checkout.cart.cart-remove-action') }}', '{{ route('shop.movetowishlist', $item->id) }}')">
|
||||
{{ __('shop::app.checkout.cart.move-to-wishlist') }}
|
||||
</a>
|
||||
@else
|
||||
<a href="{{ route('shop.movetowishlist', $item->child->id) }}" onclick="removeLink('{{ __('shop::app.checkout.cart.cart-remove-action') }}')">{{ __('shop::app.checkout.cart.move-to-wishlist') }}</a>
|
||||
<a
|
||||
href="javascript:void(0);"
|
||||
onclick="moveToWishlist('{{ __('shop::app.checkout.cart.cart-remove-action') }}', '{{ route('shop.movetowishlist', $item->child->id) }}')">
|
||||
{{ __('shop::app.checkout.cart.move-to-wishlist') }}
|
||||
</a>
|
||||
@endif
|
||||
</span>
|
||||
@endif
|
||||
|
|
@ -249,8 +257,22 @@
|
|||
});
|
||||
|
||||
function removeLink(message) {
|
||||
if (!confirm(message))
|
||||
event.preventDefault();
|
||||
if (! confirm(message)) {
|
||||
event.preventDefault();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
function moveToWishlist(message, route) {
|
||||
if (! confirm(message)) {
|
||||
event.preventDefault();
|
||||
return;
|
||||
}
|
||||
|
||||
axios.post(route, {'redirect': false})
|
||||
.then((response) => {
|
||||
location.reload();
|
||||
});
|
||||
}
|
||||
|
||||
function updateCartQunatity(operation, index) {
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
@if (count($items))
|
||||
<div class="account-action float-right">
|
||||
<form id="remove-all-wishlist" action="{{ route('customer.wishlist.removeall') }}" method="POST">
|
||||
<form id="remove-all-wishlist" class="d-none" action="{{ route('customer.wishlist.removeall') }}" method="POST">
|
||||
@method('DELETE')
|
||||
|
||||
@csrf
|
||||
|
|
|
|||
|
|
@ -15,13 +15,21 @@
|
|||
@endphp
|
||||
|
||||
@if($wishlist)
|
||||
<form id="wishlist-{{ $wishlist->id }}" action="{{ $href }}" method="POST">
|
||||
<form
|
||||
class="d-none"
|
||||
id="wishlist-{{ $wishlist->id }}"
|
||||
action="{{ $href }}"
|
||||
method="POST">
|
||||
@method('DELETE')
|
||||
|
||||
@csrf
|
||||
</form>
|
||||
@else
|
||||
<form id="wishlist-{{ $product->product_id }}" action="{{ $href }}" method="POST">
|
||||
<form
|
||||
class="d-none"
|
||||
id="wishlist-{{ $product->product_id }}"
|
||||
action="{{ $href }}"
|
||||
method="POST">
|
||||
@csrf
|
||||
</form>
|
||||
@endif
|
||||
|
|
@ -41,7 +49,11 @@
|
|||
@endauth
|
||||
|
||||
@guest('customer')
|
||||
<form id="wishlist-{{ $product->product_id }}" action="{{ route('customer.wishlist.add', $product->product_id) }}" method="POST">
|
||||
<form
|
||||
class="d-none"
|
||||
id="wishlist-{{ $product->product_id }}"
|
||||
action="{{ route('customer.wishlist.add', $product->product_id) }}"
|
||||
method="POST">
|
||||
@csrf
|
||||
</form>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue