$orderPosition = null;
foreach ($order->
getDetails() as $position) { if ($position->
getId() ===
(int) $data['id'
]) { $orderPosition =
$position;
break;
} } // Only get graduated price if a new position should be added or quantity has changed
if (($orderPosition === null ||
$orderPosition->
getQuantity() !==
(int) $data['quantity'
]) &&
$this->
hasProductGraduatedPrices($data['articleNumber'
],
$order) ) { $data =
$this->
checkPrice($data,
$order,
$shopContext);
} $variant =
$this->
getManager()->
getRepository(ProductVariant::
class) ->
findOneBy(['number' =>
$data['articleNumber'
]]);
// Load ean, unit and pack unit (translate if needed)
if ($variant instanceof ProductVariant
) { $mainVariant =
$variant->
getArticle()->
getMainDetail();
$data['ean'
] =
$variant->
getEan();
if (!\
is_string($data['ean'
]) &&
$mainVariant instanceof ProductVariant
) { $data['ean'
] =
$mainVariant->
getEan();
}