From 243697a0548ca2c90e97e8e67c3f4df0e91a5113 Mon Sep 17 00:00:00 2001 From: Aldarien Date: Fri, 29 May 2020 20:18:19 -0400 Subject: [PATCH] FIX: se asignaban indices para destacados.json --- src/Producto.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Producto.php b/src/Producto.php index 444cb1c..69da489 100644 --- a/src/Producto.php +++ b/src/Producto.php @@ -189,6 +189,8 @@ class Producto extends Model { unset($destacados[$i]); } } + sort($destacados); + file_put_contents($filename, json_encode($destacados)); foreach ($this->imagenes() as $imagen) { $this->deleteImagen($imagen); } @@ -221,11 +223,13 @@ class Producto extends Model { } if (!$found) { $destacados []= $this->id; - sort($destacados); $changed = true; } } - file_put_contents($filename, json_encode($destacados)); + if ($changed) { + sort($destacados); + file_put_contents($filename, json_encode($destacados)); + } } }