Filtre sur les catégories

This commit is contained in:
Rodolphe Quiedeville 2005-04-13 14:47:41 +00:00
parent b36825d730
commit af19981bf2

View File

@ -58,6 +58,12 @@ if ($_POST["button_removefilter"] == $langs->trans("RemoveFilter")) {
$snom=""; $snom="";
} }
if (strlen($_REQUEST['catid']) == 0)
{
$_REQUEST['catid'] = 1;
}
$catid = $_REQUEST['catid'];
/* /*
* Mode Liste * Mode Liste
* *
@ -74,6 +80,11 @@ if ($_GET["fourn_id"] > 0)
$sql .= ", ".MAIN_DB_PREFIX."product_fournisseur as pf"; $sql .= ", ".MAIN_DB_PREFIX."product_fournisseur as pf";
} }
if ($catid)
{
$sql .= ", ".MAIN_DB_PREFIX."categorie_product as cp";
}
if ($_POST["mode"] == 'search') if ($_POST["mode"] == 'search')
{ {
$sql .= " WHERE p.ref like '%".$_POST["sall"]."%'"; $sql .= " WHERE p.ref like '%".$_POST["sall"]."%'";
@ -94,6 +105,11 @@ else
{ {
$sql .= " AND p.label like '%".$snom."%'"; $sql .= " AND p.label like '%".$snom."%'";
} }
if($catid)
{
$sql .= " AND cp.fk_product = p.rowid";
$sql .= " AND cp.fk_categorie = ".$catid;
}
} }
@ -136,12 +152,8 @@ if ($result)
* *
* *
*/ */
if (strlen($_REQUEST['catid']) == 0)
{
$_REQUEST['catid'] = 1;
}
$c = new Categorie ($db, $_REQUEST['catid']); $c = new Categorie ($db, $catid);
$ways = $c->print_all_ways(' > ','fourn/product/liste.php'); $ways = $c->print_all_ways(' > ','fourn/product/liste.php');
print "<div id='ways'>"; print "<div id='ways'>";