enhance add to basket

This commit is contained in:
Ludovic CANDELLIER
2022-04-01 00:11:15 +02:00
parent e3c60e7cde
commit 8afb3467f8
17 changed files with 359 additions and 53 deletions

View File

@@ -23,21 +23,21 @@ class BasketController extends Controller
{
$offer_id = $request->input('offer_id');
$quantity = $request->input('quantity');
if (ShopCart::has($offer_id)) {
$ret = ShopCart::remove($offer_id);
}
$data = $quantity ? Offers::getBasketData($offer_id, $quantity) : false;
$ret = $data ? ShopCart::add($data) : false;
return true;
return Offers::addBasket($offer_id, $quantity);
}
public function modalBasket($offer_id, $quantity)
{
$data['offer'] = Offers::getFull($offer_id)->toArray();
$data['basket'] = Offers::addBasket($offer_id, $quantity);
return view('Shop.Baskets.partials.modalBasket', $data);
}
public function basket()
{
$data = self::init();
$data['basket'] = Offers::getBasket();
//dump($data['basket']);
// exit;
return view('Shop.Baskets.basket', $data);
}