From c616072d6c6fbf730a3a4fa7206c7323482881e8 Mon Sep 17 00:00:00 2001 From: nickpons666 Date: Wed, 7 Jan 2026 23:01:55 -0600 Subject: [PATCH] Fix undefined variable $pages in Search() function - move initialization Moved $pages array initialization outside of if/else block to prevent undefined variable warning when search returns results (if block executes). $pages is now initialized before the conditional logic. --- classes/producto.class.php | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/classes/producto.class.php b/classes/producto.class.php index 5d68555..aef78e8 100755 --- a/classes/producto.class.php +++ b/classes/producto.class.php @@ -665,6 +665,17 @@ class Producto extends Main $sqlAdd = ''; + $pages = array( + 'numbers' => array(), + 'first' => false, + 'prev' => false, + 'next' => false, + 'last' => false, + 'current' => 1, + 'items_per_page' => defined('ITEMS_PER_PAGE') ? ITEMS_PER_PAGE : 20, + 'start' => 0 + ); + if($this->noProveedor) $sqlAdd .= ' AND prov.noProv = "'.$this->noProveedor.'"'; @@ -699,16 +710,6 @@ class Producto extends Main }else{ $result = array(); - $pages = array( - 'numbers' => array(), - 'first' => false, - 'prev' => false, - 'next' => false, - 'last' => false, - 'current' => 1, - 'items_per_page' => defined('ITEMS_PER_PAGE') ? ITEMS_PER_PAGE : 20, - 'start' => 0 - ); } $data["items"] = $result;