New: works with variants:
- Hide child products into list if PRODUIT_ATTRIBUTES_HIDECHILD is activated
This commit is contained in:
parent
2ef0e95586
commit
58be4ac7a3
@ -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";
|
$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').')';
|
$sql.= ' WHERE p.entity IN ('.getEntity('product').')';
|
||||||
if ($sall) $sql .= natural_search(array_keys($fieldstosearchall), $sall);
|
if ($sall) $sql .= natural_search(array_keys($fieldstosearchall), $sall);
|
||||||
// if the type is not 1, we show all products (type = 0,2,3)
|
// 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";
|
if ($search_type == 1) $sql.= " AND p.fk_product_type = 1";
|
||||||
else $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_ref) $sql .= natural_search('p.ref', $search_ref);
|
||||||
if ($search_label) $sql .= natural_search('p.label', $search_label);
|
if ($search_label) $sql .= natural_search('p.label', $search_label);
|
||||||
if ($search_barcode) $sql .= natural_search('p.barcode', $search_barcode);
|
if ($search_barcode) $sql .= natural_search('p.barcode', $search_barcode);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user