hola gente, bueno miren comparto con ustedes un codigo que hice y que funcina a medias... proque hace lo que tiene que hacer, pero lamentablemente al fina de la pagina me repite la pagina principal y no logro sacarla... alguien sabe como hacerlo???
esta es la web...
[URL="http://www.nickhard.com.ar/index.php?_a=listado_productos"]http://www.nickhard.com.ar/index.php?_a=listado_productos[/URL]
Código PHP:
<style type="text/css">
.style1 {
background-color: #000000;
color: #FF0000;
font-weight: bold;
font-size: small
border-color: #FF0000;
text-decoration: none;
border-width: 1px;
}
.style2 {
background-color: #FFFFE1;
color: #000000;
font-weight: normal;
font-size: small
border-color: #000000;
border-width: 1px;
text-decoration: none;
}
A {text-decoration: none;}
a {
color: #000000;
}
a:visited {
color: #000000;
}
a:hover {
color: #FF0000;
}
.styleTabla {
text-decoration: none;
border-color: #000000;
border-width: 1px;
}
</style>
<?php
$query = "SELECT productId, ".$glob['dbprefix']."CubeCart_inventory.cat_id, name, cat_name, price, sale_price, useStockLevel, stock_level, productCode FROM ".$glob['dbprefix']."CubeCart_inventory INNER JOIN ".$glob['dbprefix']."CubeCart_category ON ".$glob['dbprefix']."CubeCart_inventory.cat_id = ".$glob['dbprefix']."CubeCart_category.cat_id ORDER BY cat_name ASC, price ASC, name ASC";
$products = $db->select($query);
$simbolo = " uSs";
echo "<div style=\"background-color: #000000; color: #FFFFFF; font-weight: bold; font-size: large\"> LISTADO EN MODO PRUEBA - HACIENDO PRUEBAS</div>";
//////////////////////////////////////////////////////
echo "<table class=\"style1\" style=\"width: 100%\" border=\"1\" id=\"Exportar_a_Excel\">";
for ($i=0; $i<count($products); $i++){
if($products[$i]['cat_id']!==$products[$i-1]['cat_id']){
echo "<tr bgcolor=\"#FFFFE1\">";
echo "<td class=\"style1\" style=\"font-size: small;\">".$products[$i]['cat_name']."</td>";
echo "<td class=\"style1\" style=\"font-size: small;\">Precio".$simbolo."</td>";
echo "<td class=\"style1\" style=\"font-size: small;\">stock</td>";
echo "</tr>";
}
if($products[$i]['stock_level']=="0"){
} elseif($products[$i]['stock_level']>="1"){
echo "<tr style=\"font-size: small; font-weight: normal; font-family: Arial, Helvetica, sans-serif;\">";
echo "<td class=\"style2\" style=\"font-size: small; font-weight: normal; font-family: Arial, Helvetica, sans-serif;\"><a target=\"_blank\" href=\"index.php?_a=viewProd&productId=".$products[$i]['productId']."\">".substr(strip_tags($products[$i]['name']), 0, 125)."..."."</a></td>";
if($products[$i]['price']<=$products[$i]['sale_price']){
echo "<td class=\"style2\" style=\"font-size: small; font-weight: normal; font-family: Arial, Helvetica, sans-serif;\">".$simbolo." ".$products[$i]['price']."</td>"; // FILA PRECIO
echo "<td class=\"style2\" style=\"font-size: small; font-weight: normal; font-family: Arial, Helvetica, sans-serif;\">".$products[$i]['stock_level']."</td>"; // FILA STOCK
} elseif($products[$i]['sale_price']=="0.00"){
echo "<td class=\"style2\" style=\"font-size: small; font-weight: normal; font-family: Arial, Helvetica, sans-serif;\">".$simbolo." ".$products[$i]['price']."</td>"; // FILA PRECIO
echo "<td class=\"style2\" style=\"font-size: small; font-weight: normal; font-family: Arial, Helvetica, sans-serif;\">".$products[$i]['stock_level']."</td>"; // FILA STOCK
}else{
echo "<td class=\"style2\" style=\"font-size: small; font-weight: normal; font-family: Arial, Helvetica, sans-serif;\">".$simbolo." ".$products[$i]['sale_price']."</td>"; // FILA PRICE
echo "<td class=\"style2\" style=\"font-size: small; font-weight: normal; font-family: Arial, Helvetica, sans-serif;\">".$products[$i]['stock_level']."</td>"; // FILA STOCK
}
}
echo "</tr>";
}
echo "</table>";
?>