Skip to content

Commit

Permalink
Merge pull request #1181 from plentymarkets/fix/undefined_in_localize…
Browse files Browse the repository at this point in the history
…dorder

fix potential undefined#
  • Loading branch information
felixgehrmann authored Jul 19, 2023
2 parents 2bbf816 + 34721a8 commit 4ff44e4
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/Models/LocalizedOrder.php
Original file line number Diff line number Diff line change
Expand Up @@ -209,19 +209,19 @@ public static function wrap($order, ...$data)

$wrappedOrderitemTypes = $order->typeId === OrderType::RETURNS ? self::WRAPPED_ORDERITEM_TYPES_FOR_RETURN : self::WRAPPED_ORDERITEM_TYPES;
foreach ($order->orderItems as $key => $orderItem) {
// unset purchase price
foreach($order->orderItems[$key]->amounts as &$amount) {
unset($amount['purchasePrice']);
}
unset($amount);

if (in_array((int)$orderItem->typeId, $wrappedOrderitemTypes)) {
if ($orderItem->itemVariationId !== 0) {
$orderVariationIds[] = $orderItem->itemVariationId;
}
} else {
unset($order->orderItems[$key]);
}

// unset purchase price
foreach($order->orderItems[$key]->amounts as &$amount) {
unset($amount['purchasePrice']);
}
unset($amount);
}

$resultFields = ResultFieldTemplate::load(ResultFieldTemplate::TEMPLATE_LIST_ITEM);
Expand Down

0 comments on commit 4ff44e4

Please sign in to comment.