diff --git a/addons/sale_product_configurator/static/src/js/product_configurator_modal.js b/addons/sale_product_configurator/static/src/js/product_configurator_modal.js index 0be980b9ac0..b495100abe7 100644 --- a/addons/sale_product_configurator/static/src/js/product_configurator_modal.js +++ b/addons/sale_product_configurator/static/src/js/product_configurator_modal.js @@ -223,20 +223,27 @@ var OptionalProductsModal = Dialog.extend(ServicesMixin, VariantMixin, { this.rootProduct.no_variant_attribute_values)) { var $productDescription = $modalContent .find('.main_product') - .find('td.td-product_name div.text-muted.small'); - var description = $productDescription.html(); + .find('td.td-product_name div.text-muted.small > div:first'); + var $updatedDescription = $('
'); + $updatedDescription.append($('

', { + text: $productDescription.text() + })); - $.each(this.rootProduct.product_custom_attribute_values, function () { - description += '
' + this.attribute_value_name + ': ' + this.custom_value; + $.each(this.rootProduct.product_custom_attribute_values, function (){ + $updatedDescription.append($('

', { + text: this.attribute_value_name + ': ' + this.custom_value + })); }); - $.each(this.rootProduct.no_variant_attribute_values, function () { - if (this.is_custom !== 'True') { - description += '
' + this.attribute_name + ': ' + this.attribute_value_name; + $.each(this.rootProduct.no_variant_attribute_values, function (){ + if (this.is_custom !== 'True'){ + $updatedDescription.append($('
', { + text: this.attribute_name + ': ' + this.attribute_value_name + })); } }); - $productDescription.html(description); + $productDescription.replaceWith($updatedDescription); } return $modalContent; @@ -314,20 +321,25 @@ var OptionalProductsModal = Dialog.extend(ServicesMixin, VariantMixin, { var $productDescription = $parent .find('td.td-product_name div.float-left'); - var description = ''; - $.each(productCustomVariantValues, function () { - description += '
' + this.attribute_value_name + ': ' + this.custom_value; - }); - - $.each(noVariantAttributeValues, function () { - if (this.is_custom !== 'True') { - description += '
' + this.attribute_name + ': ' + this.attribute_value_name; - } - }); - var $customAttributeValuesDescription = $('
', { - class: 'custom_attribute_values_description text-muted small', - html: description + class: 'custom_attribute_values_description text-muted small' + }); + if (productCustomVariantValues.length !== 0 || noVariantAttributeValues.length !== 0) { + $customAttributeValuesDescription.append($('
')); + } + + $.each(productCustomVariantValues, function (){ + $customAttributeValuesDescription.append($('
', { + text: this.attribute_value_name + ': ' + this.custom_value + })); + }); + + $.each(noVariantAttributeValues, function (){ + if (this.is_custom !== 'True'){ + $customAttributeValuesDescription.append($('
', { + text: this.attribute_name + ': ' + this.attribute_value_name + })); + } }); $productDescription.append($customAttributeValuesDescription);