Add variations, slider, fix cart ...
This commit is contained in:
@@ -32,7 +32,8 @@ class Articles
|
||||
$article_ids = self::getSiblingsIds($id);
|
||||
$offers = Offers::getOffersByArticles($article_ids, $sale_channel_id);
|
||||
foreach ($offers as $offer) {
|
||||
$data[strtolower($offer->article_nature->name)] = [
|
||||
$data[strtolower($offer->article_nature->name)][] = [
|
||||
'id' => $offer->id,
|
||||
'name' => $offer->variation->name,
|
||||
'prices' => $offer->tariff->price_lists->first()->price_list_values->toArray(),
|
||||
];
|
||||
@@ -77,7 +78,6 @@ class Articles
|
||||
|
||||
public static function getArticleToSell($id, $sale_channel_id = false)
|
||||
{
|
||||
$sale_channel_id = $sale_channel_id ? $sale_channel_id : SaleChannels::getDefaultID();
|
||||
$article = self::get($id);
|
||||
$data = $article->toArray();
|
||||
$parents = self::getInheritedByProduct($article->product_id, $article->product_type);
|
||||
@@ -126,6 +126,19 @@ class Articles
|
||||
return $data;
|
||||
}
|
||||
|
||||
public static function getArticlesByHomepage()
|
||||
{
|
||||
$shelves = Categories::getByHomepage();
|
||||
foreach ($shelves as $shelve) {
|
||||
$data[] = [
|
||||
'id' => $shelve->id,
|
||||
'name' => $shelve->name,
|
||||
'articles' => self::getArticlesToSell($shelve->id),
|
||||
];
|
||||
}
|
||||
return $data;
|
||||
}
|
||||
|
||||
public static function getArticlesToSell($category_id = false, $tags = false)
|
||||
{
|
||||
$articles = self::getArticlesWithOffers($category_id, $tags);
|
||||
@@ -135,6 +148,7 @@ class Articles
|
||||
if (count($price_lists)) {
|
||||
if (!is_array($data[$article->name] ?? false)) {
|
||||
$data[$article->name] = [
|
||||
'id' => $article->id,
|
||||
'description' => (!empty($article->description)) ? $article->description : $article->product->description,
|
||||
'image' => self::getFullImageByArticle($article),
|
||||
'product_type' => $article->product_type,
|
||||
|
||||
Reference in New Issue
Block a user