add shipping to order, methods to calculate, little refactoring

This commit is contained in:
ludo
2023-11-15 23:20:42 +01:00
parent 04df068931
commit 2ebdc5f16b
10 changed files with 117 additions and 45 deletions

View File

@@ -25,6 +25,23 @@ class Offers
return $offer ? $offer->weight * $quantity : 0;
}
public static function getWithVariationByIds($ids)
{
return Offer::with('variation')->byIds($ids)->get();
}
public static function getWithPricesByIds($ids, $saleChannelId = false)
{
$saleChannelId = $saleChannelId ? $saleChannelId : SaleChannels::getDefaultID();
return Offer::with([
'variation',
'article.article_nature',
'article.product.Specie',
'article.image',
'price_lists.price_list_values',
])->withPriceListsBySaleChannel($saleChannelId)->byIds($ids)->get();
}
public static function getFull($id, $saleChannelId = false)
{
$saleChannelId = $saleChannelId ? $saleChannelId : SaleChannels::getDefaultID();