Ver Mensaje Individual
  #5 (permalink)  
Antiguo 04/02/2009, 08:30
Avatar de b0zZy
b0zZy
 
Fecha de Ingreso: enero-2009
Ubicación: Francia
Mensajes: 28
Antigüedad: 15 años, 4 meses
Puntos: 0
Respuesta: Productos en Multiples Categorias

Hola Quim,
Parece que si me sigues perfectamente !! Pero ahora el que no sigue soy yo.
Mira este es el product-functions.php
Código PHP:
function getProductDetail($pdId$catId)
{
    
    
$_SESSION['shoppingReturnUrl'] = $_SERVER['REQUEST_URI'];
    
    
// get the product information from database
    
$sql ="SELECT * FROM tbl_product
INNER JOIN tbl_category
ON tbl_product.cat_id = tbl_category.cat_id
WHERE pd_id = $pdId"
;

    
$result dbQuery($sql);
    
$row    dbFetchAssoc($result);
    
extract($row);
    
    
$row['pd_descriptif'] = nl2br($row['pd_descriptif']);
    
    if (
$row['pd_image']) {
        
$row['pd_image'] = WEB_ROOT 'images/product/' $row['pd_image'];
    } else {
        
$row['pd_image'] = WEB_ROOT 'images/Aucune image dispo.jpg';
    }
    
    
$row['cart_url'] = "cart.php?action=add&p=$pdId";
    
    return 
$row;            
}



?> 
y este mi productlist.php
Código PHP:
<?php
//$productList    = getProductList($catId);
$children array_merge(array($catId), getChildCategories(NULL$catId));
$children ' (' implode(', '$children) . ')';

$sql "SELECT pd_id, pd_auteur, pd_titre, pd_editeur, cat_name, pd_isbn, pd_descriptif, pd_price, pd_etat, pd_thumbnail, pd_qty, c.cat_id, c.cat_name
        FROM tbl_product pd, tbl_category c
        WHERE pd.cat_id = c.cat_id AND pd.cat_id IN $children 
        ORDER BY pd_titre ASC"
;
$result     dbQuery(getPagingQuery($sql$productsPerPage));
$pagingLink getPagingLink($sql$productsPerPage"c=$catId");
$numProduct dbNumRows($result);

// the product images are arranged in a table. to make sure
// each image gets equal space set the cell width here
$columnWidth = (int)(100 $productsPerRow);?>
<script src="library/sorttable.js"></script>
<link href="shop.css" rel="stylesheet" type="text/css" />
<link href="../admin/include/admin.css" rel="stylesheet" type="text/css" />

<style type="text/css">
<!--
.Estilo9 {
    color: #CCCCCC;
    font-weight: bold;
}
-->
</style>
<table border="1" align="center" bordercolor="#800000" class="sortable">
<!--Table Head -->
<thead>
<tr bgcolor="#800000">
<th height="31" class="Estilo9">Titre(s)</th>
<th class="Estilo9">Auteur(s)</th>
<th class="Estilo9">Image</th>
<th class="Estilo9">Prix/&Eacute;tat</th>
</tr>
</thead>

  <?php 
if ($numProduct ) {

    
$i 0;
    while (
$row dbFetchAssoc($result)) {
        
extract($row);
        if (
$pd_thumbnail) {
            
$pd_thumbnail WEB_ROOT 'images/product/' $pd_thumbnail;
        } else {
            
$pd_thumbnail WEB_ROOT 'images/Aucune image dispo.jpg';
        }
    
        if (
$i $productsPerRow == 0) {
            echo 
'<tr>';
        }

        
// format how we display the price
        
$pd_price displayAmount($pd_price);
        
        echo 
"<td width=\"50%\" align=\"center\"><a href=\"" $_SERVER['PHP_SELF'] . "?c=$catId&p=$pd_id" "\">$pd_titre
        <td with=\"10%\"align=\"center\"><a href=\"" 
$_SERVER['PHP_SELF'] . "?c=$catId&p=$pd_id" "\">$pd_auteur
        <td width=\"10%\" align=\"center\"><a href=\"" 
$_SERVER['PHP_SELF'] . "?c=$catId&p=$pd_id" "\"><img src=\"$pd_thumbnail\" border=\"0\" align=\"absmiddle\">
        <td width=\"10%\" align=\"center\"><br>$pd_price"
?>&nbsp;€<br />
<?php echo "$pd_etat"?>
<?php
        
// if the product is no longer in stock, tell the customer
        
if ($pd_qty <= 0) {
            echo 
"<br><u>Pas Disponible";
        }
        
        echo 
"</td>\r\n";
    
        if (
$i $productsPerRow == $productsPerRow 1) {
            echo 
'</tr>';
        }
        
        
$i += 1;
    }
    
    if (
$i $productsPerRow 0) {
        echo 
'<td colspan="' . ($productsPerRow - ($i $productsPerRow)) . '">&nbsp;</td>';
    }
    
} else {
?>
<tr>
    <td height="31" colspan="5" align="center">
      <span class="errorMessage">Aucune</span> 
      <?php    
}    
?>
</table>
<p align="center"><?php echo $pagingLink?></p>
<p align="center"><span style="width:500px">
  <input name="retour" type="submit" class="bluebox" id="retour" onclick="window.history.back();" value="Retour" />
</span></p>
Como lo puedo poner para que quando un usuario en la web elija una categoria, salgan todos los resultados de esa categoria. No se si es donde lo tengo mal pero yo guardo las categorias de los productos en la tbl_product como cat_id, cat_id2 y cat_id3.
Por ejemplo, tengo un livro X con las categorias A, B y C, la A es cat_id, la B es cat_id2 y la C es cat_id3.
Si voy a la categoria A esta el livro X bien, pero si lo busco en las categorias B o C, no me aparece.
A ver si me echas un cable que esto me tiene amargao .

Última edición por b0zZy; 04/02/2009 a las 08:59