add shipping to order, methods to calculate, little refactoring

This commit is contained in:
ludo
2023-11-15 23:20:42 +01:00
parent 04df068931
commit 2ebdc5f16b
10 changed files with 117 additions and 45 deletions

View File

@@ -5,6 +5,7 @@ namespace App\Http\Controllers\Shop;
use App\Http\Controllers\Controller;
use App\Repositories\Core\User\ShopCart;
use App\Repositories\Shop\Baskets;
use App\Repositories\Shop\Deliveries;
use App\Repositories\Shop\DeliveryTypes;
use App\Repositories\Shop\Offers;
use App\Repositories\Shop\Orders;
@@ -63,15 +64,9 @@ class BasketController extends Controller
return ShopCart::count();
}
public function getBasketTotal($deliveryTypeId = false)
public function getBasketTotal($deliveryId = false, $deliveryTypeId = false)
{
$data = [
'basket' => ShopCart::getSummary(),
];
$weight = Baskets::getWeight();
$data['basket']['shipping'] = DeliveryTypes::getPrice($deliveryTypeId, $weight);
$data['basket'] = Baskets::getBasketTotal($deliveryId, $deliveryTypeId);
return view('Shop.Baskets.partials.basketTotal', $data);
}