This commit is contained in:
jitendra 2019-10-31 13:50:17 +05:30
parent 8b29a7f8e0
commit 163ce17e34
3 changed files with 9 additions and 14 deletions

View File

@ -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);

View File

@ -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,

View File

@ -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');