diff --git a/htdocs/variants/admin/admin.php b/htdocs/variants/admin/admin.php
index eedacb086b3..f3752469538 100644
--- a/htdocs/variants/admin/admin.php
+++ b/htdocs/variants/admin/admin.php
@@ -37,6 +37,12 @@ if ($_POST) {
setEventMessage($langs->trans('CoreErrorMessage'), 'errors');
}
+ if (dolibarr_set_const($db, 'PRODUIT_ATTRIBUTES_SEPARATOR', GETPOST('PRODUIT_ATTRIBUTES_SEPARATOR'), 'chaine', 0, '', $conf->entity)) {
+ setEventMessage($langs->trans('RecordSaved'));
+ } else {
+ setEventMessage($langs->trans('CoreErrorMessage'), 'errors');
+ }
+
}
$title = $langs->trans('ModuleSetup').' '.$langs->trans('ProductAttributes');
@@ -55,6 +61,13 @@ print '
'.$langs->trans("Value").' | '."\n";
print ' | '."\n";
print '| '.$langs->trans('HideProductCombinations').' | ';
print $form->selectyesno("PRODUIT_ATTRIBUTES_HIDECHILD",$conf->global->PRODUIT_ATTRIBUTES_HIDECHILD,1).' |
';
+print '| '.$langs->trans('CombinationsSeparator').' | ';
+if(isset($conf->global->PRODUIT_ATTRIBUTES_SEPARATOR)) {
+ $separator = $conf->global->PRODUIT_ATTRIBUTES_SEPARATOR;
+} else {
+ $separator = "_";
+}
+print ' | |
';
print '';
print '
';
print '';
diff --git a/htdocs/variants/class/ProductCombination.class.php b/htdocs/variants/class/ProductCombination.class.php
index d3e6964aea6..04b987192e1 100644
--- a/htdocs/variants/class/ProductCombination.class.php
+++ b/htdocs/variants/class/ProductCombination.class.php
@@ -476,7 +476,7 @@ WHERE c.fk_product_parent = ".(int) $productid." AND p.tosell = 1";
*/
public function createProductCombination(Product $product, array $combinations, array $variations, $price_var_percent = false, $forced_pricevar = false, $forced_weightvar = false)
{
- global $db, $user;
+ global $db, $user, $conf;
require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductAttribute.class.php';
require_once DOL_DOCUMENT_ROOT.'/variants/class/ProductAttributeValue.class.php';
@@ -542,7 +542,11 @@ WHERE c.fk_product_parent = ".(int) $productid." AND p.tosell = 1";
$price_impact += (float) price2num($variations[$currcombattr][$currcombval]['price']);
}
- $newproduct->ref .= '_'.$prodattrval->ref;
+ if (isset($conf->global->PRODUIT_ATTRIBUTES_SEPARATOR)) {
+ $newproduct->ref .= $conf->global->PRODUIT_ATTRIBUTES_SEPARATOR . $prodattrval->ref;
+ } else {
+ $newproduct->ref .= '_'.$prodattrval->ref;
+ }
//The first one should not contain a linebreak
if ($newproduct->description) {
@@ -660,4 +664,4 @@ WHERE c.fk_product_parent = ".(int) $productid." AND p.tosell = 1";
return 1;
}
-}
\ No newline at end of file
+}