add shipping rules
This commit is contained in:
@@ -3,7 +3,6 @@
|
||||
namespace App\Repositories\Shop;
|
||||
|
||||
use App\Models\Shop\Offer;
|
||||
use App\Repositories\Core\User\ShopCart;
|
||||
|
||||
class Offers
|
||||
{
|
||||
@@ -29,6 +28,7 @@ class Offers
|
||||
])->find($id);
|
||||
$images = Articles::getFullImagesByArticle($offer->article);
|
||||
$offer->article->image = Articles::getPreviewSrc($images[0] ?? false);
|
||||
|
||||
return $offer;
|
||||
}
|
||||
|
||||
@@ -36,6 +36,7 @@ class Offers
|
||||
{
|
||||
$sale_channel_id = $sale_channel_id ? $sale_channel_id : SaleChannels::getDefaultID();
|
||||
$offer = Offer::withPriceBySaleChannelByQuantity($sale_channel_id, $quantity)->find($id);
|
||||
|
||||
return $offer->price_lists->first()->price_list_values->first();
|
||||
}
|
||||
|
||||
@@ -57,6 +58,7 @@ class Offers
|
||||
public static function getOffersBySaleChannelRaw($sale_channel_id = false)
|
||||
{
|
||||
$sale_channel_id = $sale_channel_id ? $sale_channel_id : SaleChannels::getDefaultID();
|
||||
|
||||
return Offer::active()->byStockAvailable()
|
||||
->with([
|
||||
'article_nature',
|
||||
@@ -77,9 +79,10 @@ class Offers
|
||||
public static function getThumbSrc(Offer $offer)
|
||||
{
|
||||
$image = $offer->article ? Articles::getFullImageByArticle($offer->article) : false;
|
||||
|
||||
return $image ? Articles::getThumbSrc($image) : false;
|
||||
}
|
||||
|
||||
|
||||
public static function getLast()
|
||||
{
|
||||
return Offer::with(['article.image'])->active()->orderByDesc('updated_at')->get();
|
||||
@@ -92,6 +95,7 @@ class Offers
|
||||
$offers1 = self::getByCategory($category_id)->toArray();
|
||||
$offers2 = self::getByTags($tags)->toArray();
|
||||
$data = array_merge($offers1, $offers2);
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
@@ -130,6 +134,7 @@ class Offers
|
||||
$id = $id ? $id : $data['id'];
|
||||
$item = self::get($id);
|
||||
$item->update($data);
|
||||
|
||||
return $item;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user