Warenwirtschaft: API ordnet Variations-SKUs dem Basisprodukt zu
Shop-Variationen (z. B. „10042-1") sind dasselbe Produkt mit derselben WP-Nummer. Bei der Bestellannahme zählt für die Zuordnung nur der Teil vor dem ersten „-"; die Original-SKU bleibt im API-Protokoll erhalten. Leere Basis (z. B. „-1") wird nicht zugeordnet statt auf 0 zu matchen. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
c171aa269a
commit
0e27478b44
2 changed files with 51 additions and 1 deletions
|
|
@ -710,7 +710,14 @@ class ShoppingUserController extends Controller
|
|||
$error[] = 'article parameter is missing';
|
||||
} else {
|
||||
|
||||
$product = Product::whereWpNumber($order->article)->first();
|
||||
// Variations-SKUs aus dem Shop (z. B. „10042-1") sind dasselbe Produkt:
|
||||
// für die Zuordnung zählt nur der Teil vor dem ersten „-". Das Original
|
||||
// bleibt in $order->article, damit das API-Protokoll die echte SKU zeigt.
|
||||
$baseArticle = trim(explode('-', trim((string) $order->article), 2)[0]);
|
||||
|
||||
$product = $baseArticle !== ''
|
||||
? Product::whereWpNumber($baseArticle)->first()
|
||||
: null;
|
||||
if (! $product) {
|
||||
$error[] = 'article not found';
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue