10.April 2026
This commit is contained in:
parent
a00c42e770
commit
f58c709945
208 changed files with 19280 additions and 2914 deletions
|
|
@ -403,16 +403,20 @@ class AboController extends Controller
|
|||
$data['step'] = 4;
|
||||
break;
|
||||
case 5:
|
||||
// chekout verarbeiten
|
||||
UserService::setInstance($this->instance);
|
||||
UserService::initCustomerYard($shopping_user, 'abo-ot-customer');
|
||||
if (Request::get('action') == 'checkout') {
|
||||
// checkout verarbeiten
|
||||
if (! $this->preCheckCheckout()) {
|
||||
if (! Request::boolean('abo_order_info_checkbox')) {
|
||||
$data['error'] = __('abo.abo_order_info_checkbox_required');
|
||||
$data['step'] = 4;
|
||||
} elseif (! in_array((int) Request::input('abo_interval'), UserAbo::$aboDeliveryDays, true)) {
|
||||
$data['error'] = __('abo.error_abo_interval');
|
||||
$data['step'] = 4;
|
||||
} elseif (! $this->preCheckCheckout()) {
|
||||
$data['error'] = __('abo.abo_error_basis_product');
|
||||
$data['step'] = 4;
|
||||
} else {
|
||||
$data['checkout_url'] = $this->processCheckout();
|
||||
$data['checkout_url'] = $this->processCheckout($shopping_user);
|
||||
}
|
||||
}
|
||||
$data['step'] = 4;
|
||||
|
|
@ -439,18 +443,9 @@ class AboController extends Controller
|
|||
Shop::initUserShopLang($delivery_country, $this->instance);
|
||||
}
|
||||
|
||||
private function preCheckCheckout()
|
||||
private function preCheckCheckout(): bool
|
||||
{
|
||||
$result = false;
|
||||
// alle inhlate des warenkorb
|
||||
$cartItems = $this->yard->content();
|
||||
foreach ($cartItems as $item) {
|
||||
if (in_array(12, $item->options->show_on)) {
|
||||
$result = true;
|
||||
}
|
||||
}
|
||||
|
||||
return $result;
|
||||
return AboHelper::aboHasBaseProduct($this->yard->getContentByOrder());
|
||||
}
|
||||
|
||||
private function checkBasisProduct()
|
||||
|
|
@ -550,7 +545,7 @@ class AboController extends Controller
|
|||
$this->yard->reCalculateShippingPrice();
|
||||
}
|
||||
|
||||
private function processCheckout()
|
||||
private function processCheckout(ShoppingUser $shoppingUser): string
|
||||
{
|
||||
$user_shop = Util::getUserShop();
|
||||
if (! $user_shop) {
|
||||
|
|
@ -560,24 +555,38 @@ class AboController extends Controller
|
|||
$identifier = Util::getToken();
|
||||
} while (ShoppingInstance::where('identifier', $identifier)->count());
|
||||
|
||||
$data = [];
|
||||
$data['is_from'] = 'shopping';
|
||||
$data['user_price_infos'] = $this->yard->getUserPriceInfos();
|
||||
$aboInterval = (int) Request::input('abo_interval', 0);
|
||||
|
||||
$fillable = (new ShoppingUser)->getFillable();
|
||||
$shoppingData = array_merge(
|
||||
array_intersect_key($shoppingUser->getAttributes(), array_flip($fillable)),
|
||||
[
|
||||
'shopping_user_id' => $shoppingUser->id,
|
||||
'is_from' => 'shopping',
|
||||
'is_for' => 'abo-ot-customer',
|
||||
'is_abo' => true,
|
||||
'abo_interval' => $aboInterval,
|
||||
'shipping_is_for' => 'abo-ot-customer',
|
||||
'user_price_infos' => $this->yard->getUserPriceInfos(),
|
||||
'mode' => config('app.mode') === 'test' ? 'test' : 'live',
|
||||
]
|
||||
);
|
||||
|
||||
ShoppingInstance::create([
|
||||
'identifier' => $identifier,
|
||||
'user_shop_id' => $user_shop->id,
|
||||
'payment' => 1, // Customer Shop Payment
|
||||
'payment' => 1,
|
||||
'subdomain' => url('/'),
|
||||
'country_id' => $this->yard->getShippingCountryId(),
|
||||
'language' => \App::getLocale(),
|
||||
'shopping_data' => $data,
|
||||
'language' => $shoppingUser->getLocale(),
|
||||
'amount' => (float) $this->yard->totalWithShipping(2, '.', ''),
|
||||
'shopping_user_id' => $shoppingUser->id,
|
||||
'shopping_data' => $shoppingData,
|
||||
'back' => url()->previous(),
|
||||
|
||||
]);
|
||||
|
||||
$this->yard->store($identifier);
|
||||
// add to DB
|
||||
|
||||
$path = route('checkout.checkout_card', ['identifier' => $identifier]);
|
||||
if (strpos($path, 'https') === false) {
|
||||
$path = str_replace('http', 'https', $path);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue