From: Vincent Vanwaelscappel Date: Mon, 8 Jul 2019 19:46:49 +0000 (+0200) Subject: #2843 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=c310bcf2f347ddb3c4560a07af99540e06ef9315;p=pmi.git #2843 --- diff --git a/.env.production b/.env.production index 1aebbc8..d6ba087 100644 --- a/.env.production +++ b/.env.production @@ -24,12 +24,12 @@ REDIS_PASSWORD=null REDIS_PORT=6379 MAIL_DRIVER=smtp -MAIL_HOST=localhost -MAIL_PORT=25 -MAIL_USERNAME=null -MAIL_PASSWORD=null -MAIL_ENCRYPTION=null -MAIL_FROM_ADDRESS=pmi@cubedesigners.com +MAIL_HOST=in-v3.mailjet.com +MAIL_PORT=587 +MAIL_USERNAME=a0efe78a914ae9b7b972618c6c3e1803 +MAIL_PASSWORD=b4d51c4c1d0193f9b0963c2c374dd882 +MAIL_ENCRYPTION=tls +MAIL_FROM_ADDRESS=web@pm-instrumentation.com MAIL_FROM_NAME="PM-Instrumentation" PUSHER_APP_ID= diff --git a/.env.staging b/.env.staging index fec13ce..61ef996 100644 --- a/.env.staging +++ b/.env.staging @@ -23,12 +23,12 @@ REDIS_PASSWORD=null REDIS_PORT=6379 MAIL_DRIVER=smtp -MAIL_HOST=localhost -MAIL_PORT=25 -MAIL_USERNAME=null -MAIL_PASSWORD=null -MAIL_ENCRYPTION=null -MAIL_FROM_ADDRESS=pmi@cubedesigners.com +MAIL_HOST=in-v3.mailjet.com +MAIL_PORT=587 +MAIL_USERNAME=a0efe78a914ae9b7b972618c6c3e1803 +MAIL_PASSWORD=b4d51c4c1d0193f9b0963c2c374dd882 +MAIL_ENCRYPTION=tls +MAIL_FROM_ADDRESS=web@pm-instrumentation.com MAIL_FROM_NAME="PM-Instrumentation" PUSHER_APP_ID= diff --git a/app/Models/Product.php b/app/Models/Product.php index 0f739c1..77212f9 100644 --- a/app/Models/Product.php +++ b/app/Models/Product.php @@ -203,7 +203,9 @@ class Product extends CubistMagicModel } if (is_array($decoded)) { foreach ($decoded as $option) { - $options[] = $option->fr; + if (isset($option->fr)) { + $options[] = $option->fr; + } } } @@ -219,7 +221,7 @@ class Product extends CubistMagicModel $typedocs = ['odt', 'doc', 'docx', 'pdf']; $res = []; foreach ($this->_documents as $fieldName => $label) { - foreach ($this->getMedia($this->$fieldName) as $media) { + foreach ($this->getMediaInField($this->$fieldName) as $media) { /** @var $media Media */ $res[] = ['media' => $media, 'label' => $label, 'type' => in_array($media->getExtensionAttribute(), $typedocs) ? 'document' : 'tech']; @@ -229,6 +231,11 @@ class Product extends CubistMagicModel return $res; } + public function hasProductImage() + { + return count($this->getMediaInField($this->images)) > 0; + } + public function hasDocuments() { return count($this->getDocuments()) > 0; diff --git a/config/mail.php b/config/mail.php index f400645..83dd874 100644 --- a/config/mail.php +++ b/config/mail.php @@ -56,8 +56,8 @@ return [ */ 'from' => [ - 'address' => env('MAIL_FROM_ADDRESS', 'hello@example.com'), - 'name' => env('MAIL_FROM_NAME', 'Example'), + 'address' => env('MAIL_FROM_ADDRESS', 'pmi@cubedesigners.com'), + 'name' => env('MAIL_FROM_NAME', 'PM-Instrumentation'), ], /* diff --git a/resources/views/pages/product-detail.blade.php b/resources/views/pages/product-detail.blade.php index 2f2b15b..c61b3a8 100644 --- a/resources/views/pages/product-detail.blade.php +++ b/resources/views/pages/product-detail.blade.php @@ -10,15 +10,16 @@ {{-- Product details --}}
+ @if($product->hasProductImage()) {{-- Product images --}}
+ style="background-image: url({{ $product->getMediaInField($product->images)->first()->getUrl() }});">
- @foreach ($product->getMedia($product->images) as $image) + @foreach ($product->getMediaInField($product->images) as $image)
@@ -26,13 +27,14 @@ @endforeach
+ @endif {{-- Product text --}} {!! Markdown::parse($product->highlights) !!} - @if(count($product->getMedia($product->technical_sheet))) -

Télécharger + @if(count($product->getMediaInField($product->technical_sheet))) +

Télécharger la fiche produit

@endif