Fixed Article Packets and Shipping Note Text Entry

This commit is contained in:
Luca Haid
2025-03-31 14:22:44 +02:00
parent af1c716998
commit d33d93867f
4 changed files with 12 additions and 10 deletions
@@ -47,11 +47,13 @@ class WarehouseArticlePacketController extends TTCrud {
foreach ($subItems as $subItem) {
$article = WarehouseArticleModel::get($subItem->id);
$cheapestSellPrices = json_decode($article->cheapestSellPrice);
$cheapestSellPrices = json_decode($article->cheapestSellPrice, true);
// find in array cheapestSellPrices by title === 'Energie Steiermark' and get the price
$articlePrice = array_values(array_filter($cheapestSellPrices, function ($cheapestSellPrice) {
return $cheapestSellPrice->title === 'Energie Steiermark';
}))[0]->price;
return $cheapestSellPrice['title'] === 'Energie Steiermark';
}));
$articlePrice = $articlePrice[0]['price'] ?? 0;
$calculatedSellPrice += $subItem->amount * $articlePrice;
}