File: /home/nexper/public_html/php/modules/productos.php
<!--best start -->
<div id="best">
<?php
$sb = @$_GET['sec'];
$catid = @$_GET['pcat'];
$modalidad = @$_GET['modalidad'];
if (!empty($modalidad)) {
$qmod = " AND p.modalidad = '".$modalidad."' ";
} else {
$qmod = " ";
}
//---cheq subsecciones
//$cheq_sub = mk_subcat_menu($catid, 0);
if ($cheq_sub == "" || empty($cheq_sub)) {
//---
//--DB checkout
$chkdb = mysql_query("SELECT id FROM producto WHERE categoriaID = '".$catid."' LIMIT 1") or die(mysql_error());
if (!(mysql_num_rows($chkdb) > 0)) {
echo "<h2>No hay Propiedades ingresadas en esta sección!</h2>";
echo "<p align='center' class='bestTxt'><b>Estamos trabajando para usted...<br>Actualizando sitio web.</b></p>";
} else {
//--
$nomcat = getcat($catid);
$lm = @$_GET['lmt']; //valor actual del indice
$b_limit = @$_POST['cntp'];
if (empty($b_limit) || $b_limit == 0) {
$b_limit = @$_GET['tt'];
if (empty($b_limit) || $b_limit == 0) {
$b_limit = 50; //cantidad de productos por pagina
}
}
if (empty($catid)) {
$catvalue = "p.categoriaID LIKE '%'";
} else {
$catvalue = "p.categoriaID = '".$catid."'";
}
$valor = "%";
$orden = "ASC";
if (empty($lm)) {
$lm = 0;
}
$l_sig = $lm + $b_limit;
$l_atras = $lm - $b_limit;
$query = "SELECT p.id as pid,".
" p.valor as precio,".
" p.fechaing as fechai,".
" p.createdby as creador,".
" p.fechamod as fecham,".
" p.descripcion as des,".
" p.amoblada as amob,".
" t.tipo as modalidad,".
" p.sector as sector,".
" c.ciudad as ciudad ".
"FROM producto AS p ".
//"LEFT JOIN sector as s ON (s.id = p.sectorID)".
"LEFT JOIN ciudad as c ON (c.id = p.ciudadID)".
"LEFT JOIN tipocat as t ON (t.id = p.modalidad)".
"WHERE ".$catvalue.
" AND (LOWER(p.descripcion LIKE '".$valor."')) AND p.disabled = '0'".$qmod.
"ORDER BY p.id ".$orden." LIMIT ".$lm.", ".$b_limit;
$result = mysql_query($query) or die(mysql_error());
if (mysql_num_rows($result) > $b_limit || mysql_num_rows($result) == $b_limit) {
$delante = ' <a href="?sec='.$sb.'&lmt='.$l_sig.'&pcat='.$catid.'&tt='.$b_limit.'" onFocus=this.className="focus" onBlur=this.className="">Siguiente>></a>';
} else {
$delante = "";
}
if ($l_atras < 0) {
$atras = "";
} else {
$atras = '<a href="?sec='.$sb.'&lmt='.$l_atras.'&pcat='.$catid.'&tt='.$b_limit.'" onFocus=this.className="focus" onBlur=this.className=""><< Atras</a> ';
}
$cols = 4;
$xcols = 1;
echo '<table width="700" align="center" border="0" cellspacing="0" cellpadding="0" id="contenido">'.
'<tr>'.
'<td colspan="'.$cols.'" align="left" class="title" valign="top" height="25"><h2>'.$nomcat.'</h2><div align="right">'.$atras.$delante.'</div></td></tr>'.
'<tr>'.
'<td colspan="'.$cols.'" align="left" valign="top">';
while ($cant = mysql_fetch_assoc($result)) {
$nom_url = $cant{'modalidad'};
$image_c = getProdImg($cant{'pid'}, $prod_path, 150, 150, 'link');
if ($cant{'precio'} == 0 || empty($cant{'precio'})) {
$precio = "Consulte Precio";
} else {
$precio = "<b>Precio $ ".number_format($cant{'precio'}, 0, ',', '.')."</b>";
}
echo '<div style="position:relative; margin:auto; display:inline-block; padding:0px; width:175px; height:250px; background:url(images/item_bg.png); background-position:top right; text-align:center;">'.
'<div style="position:absolute; top:2px; width:175px; height:20px; text-align:center;">'.
'<p class="bestTxt2"><a href="?sec=3&idp='.$cant{'pid'}.'" target="_self">'.item_name($nom_url).'</a></p></div>'.
'<div style="position:absolute; top:42px; width:175px; height:80px; text-align:center;"><a href="?sec=3&idp='.$cant{'pid'}.'" target="_self">'.$image_c.'</a></div>'.
'<div style="position:absolute; top:200px; width:175px; height:20px; text-align:center;"><p class="bestTxt">'.$cant{'ciudad'}.'</p></div>'.
'<div style="position:absolute; top:225px; width:175px; height:20px; text-align:center;"><p class="bestTxt2">'.$precio.'</p></div>'.
'</div>';
}
echo '</td></tr>'.
'</table>';
}
}
echo '<br><br><p align="center"><input type="button" name="cancel" id="cancel" value="Volver" class="inputButton" onClick="javascript:history.go(-1)"></p><br>';
?>
</div>
<!--best end -->