]> _ Git - pmi.git/commitdiff
wait #6172 @0:10
authorsoufiane <soufiane@cubedesigners.com>
Tue, 25 Jul 2023 11:52:19 +0000 (13:52 +0200)
committersoufiane <soufiane@cubedesigners.com>
Tue, 25 Jul 2023 11:52:19 +0000 (13:52 +0200)
app/Models/Product.php

index dfdafec57dfb33636d4871d445284468d5e4bcd6..d1a5f522f3781298338152d0eff18f18bbc4b9f4 100644 (file)
@@ -530,6 +530,7 @@ class Product extends CubistMagicPageModel
         $optDetails = [];
 
         $explodeRef = explode("|", $refs);
+
         if (sizeof($explodeRef) > 1) {
             $options = json_decode($productsInfosBase[$id][0]['json'], true);
             if(!$options) {
@@ -537,17 +538,21 @@ class Product extends CubistMagicPageModel
             }
 
             $counter = -1;
-            foreach ($explodeRef as $key => $ref) {
-                if ($counter > -1) {
-                    $options_ = $options[$counter]['options'];
-                    foreach ($options_ as $opt_) {
-                        if ($opt_["ref"] === $ref) {
-                            $opt[$refs][] = $opt_["sale_price"];
-                            $optDetails[] = ucfirst($options[$counter]['name_fr']) . ' : ' . $ref;
+            try {
+                foreach ($explodeRef as $key => $ref) {
+                    if ($counter > -1) {
+                        $options_ = $options[$counter]['options'];
+                        foreach ($options_ as $opt_) {
+                            if ($opt_["ref"] === $ref) {
+                                $opt[$refs][] = $opt_["sale_price"];
+                                $optDetails[] = ucfirst($options[$counter]['name_fr']) . ' : ' . $ref;
+                            }
                         }
                     }
+                    $counter++;
                 }
-                $counter++;
+            }catch(\Exception $e) {
+                return $opt;
             }
         }