Standard-Shop fuer jeden Berater: Kundenbestellung ohne Shop crashte nicht mehr
Berater ohne UserShop liefen bei Kundenbestellungen (abo-ot-customer) in "Attempt to read property id on null". Shops werden jetzt bei Freischaltung und bei Bedarf automatisch angelegt (Name aus Vor-/Nachname, bei Belegung -2, -3, ...). Nachtrag fuer Bestandsberater: php artisan user:ensure-shops. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
2381bbe3b9
commit
083d643220
7 changed files with 306 additions and 7 deletions
|
|
@ -17,6 +17,7 @@ use App\Services\Payment;
|
|||
use App\Services\ProductOrderContext;
|
||||
use App\Services\Shop;
|
||||
use App\Services\UserService;
|
||||
use App\Services\UserShopService;
|
||||
use App\Services\Util;
|
||||
use App\User;
|
||||
use Auth;
|
||||
|
|
@ -306,11 +307,12 @@ class OrderController extends Controller
|
|||
private function processCustomerPayment($user, $identifier, $data, $id, $for)
|
||||
{
|
||||
$shopping_user = ShoppingUser::find($id);
|
||||
$user_shop = UserShopService::ensureForUser($user);
|
||||
$shopping_instance = ShoppingInstance::create([
|
||||
'identifier' => $identifier,
|
||||
'user_shop_id' => $user->shop->id,
|
||||
'user_shop_id' => $user_shop->id,
|
||||
'payment' => 6, // Berater Shop to Customer Shop
|
||||
'subdomain' => $user->shop->getSubdomain(),
|
||||
'subdomain' => $user_shop->getSubdomain(),
|
||||
'country_id' => Yard::instance('shopping')->getShippingCountryId(),
|
||||
'language' => $shopping_user->getLocale(), // hier wird die Sprache des Kunden verwendet
|
||||
'amount' => Yard::instance('shopping')->totalWithShipping(2, '.', ''),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue