From 58be4ac7a32836d28d7a1df033ba57f02225ebda Mon Sep 17 00:00:00 2001 From: Juanjo Menent Date: Thu, 11 Oct 2018 12:36:10 +0200 Subject: [PATCH] New: works with variants: - Hide child products into list if PRODUIT_ATTRIBUTES_HIDECHILD is activated --- htdocs/product/list.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/htdocs/product/list.php b/htdocs/product/list.php index 28f08035198..720ef957c01 100644 --- a/htdocs/product/list.php +++ b/htdocs/product/list.php @@ -286,6 +286,11 @@ if (!empty($conf->variants->enabled) && $search_hidechildproducts && ($search_ty $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_attribute_combination pac ON pac.fk_product_child = p.rowid"; } +if (!empty($conf->global->PRODUIT_ATTRIBUTES_HIDECHILD)) { + $sql .= " LEFT JOIN ".MAIN_DB_PREFIX."product_attribute_combination pac ON pac.fk_product_child = p.rowid"; +} + + $sql.= ' WHERE p.entity IN ('.getEntity('product').')'; if ($sall) $sql .= natural_search(array_keys($fieldstosearchall), $sall); // if the type is not 1, we show all products (type = 0,2,3) @@ -294,6 +299,11 @@ if (dol_strlen($search_type) && $search_type != '-1') if ($search_type == 1) $sql.= " AND p.fk_product_type = 1"; else $sql.= " AND p.fk_product_type <> 1"; } + +if (!empty($conf->global->PRODUIT_ATTRIBUTES_HIDECHILD)) { + $sql .= " AND pac.rowid IS NULL"; +} + if ($search_ref) $sql .= natural_search('p.ref', $search_ref); if ($search_label) $sql .= natural_search('p.label', $search_label); if ($search_barcode) $sql .= natural_search('p.barcode', $search_barcode);