add shipping rules

This commit is contained in:
Ludovic CANDELLIER
2023-07-16 14:45:42 +02:00
parent 72a7b270f9
commit 0879b0abf0
459 changed files with 6219 additions and 5416 deletions

View File

@@ -2,20 +2,16 @@
namespace App\Repositories\Shop;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Str;
use App\Models\Shop\PriceListValue;
use App\Models\Shop\PriceList;
use App\Models\Shop\Offer;
use App\Models\Shop\PriceListValue;
class PriceListValues
{
public static function getPriceByOffer($offer_id, $quantity = 1, $sale_channel_id = false)
{
$prices = self::getPricesByOffer($offer_id, $sale_channel_id);
$price = $prices ? $prices->where('quantity', '<=', $quantity)->sortByDesc('quantity')->first() : false;
return $price ? $price->price_taxed : false;
}
@@ -26,6 +22,7 @@ class PriceListValues
$sale_channel_id ? $query->bySaleChannel($sale_channel_id) : $query;
},
])->find($offer_id)->price_lists->first();
return $price_list ? $price_list->price_list_values : false;
}
@@ -58,6 +55,7 @@ class PriceListValues
{
$id = isset($data['id']) ? $data['id'] : false;
$price = $id ? self::update($data) : self::create($data);
return $price;
}
@@ -71,6 +69,7 @@ class PriceListValues
$id = $id ? $id : $data['id'];
$item = self::get($id);
$item->update($data);
return $item;
}