Issue #1662 fixed
This commit is contained in:
parent
8b29a7f8e0
commit
163ce17e34
|
|
@ -104,12 +104,14 @@ class CartController extends Controller
|
|||
|
||||
if (! $result) {
|
||||
$message = session()->get('warning') ?? session()->get('error');
|
||||
|
||||
return response()->json([
|
||||
'error' => session()->get('warning')
|
||||
], 400);
|
||||
}
|
||||
|
||||
$this->wishlistRepository->deleteWhere(['product_id' => $id]);
|
||||
if ($customer = auth($this->guard)->user())
|
||||
$this->wishlistRepository->deleteWhere(['product_id' => $id, 'customer_id' => $customer->id]);
|
||||
|
||||
Event::fire('checkout.cart.item.add.after', $result);
|
||||
|
||||
|
|
|
|||
|
|
@ -107,19 +107,12 @@ class WishlistController extends Controller
|
|||
$result = Cart::moveToCart($wishlistItem);
|
||||
|
||||
if ($result) {
|
||||
if ($wishlistItem->delete()) {
|
||||
Cart::collectTotals();
|
||||
Cart::collectTotals();
|
||||
|
||||
return response()->json([
|
||||
'data' => 1,
|
||||
'message' => trans('shop::app.wishlist.moved')
|
||||
]);
|
||||
} else {
|
||||
return response()->json([
|
||||
'data' => 1,
|
||||
'error' => trans('shop::app.wishlist.move-error')
|
||||
], 400);
|
||||
}
|
||||
return response()->json([
|
||||
'data' => 1,
|
||||
'message' => trans('shop::app.wishlist.moved')
|
||||
]);
|
||||
} else {
|
||||
return response()->json([
|
||||
'data' => -1,
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ class CartController extends Controller
|
|||
session()->flash('success', trans('shop::app.checkout.cart.item.success'));
|
||||
|
||||
if ($customer = auth()->guard('customer')->user())
|
||||
$this->wishlistRepository->deleteWhere(['product_id' => $id]);
|
||||
$this->wishlistRepository->deleteWhere(['product_id' => $id, 'customer_id' => $customer->id]);
|
||||
|
||||
if (request()->get('is_buy_now'))
|
||||
return redirect()->route('shop.checkout.onepage.index');
|
||||
|
|
|
|||
Loading…
Reference in New Issue