From: Vincent Vanwaelscappel Date: Thu, 11 Jul 2019 13:00:01 +0000 (+0200) Subject: wip #2881 @2 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=97a53bebe13171234d5a70d8536491df150b6697;p=pmi.git wip #2881 @2 --- diff --git a/app/Http/Controllers/ProductController.php b/app/Http/Controllers/ProductController.php index 1efe0b0..60825cd 100644 --- a/app/Http/Controllers/ProductController.php +++ b/app/Http/Controllers/ProductController.php @@ -35,7 +35,7 @@ class ProductController extends CubistFrontController $this->_404(); } - $this->data['title'] = $product->title; + $this->data['title'] = $product->name; $this->data['product'] = $product->getPageData(); return view('pages.product-detail', $this->data); diff --git a/app/Templates/Catalog.php b/app/Templates/Catalog.php index 02bc6bf..9ea5bfd 100644 --- a/app/Templates/Catalog.php +++ b/app/Templates/Catalog.php @@ -3,6 +3,7 @@ namespace App\Templates; +use App\Models\Product; use App\Models\ProductType; use Cubist\Backpack\app\Magic\Menu\Item; use Cubist\Backpack\app\Magic\Menu\VirtualItem; @@ -24,6 +25,7 @@ class Catalog extends TemplateAbstract $families = ['captor' => __('Capteurs'), 'system' => __('Systèmes de mesure')]; $productTypes = ProductType::all(); + $products = Product::all(); $menu->setType('mega'); foreach ($families as $key => $family) { @@ -35,12 +37,25 @@ class Catalog extends TemplateAbstract if ($productType->type !== $key) { continue; } + $category = new Item(); $category->setTitle($productType->name); $category->setHref($productType->slug); $category->setId('product_type_' . $productType->id); $category->setController(['controller' => 'ProductController', 'action' => 'productList', 'params' => ['id' => $productType->id]]); $item->addChild($category); + + foreach ($products as $product) { + if ($product->product_type != $productType->id) { + continue; + } + $detail = new Item(); + $detail->setTitle($product->name); + $detail->setHref($product->slug); + $detail->setId('product/' . $product->id); + $detail->setController(['controller' => 'ProductController', 'action' => 'productDetails', 'params' => ['id' => $product->id]]); + $category->addChild($detail); + } } } } diff --git a/resources/views/pages/product-detail.blade.php b/resources/views/pages/product-detail.blade.php index a78eb0b..1866c10 100644 --- a/resources/views/pages/product-detail.blade.php +++ b/resources/views/pages/product-detail.blade.php @@ -1,6 +1,7 @@ @extends('layouts/app') @section('content') + @@ -10,36 +11,37 @@ {{-- Product details --}}
- @if($product->hasProductImage()) - {{-- Product images --}} -
-
-
- - @foreach ($product->getMediaInField($product->images) as $image) -
-
- @endforeach -
+ {{-- Product images --}} +
+
- @endif + + + @foreach ($product->getImageURLList('images') as $key=>$url) + @if ($key==0) + continue; + @endif +
+
+ @endforeach +
+
+ {{-- Product text --}} {!! Markdown::parse($product->highlights) !!} - @if(count($product->getMediaInField($product->technical_sheet))) -

- - {{ __('Télécharger la fiche produit') }} - -

- @endif +

+ + {{ __('Télécharger la fiche produit') }} + +

Ajouter à ma sélection @@ -65,12 +67,13 @@ @endif - @if ($product->hasDocuments()) + @if ($product->getEntity()->hasDocuments())