Corrección de visibilidad y diseño en la tabla de productos duplicados. Mejora global en el sistema de paginación y optimización de anchos de tabla.

This commit is contained in:
2026-01-09 16:55:08 -06:00
parent cea1423109
commit 6839e0efd2
6 changed files with 72 additions and 83 deletions

View File

@@ -262,73 +262,57 @@ class Util extends SystemError
}
}
function HandleMultipages($page, $total_pages, $link, $pagevar, $limit = 5)
function HandleMultipages($page, $total_items, $link, $pagevar = "p", $limit = 5)
{
$items_per_page = defined('ITEMS_PER_PAGE') ? ITEMS_PER_PAGE : 20;
$total_pages = ceil($total_items / $items_per_page);
$pages = array();
$pages["numbers"] = array();
$pages["first"] = false;
$pages["prev"] = false;
$pages["next"] = false;
$pages["last"] = false;
if($page == 0)
$page == 0;
if($page > 0){
if(!$this->hs_eregi("\|$pagevar\|",$link))
$pages["first"] = $link."/".$pagevar."/0";
else
$pages["first"] = $this->hs_preg_replace("\|$pagevar\|","0",$link);
}
if($page > 0){
if(!$this->hs_eregi("\|$pagevar\|",$link))
$pages["prev"] = $link."/".$pagevar."/".($page-1);
else
$pages["prev"] = $this->hs_preg_replace("\|$pagevar\|",(string)($page-1),$link);
}
for($i = ($page - $limit); $i < $page; $i++)
{
if($i >= 0)
{
if(!$this->hs_eregi("\|$pagevar\|",$link))
$pages["numbers"][$i] = $link."/".$pagevar."/".$i;
else
$pages["numbers"][$i] = $this->hs_preg_replace("\|$pagevar\|",(string)($i),$link);
}
}
$pages[$page] = $link."/".$pagevar."/".$page;
for($i = ($page + 1); $i <= ($page + $limit); $i++)
// Lógica simple de reemplazo o concatenación
$hasPlaceholder = (strpos($link, "|$pagevar|") !== false);
if($page > 0){
if(!$hasPlaceholder)
$pages["first"] = $link."/".$pagevar."/0";
else
$pages["first"] = str_replace("|$pagevar|", "0", $link);
if(!$hasPlaceholder)
$pages["prev"] = $link."/".$pagevar."/".($page-1);
else
$pages["prev"] = str_replace("|$pagevar|", (string)($page-1), $link);
}
for($i = ($page - $limit); $i <= ($page + $limit); $i++)
{
if($i <= $total_pages)
if($i >= 0 && $i < $total_pages)
{
if(!$this->hs_eregi("\|$pagevar\|",$link))
$pages["numbers"][$i] = $link."/".$pagevar."/".$i;
if(!$hasPlaceholder)
$pages["numbers"][$i + 1] = $link."/".$pagevar."/".$i;
else
$pages["numbers"][$i] = $this->hs_preg_replace("\|$pagevar\|",(string)($i),$link);
$pages["numbers"][$i + 1] = str_replace("|$pagevar|", (string)($i), $link);
}
}
if($page < $total_pages){
if(!$this->hs_eregi("\|$pagevar\|",$link))
$pages["next"] = $link."/".$pagevar."/".($page+1);
if($page < $total_pages - 1){
if(!$hasPlaceholder)
$pages["next"] = $link."/".$pagevar."/".($page+1);
else
$pages["next"] = $this->hs_preg_replace("\|$pagevar\|",(string)($page+1),$link);
}
if($page > 0){
if(!$this->hs_eregi("\|$pagevar\|",$link))
$pages["last"] = $link."/".$pagevar."/".$total_pages;
$pages["next"] = str_replace("|$pagevar|", (string)($page+1), $link);
if(!$hasPlaceholder)
$pages["last"] = $link."/".$pagevar."/".(max(0, $total_pages - 1));
else
$pages["last"] = $this->hs_preg_replace("\|$pagevar\|",(string)($total_pages),$link);
$pages["last"] = str_replace("|$pagevar|", (string)(max(0, $total_pages - 1)), $link);
}
$pages["current"] = $page+1;
$items_per_page = defined('ITEMS_PER_PAGE') ? ITEMS_PER_PAGE : 20;
$pages["items_per_page"] = $items_per_page;
$pages["start"] = $page * $items_per_page;