From f92e175731d60555c75a78e8c7d0c3e943376392 Mon Sep 17 00:00:00 2001 From: Valentin Lab Date: Sat, 13 Dec 2025 21:05:08 +0100 Subject: [PATCH] fix: prevent error 500 upon displaying empty 'Rayons' --- app/Repositories/Shop/Articles.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/Repositories/Shop/Articles.php b/app/Repositories/Shop/Articles.php index 354f1cad..36a0ce51 100644 --- a/app/Repositories/Shop/Articles.php +++ b/app/Repositories/Shop/Articles.php @@ -178,10 +178,18 @@ class Articles $articles = self::getArticlesWithOffers($options); $searchOrder = $options['ids'] ?? false ? array_flip($options['ids']->toArray()) : false; foreach ($articles as $article) { + // Skip articles without an offer/tariff/price list for the resolved sale channel + if (!isset($article->offers[0]) || ! $article->offers[0]->tariff) { + continue; + } + $price_lists = $article->offers[0]->tariff->price_lists->toArray(); if (! count($price_lists)) { continue; } + if (empty($price_lists[0]['price_list_values'][0] ?? null)) { + continue; + } if (! is_array($data[$article->name] ?? false)) { $data[$article->name] = self::getDataForSale($article); if ($searchOrder) {