diff --git a/app/Http/Controllers/Shop/ArticleController.php b/app/Http/Controllers/Shop/ArticleController.php
index 17c80c64..9eb8dd49 100644
--- a/app/Http/Controllers/Shop/ArticleController.php
+++ b/app/Http/Controllers/Shop/ArticleController.php
@@ -9,79 +9,14 @@ use App\Repositories\Shop\Articles;
class ArticleController extends Controller
{
- /**
- * Display a listing of the resource.
- *
- * @return \Illuminate\Http\Response
- */
- public function index()
- {
- //
- }
- /**
- * Show the form for creating a new resource.
- *
- * @return \Illuminate\Http\Response
- */
- public function create()
- {
- //
- }
-
- /**
- * Store a newly created resource in storage.
- *
- * @param \Illuminate\Http\Request $request
- * @return \Illuminate\Http\Response
- */
- public function store(Request $request)
- {
- //
- }
-
- /**
- * Display the specified resource.
- *
- * @param \App\Article $article
- * @return \Illuminate\Http\Response
- */
public function show($id)
{
- //
+ $data = self::init();
+ $data['article'] = Articles::getArticle($id);
+ // dump($data);
+ // exit;
+ return view('Shop.Articles.show', $data);
}
- /**
- * Show the form for editing the specified resource.
- *
- * @param \App\Article $article
- * @return \Illuminate\Http\Response
- */
- public function edit($id)
- {
- //
- }
-
- /**
- * Update the specified resource in storage.
- *
- * @param \Illuminate\Http\Request $request
- * @param \App\Article $article
- * @return \Illuminate\Http\Response
- */
- public function update(Request $request, $id)
- {
- //
- }
-
- /**
- * Remove the specified resource from storage.
- *
- * @param \App\Article $article
- * @return \Illuminate\Http\Response
- */
- public function destroy($id)
- {
- //
- }
}
diff --git a/app/Repositories/Core/Medias.php b/app/Repositories/Core/Medias.php
index b404d3d4..ee02c0fb 100644
--- a/app/Repositories/Core/Medias.php
+++ b/app/Repositories/Core/Medias.php
@@ -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) {
diff --git a/app/Repositories/Shop/Articles.php b/app/Repositories/Shop/Articles.php
index 620dbc5c..b38b4be3 100644
--- a/app/Repositories/Shop/Articles.php
+++ b/app/Repositories/Shop/Articles.php
@@ -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();
}
diff --git a/app/Traits/Repository/Imageable.php b/app/Traits/Repository/Imageable.php
index 39cb47e4..2b21b365 100644
--- a/app/Traits/Repository/Imageable.php
+++ b/app/Traits/Repository/Imageable.php
@@ -36,6 +36,16 @@ trait Imageable
return $image ? Medias::getPreviewSrc($image) : null;
}
+ public static function getImage($image)
+ {
+ return '';
+ }
+
+ public static function getImageSrc($image)
+ {
+ return $image ? Medias::getImageSrc($image) : null;
+ }
+
public static function deleteImage($id, $index)
{
return Medias::deleteImage(self::get($id), $index);
diff --git a/resources/views/Shop/Articles/partials/article.blade.php b/resources/views/Shop/Articles/partials/article.blade.php
index 35909ec6..a57e513d 100644
--- a/resources/views/Shop/Articles/partials/article.blade.php
+++ b/resources/views/Shop/Articles/partials/article.blade.php
@@ -2,23 +2,29 @@
-
+