Add display articles by rows, and display article in full mode
This commit is contained in:
@@ -74,6 +74,17 @@ class Medias
|
||||
return '.' . pathinfo($filename, PATHINFO_EXTENSION);
|
||||
}
|
||||
|
||||
public static function getImageSrc($image)
|
||||
{
|
||||
if (!$image) {
|
||||
return null;
|
||||
}
|
||||
$id = $image['id'];
|
||||
$filename = $image['name'] . self::getExtension($image['file_name']);
|
||||
|
||||
return "/storage/$id/$filename";
|
||||
}
|
||||
|
||||
public static function getThumbSrc($image)
|
||||
{
|
||||
if (!$image) {
|
||||
|
||||
@@ -51,7 +51,9 @@ class Articles
|
||||
{
|
||||
$article = self::get($id);
|
||||
$data = $article->toArray();
|
||||
$data['description'] = (!empty($article->description)) ? $article->description : $article->product->description;
|
||||
$data['image'] = Articles::getPreview($article->image);
|
||||
$data['image_big'] = Articles::getImage($article->image);
|
||||
$data['inherited'] = self::getInherited($id);
|
||||
$data['categories'] = self::getCategoriesNameByArticle($article);
|
||||
$data['tags'] = self::getTagsNameByArticle($article);
|
||||
@@ -63,6 +65,7 @@ class Articles
|
||||
{
|
||||
$articles = self::getArticlesWithOffers();
|
||||
// dump($articles->toArray());
|
||||
// exit;
|
||||
foreach ($articles as $article) {
|
||||
$price_lists = $article->offers[0]->tariff->price_lists->toArray();
|
||||
// dump($price_lists);
|
||||
@@ -81,6 +84,7 @@ class Articles
|
||||
'offer_id' => $article->offers[0]->id,
|
||||
'quantity' => $prices['quantity'],
|
||||
'price' => $prices['price_taxed'],
|
||||
'variation' => $article->offers[0]->variation->name,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -95,7 +99,7 @@ class Articles
|
||||
'image',
|
||||
'product',
|
||||
'article_nature',
|
||||
'offers.variation',
|
||||
'offers.variation.package',
|
||||
'offers.tariff.price_lists.price_list_values',
|
||||
])->get();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user