diff --git a/htdocs/fourn/product/liste.php b/htdocs/fourn/product/liste.php index 77e597bfe70..28c355b5655 100644 --- a/htdocs/fourn/product/liste.php +++ b/htdocs/fourn/product/liste.php @@ -58,6 +58,12 @@ if ($_POST["button_removefilter"] == $langs->trans("RemoveFilter")) { $snom=""; } +if (strlen($_REQUEST['catid']) == 0) +{ + $_REQUEST['catid'] = 1; +} +$catid = $_REQUEST['catid']; + /* * Mode Liste * @@ -74,6 +80,11 @@ if ($_GET["fourn_id"] > 0) $sql .= ", ".MAIN_DB_PREFIX."product_fournisseur as pf"; } +if ($catid) +{ + $sql .= ", ".MAIN_DB_PREFIX."categorie_product as cp"; +} + if ($_POST["mode"] == 'search') { $sql .= " WHERE p.ref like '%".$_POST["sall"]."%'"; @@ -94,6 +105,11 @@ else { $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'); print "