]> _ Git - pmi.git/commitdiff
wip #3029 @1
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 11 Sep 2019 13:09:49 +0000 (15:09 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 11 Sep 2019 13:09:49 +0000 (15:09 +0200)
app/Models/Product.php
app/Models/Specification.php

index db10a99949579e1f2593851e878d4b80c65e4558..43fbd4e9b903c26d211cb2f38f7e742ae52c9992 100644 (file)
@@ -215,12 +215,14 @@ class Product extends CubistMagicPageModel
                         $decoded = $spec->options;
                     }
                     if (is_array($decoded)) {
-                        foreach ($decoded as $option) {
+                        foreach ($decoded as $i => $option) {
+                            if (!isset($option->id) || $option->id === '') {
+                                $option->id = $i;
+                            }
                             if (isset($option->fr)) {
-                                $options[] = $option->fr;
+                                $options[$option->id] = $option->fr;
                             }
                         }
-
                     }
                     $params['options'] = $options;
                 }
index 42a6f264628de1dcc3f2b3925e5486cffda7ca03..85408e559b1674e05007cfeae11e4424ab135bd6 100644 (file)
@@ -37,7 +37,7 @@ class Specification extends CubistMagicModel
             'label' => 'Options',
             'type' => 'Table',
             'entity_singular' => 'option',
-            'columns' => config('backpack.crud.locales'),
+            'columns' => array_merge(['id' => '#'], config('backpack.crud.locales')),
             'when' => ['type' => 'list'],
             'translatable' => false,
         ]);