From: soufiane Date: Tue, 25 Jul 2023 11:52:19 +0000 (+0200) Subject: wait #6172 @0:10 X-Git-Url: http://git.cubedesigners.com/?a=commitdiff_plain;h=fea3cbf18af5d4cd93b4c3858db85c589552392e;p=pmi.git wait #6172 @0:10 --- diff --git a/app/Models/Product.php b/app/Models/Product.php index dfdafec..d1a5f52 100644 --- a/app/Models/Product.php +++ b/app/Models/Product.php @@ -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; } }