10.April 2026
This commit is contained in:
parent
a00c42e770
commit
f58c709945
208 changed files with 19280 additions and 2914 deletions
|
|
@ -8,9 +8,11 @@ use App\Models\ShoppingOrder;
|
|||
use App\Models\ShoppingPayment;
|
||||
use App\Models\ShoppingUser;
|
||||
use App\Services\Payment;
|
||||
use App\Services\ProductOrderContext;
|
||||
use App\Services\Shop;
|
||||
use App\Services\Util;
|
||||
use Auth;
|
||||
use Illuminate\Support\Facades\Session;
|
||||
use Yard;
|
||||
|
||||
class OrderController extends Controller
|
||||
|
|
@ -192,7 +194,7 @@ class OrderController extends Controller
|
|||
public function myOrderCreate(int $id)
|
||||
{
|
||||
$user = Auth::guard('customers')->user();
|
||||
$shopping_order = ShoppingOrder::findOrFail($id);
|
||||
$shopping_order = ShoppingOrder::with('member.shop')->findOrFail($id);
|
||||
|
||||
if ($shopping_order->shopping_user_id != $user->shopping_user_id) {
|
||||
$shopping_user = ShoppingUser::findOrFail($user->shopping_user_id);
|
||||
|
|
@ -202,6 +204,13 @@ class OrderController extends Controller
|
|||
}
|
||||
|
||||
$shopping_user = ShoppingUser::findOrFail($user->shopping_user_id);
|
||||
|
||||
if ($shopping_order->is_abo) {
|
||||
Session::flash('alert-error', __('order.reorder_abo_not_allowed'));
|
||||
|
||||
return redirect()->route('portal.my_orders.show', $shopping_order->id);
|
||||
}
|
||||
|
||||
$delivery_country = $shopping_user->getDeliveryCountry(true);
|
||||
|
||||
\Session::put('user_init_country', strtolower($delivery_country->code));
|
||||
|
|
@ -211,18 +220,18 @@ class OrderController extends Controller
|
|||
Shop::initUserShopLang($delivery_country, $this->instance);
|
||||
|
||||
foreach ($shopping_order->shopping_order_items as $item) {
|
||||
if ($item->product) {
|
||||
if ($item->product && ProductOrderContext::isProductAllowedInCustomerWebshop($item->product)) {
|
||||
$this->addToCart($item->product_id, $item->qty);
|
||||
}
|
||||
}
|
||||
|
||||
return redirect(Util::getMyMivitaShopUrl('/user/card/show'));
|
||||
return redirect(Util::getCustomerReorderCartUrl($shopping_order));
|
||||
}
|
||||
|
||||
private function addToCart(int $productId, int $quantity = 1): void
|
||||
{
|
||||
$product = Product::find($productId);
|
||||
if (! $product) {
|
||||
if (! $product || ! ProductOrderContext::isProductAllowedInCustomerWebshop($product)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue