Fix on default sale channel
This commit is contained in:
@@ -75,8 +75,9 @@ class Articles
|
|||||||
return Article::orderBy('name', 'asc')->get();
|
return Article::orderBy('name', 'asc')->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getArticleToSell($id, $sale_channel = false)
|
public static function getArticleToSell($id, $sale_channel_id = false)
|
||||||
{
|
{
|
||||||
|
$sale_channel_id = $sale_channel_id ? $sale_channel_id : SaleChannels::getDefaultID();
|
||||||
$article = self::get($id);
|
$article = self::get($id);
|
||||||
$data = $article->toArray();
|
$data = $article->toArray();
|
||||||
$parents = self::getInheritedByProduct($article->product_id, $article->product_type);
|
$parents = self::getInheritedByProduct($article->product_id, $article->product_type);
|
||||||
@@ -87,7 +88,7 @@ class Articles
|
|||||||
$data['inherited'] = self::getInherited($id);
|
$data['inherited'] = self::getInherited($id);
|
||||||
$data['categories'] = self::getCategoriesNameByArticle($article);
|
$data['categories'] = self::getCategoriesNameByArticle($article);
|
||||||
$data['tags'] = self::getTagsSlugByArticle($article);
|
$data['tags'] = self::getTagsSlugByArticle($article);
|
||||||
$data['offers'] = self::getOffersGroupedByNature($id, $sale_channel);
|
$data['offers'] = self::getOffersGroupedByNature($id, $sale_channel_id);
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,14 @@ class Offers
|
|||||||
{
|
{
|
||||||
$sale_channel_id = $sale_channel_id ? $sale_channel_id : SaleChannels::getDefaultID();
|
$sale_channel_id = $sale_channel_id ? $sale_channel_id : SaleChannels::getDefaultID();
|
||||||
return Offer::active()
|
return Offer::active()
|
||||||
->with(['article_nature', 'variation', 'tariff.price_lists.price_list_values'])
|
->with([
|
||||||
|
'article_nature',
|
||||||
|
'variation',
|
||||||
|
'tariff.price_lists' => function($query) use ($sale_channel_id) {
|
||||||
|
$query->bySaleChannel($sale_channel_id);
|
||||||
|
},
|
||||||
|
'tariff.price_lists.price_list_values',
|
||||||
|
])
|
||||||
->byArticles($articles_ids)
|
->byArticles($articles_ids)
|
||||||
->bySaleChannel($sale_channel_id)
|
->bySaleChannel($sale_channel_id)
|
||||||
->get();
|
->get();
|
||||||
@@ -20,7 +27,14 @@ class Offers
|
|||||||
{
|
{
|
||||||
$sale_channel_id = $sale_channel_id ? $sale_channel_id : SaleChannels::getDefaultID();
|
$sale_channel_id = $sale_channel_id ? $sale_channel_id : SaleChannels::getDefaultID();
|
||||||
return Offer::active()
|
return Offer::active()
|
||||||
->with(['article_nature', 'variation', 'tariff.price_lists.price_list_values'])
|
->with([
|
||||||
|
'article_nature',
|
||||||
|
'variation',
|
||||||
|
'tariff.price_lists' => function($query) use ($sale_channel_id) {
|
||||||
|
$query->bySaleChannel($sale_channel_id);
|
||||||
|
},
|
||||||
|
'tariff.price_lists.price_list_values',
|
||||||
|
])
|
||||||
->byArticle($article_id)
|
->byArticle($article_id)
|
||||||
->bySaleChannel($sale_channel_id)
|
->bySaleChannel($sale_channel_id)
|
||||||
->get();
|
->get();
|
||||||
|
|||||||
Reference in New Issue
Block a user