Updates to 03-2025

This commit is contained in:
Kevin Adametz 2025-04-01 10:39:21 +02:00
parent 6167273a48
commit 9b54eb0512
348 changed files with 34535 additions and 5774 deletions

View file

@ -15,7 +15,7 @@ use App\Models\PaymentMethod;
use App\Models\PromotionUser;
use App\Models\ShoppingOrder;
use App\Models\ShoppingPayment;
use App\Services\PromotionCart;
use App\Services\UserCart;
use App\Models\PaymentTransaction;
use App\Http\Controllers\Controller;
use App\Repositories\CheckoutRepository;
@ -37,13 +37,16 @@ class PromotionController extends Controller
}
if($path === 'impressum'){
return view('web.promotion.impressum');
return view('web.legal.impressum');
}
if($path === 'datenschutzerklaerung'){
return view('web.promotion.datenschutzerklaerung');
return view('web.legal.datenschutzerklaerung');
}
if($path === 'widerrufsbelehrung'){
return view('web.promotion.widerrufsbelehrung');
return view('web.legal.widerrufsbelehrung');
}
if($path === 'versandarten'){
return view('web.legal.versandarten');
}
//search for promo
$PromotionUser = PromotionUser::where('url', trim($path))->whereNull('user_deleted_at')->first();
@ -56,17 +59,23 @@ class PromotionController extends Controller
];
return view('web.promotion.outofstock', $data);
}
PromotionCart::initYard();
UserCart::initYard('prom', null, $PromotionUser);
$first_category = Category::where('active', true)->whereJsonContains('show_on', ['3'])->orderBy('pos', 'DESC')->first();
$first_category_id = isset($first_category->id) ? $first_category->id : false;
$shop_products = $this->getShowProducts();
$first_category_id = false;
if(Request::get('catid')){
$first_category_id = Request::get('catid');
}
//$first_category = Category::where('active', true)->whereJsonContains('show_on', ['3'])->orderBy('pos', 'DESC')->first();
//$first_category_id = isset($first_category->id) ? $first_category->id : false;
$shop_products = $this->getShowProducts($first_category_id);
$data = [
'promotion_user' => $PromotionUser,
'shop_products' => $shop_products,
'user_payment_methods' => PaymentMethod::getDefaultAsArray()->toArray(),
'first_category_id' => $first_category_id,
'categories_by_show_on' => '3'
];
return view('web.promotion.index', $data);
}
@ -230,38 +239,38 @@ class PromotionController extends Controller
return response()->json(['response' => $data, 'shop_products_view'=>$shop_products_view, 'status'=>$status]);
}
if($data['action'] === 'switch-free-product'){
\App\Services\PromotionCart::updateFeeProduct($data);
\App\Services\UserCart::updateFeeProduct($data);
}
if($data['action'] === 'add-shop-product'){
$data['qty'] = \App\Services\PromotionCart::updateProduct($data, true);
$data['qty'] = \App\Services\UserCart::updateProduct($data, true);
}
if($data['action'] === 'update-shop-product'){
$data['qty'] = \App\Services\PromotionCart::updateProduct($data);
$data['qty'] = \App\Services\UserCart::updateProduct($data);
}
if($data['action'] === 'remove-shop-product'){
\App\Services\PromotionCart::updateProduct($data);
\App\Services\UserCart::updateProduct($data);
$data['qty'] = 0;
}
if($data['action'] === 'clear-cart'){
\App\Services\PromotionCart::clearCart($data);
\App\Services\UserCart::clearCart($data);
}
if($data['action'] === 'switch-shipping'){
\App\Services\PromotionCart::switchShipping($data);
\App\Services\UserCart::switchShipping($data);
}
if($data['action'] === 'change-state-shipping'){
\App\Services\PromotionCart::changeStateShipping($data);
\App\Services\UserCart::changeStateShipping($data, 'prom');
}
$cart = view("web.promotion._promotion_cart", compact('data'))->render();
if(Yard::instance('shopping')->isQuickShipping()){
$invoice = view("web.promotion._invoice_details_quick")->render();
$invoice = view("web.components._invoice_details_quick")->render();
}else{
$invoice = view("web.promotion._invoice_details")->render();
$invoice = view("web.components._invoice_details")->render();
}
$checkout = view("web.promotion._checkout")->render();
$data['shipping_price_formated'] = PromotionCart::getCurrentShippingPrice();
$checkout = view("web.components._checkout")->render();
$data['shipping_price_formated'] = UserCart::getCurrentShippingPrice(2); //shipping_for === 2 promotion , 3 shop
return response()->json(['response' => $data, 'cart'=>$cart, 'invoice'=>$invoice, 'checkout'=>$checkout, 'status'=>$status]);
return response()->json(['response' => $data, 'cart'=>$cart, 'invoice'=>$invoice, 'checkout'=>$checkout, 'status'=>$status, 'basketqty'=>Yard::instance('shopping')->count()]);
}
return response()->json(['response' => $data, 'html'=>$ret, 'status'=>$status]);
}