]> _ Git - pmi.git/commitdiff
#2843
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 8 Jul 2019 19:46:49 +0000 (21:46 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Mon, 8 Jul 2019 19:46:49 +0000 (21:46 +0200)
.env.production
.env.staging
app/Models/Product.php
config/mail.php
resources/views/pages/product-detail.blade.php

index 1aebbc82741dd144f4d8e8a751661d87035612eb..d6ba08783d7ee8431fc1b435b9a01b3017bfbb4a 100644 (file)
@@ -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=
index fec13cee6c6ac317c604cd69bbefc819451ee9b9..61ef996491abf603f8bd39448be5ceaa4b5f3497 100644 (file)
@@ -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=
index 0f739c1c5d06699b7f0eaf65691750abe3b4e1fc..77212f9f724b2676b65650252608dab951170b9d 100644 (file)
@@ -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;
index f4006459a84756131f171f35de5477f2b96b5c7c..83dd8747025fa33de485592ed20c07c27a88ba00 100644 (file)
@@ -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'),
     ],
 
     /*
index 2f2b15b0dd46d69391faeb067af6a47d8324ea10..c61b3a83792dff1b1abd04aa2f98afc1976a31ce 100644 (file)
 
         {{-- Product details --}}
         <div class="flex mb-2v sm:block">
+            @if($product->hasProductImage())
             {{-- Product images --}}
             <div class="product-detail-images-wrapper flex-grow" style="max-width: 348px">
                 <div
                     class="product-detail-images-main border-gray-100 border-4 pb-100p w-full bg-center bg-contain bg-no-repeat mb-3"
-                    style="background-image: url({{ $product->getMedia($product->images)->first()->getUrl() }});">
+                    style="background-image: url({{ $product->getMediaInField($product->images)->first()->getUrl() }});">
                 </div>
 
                 <grid cols="3" gap="sm">
-                    @foreach ($product->getMedia($product->images) as $image)
+                    @foreach ($product->getMediaInField($product->images) as $image)
                         <div
                             class="product-detail-images-main border-gray-100 border-4 pb-100p w-full bg-center bg-contain bg-no-repeat"
                             style="background-image: url({{ $image->getUrl() }});">
                     @endforeach
                 </grid>
             </div>
+            @endif
 
             {{-- Product text --}}
             <text-block class="product-detail-text sm:mt-6">
                 {!! Markdown::parse($product->highlights) !!}
 
-                @if(count($product->getMedia($product->technical_sheet)))
-                    <p class="mt-4"><a href="{{$product->getMedia($product->technical_sheet)->first()->getUrl()}}">Télécharger
+                @if(count($product->getMediaInField($product->technical_sheet)))
+                    <p class="mt-4"><a href="{{$product->getMediaInField($product->technical_sheet)->first()->getUrl()}}">Télécharger
                             la fiche produit</a></p>
                 @endif