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
|
|
@ -15,6 +15,7 @@ use App\Repositories\ContractPDFRepository;
|
|||
use App\Repositories\FileRepository;
|
||||
use App\Repositories\UserRepository;
|
||||
use App\Services\UserService;
|
||||
use App\Services\UserShopService;
|
||||
use App\Services\Util;
|
||||
use App\User;
|
||||
use Auth;
|
||||
|
|
@ -416,6 +417,7 @@ class WizardController extends Controller
|
|||
$user->confirmation_code_to = null;
|
||||
$user->confirmation_code_remider = 0;
|
||||
$user->save();
|
||||
UserShopService::ensureForUser($user);
|
||||
|
||||
// mail with code to user?
|
||||
if ($user->isTestMode()) {
|
||||
|
|
@ -604,7 +606,7 @@ class WizardController extends Controller
|
|||
if ($product->images->count()) {
|
||||
$image = $product->images->first()->slug;
|
||||
}
|
||||
$cartItem = Yard::instance('shopping')->add($product->id, $product->getLang('name'), 1, $product->getPriceWith(\App\Services\UserService::getTaxFree(), false, \App\Services\UserService::$user_country), false, false, ['image' => $image, 'slug' => $product->slug, 'weight' => $product->weight, 'points' => $product->points, 'no_commission' => $product->no_commission, 'no_free_shipping' => $product->no_free_shipping, 'free_shipping_consultant' => $product->free_shipping_consultant, 'show_on' => $product->show_on]);
|
||||
$cartItem = Yard::instance('shopping')->add($product->id, $product->getLang('name'), 1, $product->getPriceWith(UserService::getTaxFree(), false, UserService::$user_country), false, false, ['image' => $image, 'slug' => $product->slug, 'weight' => $product->weight, 'points' => $product->points, 'no_commission' => $product->no_commission, 'no_free_shipping' => $product->no_free_shipping, 'free_shipping_consultant' => $product->free_shipping_consultant, 'show_on' => $product->show_on]);
|
||||
if ($cartItem->qty > 1) {
|
||||
Yard::instance('shopping')->update($cartItem->rowId, 1);
|
||||
}
|
||||
|
|
@ -613,10 +615,10 @@ class WizardController extends Controller
|
|||
Yard::instance('shopping')->remove($existingItem->rowId);
|
||||
}
|
||||
}
|
||||
if (\App\Services\UserService::getTaxFree()) {
|
||||
if (UserService::getTaxFree()) {
|
||||
Yard::setTax($cartItem->rowId, 0);
|
||||
} else {
|
||||
Yard::setTax($cartItem->rowId, $product->getTaxWith(\App\Services\UserService::$user_country));
|
||||
Yard::setTax($cartItem->rowId, $product->getTaxWith(UserService::$user_country));
|
||||
}
|
||||
|
||||
do {
|
||||
|
|
@ -626,7 +628,7 @@ class WizardController extends Controller
|
|||
$data = [];
|
||||
$data['is_from'] = 'wizard';
|
||||
$data['is_for'] = 'me';
|
||||
$data['user_price_infos'] = \App\Services\UserService::getUserPriceInfos();
|
||||
$data['user_price_infos'] = UserService::getUserPriceInfos();
|
||||
|
||||
ShoppingInstance::create([
|
||||
'identifier' => $identifier,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue