diff --git a/htdocs/categories/categorie.class.php b/htdocs/categories/categorie.class.php index 51b0b76ee23..95e94660621 100644 --- a/htdocs/categories/categorie.class.php +++ b/htdocs/categories/categorie.class.php @@ -677,9 +677,9 @@ class Categorie { $cats = array (); - $sql = "SELECT c.fk_categorie, c.fk_product, p.rowid, p.label"; + $sql = "SELECT c.fk_categorie, c.fk_product, p.rowid, p.ref"; $sql.= " FROM ".MAIN_DB_PREFIX."categorie_product as c, ".MAIN_DB_PREFIX."product as p"; - $sql.= " WHERE p.label = '".$ref."' AND c.fk_product = p.rowid"; + $sql.= " WHERE p.ref = '".$ref."' AND c.fk_product = p.rowid"; $res = $this->db->query ($sql); diff --git a/htdocs/product/categorie.php b/htdocs/product/categorie.php index 55abdec5146..97fe8b3c7d2 100644 --- a/htdocs/product/categorie.php +++ b/htdocs/product/categorie.php @@ -152,11 +152,12 @@ if ($_GET["id"] || $_GET["ref"]) if ($_GET["id"]) { - $cats = $c->containing($_REQUEST['id']); + $cats = $c->containing($_REQUEST["id"]); } - else + + if ($_GET["ref"]) { - $cats = $c->containing_ref($_REQUEST['ref']); + $cats = $c->containing_ref($_REQUEST["ref"]); } if (sizeof($cats) > 0)