Foros del Web » Creando para Internet » Sistemas de gestión de contenidos » Joomla »

problemas paginador, no hace comparacion de articulos cuando se cambia de pagina

Estas en el tema de problemas paginador, no hace comparacion de articulos cuando se cambia de pagina en el foro de Joomla en Foros del Web. Buenas tardes. Tengo el siguiente problema con un paginado: Bueno les cuento, estoy utilizando el siguiente paginador y cuando trato de hacer comparaciones de productos ...
  #1 (permalink)  
Antiguo 23/10/2012, 13:11
 
Fecha de Ingreso: octubre-2012
Ubicación: Buenos Aires
Mensajes: 6
Antigüedad: 11 años, 5 meses
Puntos: 0
Pregunta problemas paginador, no hace comparacion de articulos cuando se cambia de pagina

Buenas tardes.

Tengo el siguiente problema con un paginado:

Bueno les cuento, estoy utilizando el siguiente paginador y cuando trato de hacer comparaciones de productos de paginas diferentes del paginador, estoy perdiendo los datos del equipo anterior.

Este se encuentra en una pagina diferente a la del html

<?php
defined( '_VALID_MOS' ) or die( 'Restricted access' );

/**
* Page navigation support class
* @package Joomla
*/
class customPageNav {
/** @var int The record number to start dislpaying from */
var $limitstart = null;
/** @var int Number of rows to display per page */
var $limit = null;
/** @var int Total number of rows */
var $total = null;
/** @var str group owner*/
var $group = null;

function customPageNav( $total, $limitstart, $limit, $group ) {
$this->total = (int) $total;
$this->limitstart = (int) max( $limitstart, 0 );
$this->limit = (int) max( $limit, 0 );
$this->group = $group;
}
/**
* Returns the html limit # input box
* @param string The basic link to include in the href
* @return string
*/
function getLimitBox ( $link ) {
$limits = array();
for ($i=5; $i <= 30; $i+=5) {
$limits[] = mosHTML::makeOption( "$i" );
}
$limits[] = mosHTML::makeOption( "50" );

// build the html select list
$link = $link ."&amp;limit=' + this.options[selectedIndex].value + '&amp;limitstart=". $this->limitstart;
$link = sefRelToAbs( $link );
return mosHTML::selectList( $limits, 'limit', 'class="inputbox" size="1" onchange="document.location.href=\''. $link .'\';"', 'value', 'text', $this->limit );
}
/**
* Writes the html limit # input box
* @param string The basic link to include in the href
*/
function writeLimitBox ( $link ) {
echo mosPageNav::getLimitBox( $link );
}
/**
* Writes the html for the pages counter, eg, Results 1-10 of x
*/
function writePagesCounter() {
$txt = '';
$from_result = $this->limitstart+1;
if ($this->limitstart + $this->limit < $this->total) {
$to_result = $this->limitstart + $this->limit;
} else {
$to_result = $this->total;
}
if ($this->total > 0) {
$txt .= _PN_RESULTS." $from_result - $to_result "._PN_OF." $this->total";
}
return $to_result ? $txt : '1';
}

/**
* Writes the html for the leafs counter, eg, Page 1 of x
*/
function writeLeafsCounter() {
$txt = '';
$page = ceil( ($this->limitstart + 1) / $this->limit );
if ($this->total > 0) {
$total_pages = ceil( $this->total / $this->limit );
$txt .= _PN_PAGE." $page "._PN_OF." $total_pages";
}
return $txt;
}

/**
* Writes the html links for pages, eg, previous, next, 1 2 3 ... x
* @param string The basic link to include in the href
*/
function writePagesLinks( $link ) {
$txt = '';
$displayed_pages = 10;
$total_pages = $this->limit ? ceil( $this->total / $this->limit ) : 0;
$this_page = $this->limit ? ceil( ($this->limitstart+1) / $this->limit ) : 1;
$start_loop = (floor(($this_page-1)/$displayed_pages))*$displayed_pages+1;
if ($start_loop + $displayed_pages - 1 < $total_pages) {
$stop_loop = $start_loop + $displayed_pages - 1;
} else {
$stop_loop = $total_pages;
}

$link .= '&amp;limit_'.$this->group.'='. $this->limit;

if (!defined( '_PN_LT' ) || !defined( '_PN_RT' ) ) {
DEFINE('_PN_LT','&lt;');
DEFINE('_PN_RT','&gt;');

}

$pnSpace = '';
if (_PN_LT || _PN_RT) $pnSpace = "&nbsp;";

if ($this_page > 1) {

$page = ($this_page - 2) * $this->limit;
$txt .= '<a href="'. sefRelToAbs( "$link&amp;limitstart_".$this->group."=0" ) .'" class="pagenav" title="'. _PN_START .'">'. _PN_LT . _PN_LT . $pnSpace . _PN_START .'</a> ';
$txt .= '<a href="'. sefRelToAbs( "$link&amp;limitstart_".$this->group."=$page" ) .'" class="pagenav" title="'. _PN_PREVIOUS .'">'. _PN_LT . $pnSpace . _PN_PREVIOUS .'</a> ';
} else {

$txt .= '<span class="pagenav">'. _PN_LT . _PN_LT . $pnSpace . _PN_START .'</span> ';
$txt .= '<span class="pagenav">'. _PN_LT . $pnSpace . _PN_PREVIOUS .'</span> ';
}

for ($i=$start_loop; $i <= $stop_loop; $i++) {
$page = ($i - 1) * $this->limit;
if ($i == $this_page) {
$txt .= '<span class="pagenav">'. $i .'</span> ';
} else {
$txt .= '<a href="'. sefRelToAbs( $link .'&amp;limitstart_'.$this->group.'='. $page ) .'" class="pagenav"><strong>'. $i .'</strong></a> ';
}

}

if ($this_page < $total_pages) {
$page = $this_page * $this->limit;
$end_page = ($total_pages-1) * $this->limit;
$txt .= '<a href="'. sefRelToAbs( $link .'&amp;limitstart_'.$this->group.'='. $page ) .'" class="pagenav" title="'. _PN_NEXT .'">'. _PN_NEXT . $pnSpace . _PN_RT .'</a> ';
$txt .= '<a href="'. sefRelToAbs( $link .'&amp;limitstart_'.$this->group.'='. $end_page ) .'" class="pagenav" title="'. _PN_END .'">'. _PN_END . $pnSpace . _PN_RT . _PN_RT .'</a>';
} else {
$txt .= '<span class="pagenav">'. _PN_NEXT . $pnSpace . _PN_RT .'</span> ';
$txt .= '<span class="pagenav">'. _PN_END . $pnSpace . _PN_RT . _PN_RT .'</span>';
}
return $txt;
}
/**
* Sets the vars {PAGE_LINKS}, {PAGE_LIST_OPTIONS} and {PAGE_COUNTER} for the page navigation template
* @param object The patTemplate object
* @param string The full link to be used in the nav link, eg index.php?option=com_content
* @param string The name of the template to add the variables
*/
function setTemplateVars( &$tmpl, $link = '', $name = 'admin-list-footer' ) {
$tmpl->addVar( $name, 'PAGE_LINKS', $this->writePagesLinks( $link ) );
$tmpl->addVar( $name, 'PAGE_LIST_OPTIONS', $this->getLimitBox( $link ) );
$tmpl->addVar( $name, 'PAGE_COUNTER', $this->writePagesCounter() );
}
}
?>
  #2 (permalink)  
Antiguo 23/10/2012, 13:12
 
Fecha de Ingreso: octubre-2012
Ubicación: Buenos Aires
Mensajes: 6
Antigüedad: 11 años, 5 meses
Puntos: 0
Respuesta: problemas paginador, no hace comparacion de articulos cuando se cambia de

ACA ESTA EL CODIGO HTML DONDE SE ESTA HACIENDO LA CREACION DE LOS CAMPOS


<form name="form_res_comp" method="GET" id="form_res_comp" action="index.php">
<table border="0" width="797" cellpadding="0" cellspacing="0" style="margin-bottom:10px;">
<tr>
<td width="40px" align="center" style="font-family:Arial, Helvetica, sans-serif; font-size:11px; color:#ffffff; background-color:#858585; height:30px;text-transform:uppercase; padding-left:5px; padding-right:5px;">&nbsp;</td>
<td width="60px" align="center" style="font-family:Arial, Helvetica, sans-serif; font-size:11px; color:#ffffff; background-color:#858585; height:30px;text-transform:uppercase; padding-left:5px; padding-right:5px;"><b>&nbsp;<span style="color:#86898c;"></span>Marca</b></td>
<td width="215px" align="center" style="font-family:Arial, Helvetica, sans-serif; font-size:11px; color:#ffffff; background-color:#858585; height:30px;text-transform:uppercase; padding-left:5px; padding-right:5px;"><b>&nbsp;<span style="color:#86898c;"></span>Modelo</b></td>
<td align="center" style="font-family:Arial, Helvetica, sans-serif; font-size:11px; color:#ffffff; background-color:#858585; height:30px;text-transform:uppercase; padding-left:5px; padding-right:5px;"><b>PRECIO LISTA</b></td>
<td align="center" style="font-family:Arial, Helvetica, sans-serif; font-size:11px; color:#ffffff; background-color:#858585; height:30px;text-transform:uppercase; padding-left:5px; padding-right:5px;"><b>CON FT / ABONO FIJO</b></td>
<td align="center" style="font-family:Arial, Helvetica, sans-serif; font-size:11px; color:#ffffff; background-color:#858585; height:30px;text-transform:uppercase; padding-left:5px; padding-right:5px;"><b>&nbsp;<span style="color:#86898c;"></span>CON TARJETA</b></td>
<td align="center" style="font-family:Arial, Helvetica, sans-serif; font-size:11px; color:#ffffff; background-color:#858585; height:30px;text-transform:uppercase; padding-left:5px; padding-right:5px;"><b>&nbsp;<span style="color:#86898c;"></span>Precio S/Plan</b></td>
</tr>
<?php if (count($arr_cc) >0) { ?>
<?php for ($i=0;$i<count($arr_cc); $i++) { ?>
<tr>
<td width="40px" align="center" style="background-color:#EEEEEE; border-bottom:1px solid #D9D9D9;border-left:1px solid #D9D9D9; height:30px; padding-left:5px; padding-right:5px;font-family:Arial, Helvetica, sans-serif; font-size:11px;color:#444444;"><input name="compare[]" type="checkbox" id="compare[]" value="<?php echo $arr_cc[$i]['id'];?>"></td>
<td width="60px" align="center" style="background-color:#EEEEEE; border-bottom:1px solid #D9D9D9;border-left:1px solid #D9D9D9; height:30px; padding-left:5px; padding-right:5px;font-family:Arial, Helvetica, sans-serif; font-size:11px;color:#444444;"><?php echo $arr_cc[$i]['marca']; ?></td>
<td width="215px" align="center" style="background-color:#EEEEEE; border-bottom:1px solid #D9D9D9;border-left:1px solid #D9D9D9; height:30px; padding-left:5px; padding-right:5px;font-family:Arial, Helvetica, sans-serif; font-size:11px;color:#444444; text-decoration: underline"><a href="index.php?option=com_ccequipos&task=view_det ail&idcc=<?php echo $arr_cc[$i]['id']; ?>"><?php echo $arr_cc[$i]['modelo']; ?></a></td>
<td width="85px" align="center" style="background-color:#EEEEEE; border-bottom:1px solid #D9D9D9;border-left:1px solid #D9D9D9; height:30px; padding-left:5px; padding-right:5px;font-family:Arial, Helvetica, sans-serif; font-size:11px;color:#444444;"><?php if (($arr_cc[$i]['precio_lista'] != "") && ($arr_cc[$i]['precio_lista'] != "0")) {echo "$"; echo $arr_cc[$i]['precio_lista'];} else echo "-"; ?>
<?php if (($arr_cc[$i]['precio_lista_imp'] != "") && ($arr_cc[$i]['precio_lista_imp'] != "0")) {echo " ($"; echo $arr_cc[$i]['precio_lista_imp'].")";} else echo " (-)"; ?></td>
<td width="120px" align="center" style="background-color:#EEEEEE; border-bottom:1px solid #D9D9D9; border-left:1px solid #D9D9D9;height:30px; padding-left:5px; padding-right:5px;font-family:Arial, Helvetica, sans-serif; font-size:11px;color:#444444;"><?php if (($arr_cc[$i]['precio_cont_fact'] != "") && ($arr_cc[$i]['precio_cont_fact'] != "0")) {echo "$"; echo $arr_cc[$i]['precio_cont_fact'];} else echo "-";?>
<?php if (($arr_cc[$i]['precio_cont_fact_imp'] != "") && ($arr_cc[$i]['precio_cont_fact_imp'] != "0")) {echo " ($"; echo $arr_cc[$i]['precio_cont_fact_imp'].")";} else echo " (-)"; ?></td>
<td width="85px" align="center" style="background-color:#EEEEEE; border-bottom:1px solid #D9D9D9;border-left:1px solid #D9D9D9; height:30px; padding-left:5px; padding-right:5px;font-family:Arial, Helvetica, sans-serif; font-size:11px;color:#444444;"><?php if (($arr_cc[$i]['precio_cont_tarj'] != "") && ($arr_cc[$i]['precio_cont_tarj'] != "0")) {echo "$"; echo $arr_cc[$i]['precio_cont_tarj'];} else echo "-"; ?>
<?php if (($arr_cc[$i]['precio_cont_tarj_imp'] != "") && ($arr_cc[$i]['precio_cont_tarj_imp'] != "0")) {echo " ($"; echo $arr_cc[$i]['precio_cont_tarj_imp'].")";} else echo " (-)"; ?></td>
<td align="center" style="background-color:#EEEEEE; border-bottom:1px solid #D9D9D9; border-left:1px solid #D9D9D9;border-right:1px solid #D9D9D9; height:30px; padding-left:5px; padding-right:5px;font-family:Arial, Helvetica, sans-serif; font-size:11px;color:#444444;"><?php if ($arr_cc[$i]['tiene_precio_plan'] == 1) echo "<a href=\"index.php?option=com_ccequipos&task=view_de tail&idcc=".$arr_cc[$i]['id']."#titulo_precios_plan\"><span style=\"color:#86898c; text-decoration: underline\">Ver...</span></a>"; else echo "-"; ?></td>
</tr>
<?php } ?>
<tr>
<td colspan="7" align="center" style="background-color:#E7E7E7; border-bottom:1px solid #D9D9D9;border-left:1px solid #D9D9D9; border-right:1px solid #D9D9D9; height:30px; padding-left:5px; padding-right:5px;font-family:Arial, Helvetica, sans-serif; font-size:11px;color:#444444;"><?php echo $pageNavG1->writePagesLinks( $base_link_g1 );?></td>
</tr>
<tr>
<td align="center" style="background-color:#EEEEEE; border-bottom:1px solid #D9D9D9;border-left:1px solid #D9D9D9; height:30px; padding-left:5px; font-family:Arial, Helvetica, sans-serif; font-size:11px;color:#444444;"><a href="javascript:validarChecksSeleccionados('Equip os');"><img src="customer/com_ccequipos/comparar.jpg" width="70" height="20" border="0" /></a></td>
<td colspan="6" align="right" style="background-color:#EEEEEE; border-bottom:1px solid #D9D9D9;border-right:1px solid #D9D9D9; height:30px; padding-left:5px; padding-right:5px;font-family:Arial, Helvetica, sans-serif; font-size:11px;color:#444444;"><?php echo $pageNavG1->writePagesCounter();?></td>
</tr>
<?php } else { ?>
<tr>
<td colspan="7" style="color:#FE116D; font-size:13px; background-color:#EEEEEE; height:50px; padding-left:5px; padding-right:5px;font-family:Arial, Helvetica, sans-serif; border-bottom:1px solid #D9D9D9;border-right:1px solid #D9D9D9; border-left:1px solid #D9D9D9;" align="center"><b>&nbsp;No se encontraron coincidencias.</b></td>
</tr>
<?php } ?>
</table>
<input type="hidden" name="option" value="com_ccequipos"/>
<input type="hidden" name="task" value="compare" />
</form>



ADICIONAL A ESTO SE USA UN JQUERY PARA CREAR LA PAGINACION Y LA BUSQUEDA, POR LO CUAL NO SE DONDE ESTA PINCHANDO.
EL CODIGO JQUERY ES EL SIGUIENTE

function validarChecksSeleccionados(tipo){

var x = document.body.getElementsByTagName('INPUT');
var oInput;
var myInput;
var contador = 0;
var resultado = true;
//alert(x.length);

for(i=0; i < x.length; i++) {
oInput = x[i];
if(oInput.type == 'checkbox') {
if (oInput.name != 'empresas_filter')
{
myInput = oInput;
if(myInput.checked == true) {
contador++;
}
}
}
}

if(contador < 2){
alert('Debe seleccionar por lo menos 2 ' + tipo);

}
else
{
if(contador > 3){
alert('Solo se pueden comparar hasta 3 ' + tipo);

}
else
document.form_res_comp.submit();
}

}

Si alguien me puede ayudar con esto se lo agradeceré toda la vida.

Saludos

Etiquetas: articulos, comparacion, html, paginador, variables, cambios
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 19:06.