[IMP] *_product_configurator: improve optional products naming
Task #1891970 Purpose ======= The name of the optional products displayed in the modal now change dynamically based on the selected variants configuration. You do not have to wait until the product is in the cart to see the full name anymore. Ex: Conference Chair -> Conference Chair (Steel)
This commit is contained in:
@@ -6,7 +6,6 @@ var Dialog = require('web.Dialog');
|
||||
var ServicesMixin = require('web.ServicesMixin');
|
||||
var VariantMixin = require('sale.VariantMixin');
|
||||
|
||||
var productNameMap = {};
|
||||
var optionalProductsMap = {};
|
||||
|
||||
var OptionalProductsModal = Dialog.extend(ServicesMixin, VariantMixin, {
|
||||
@@ -63,7 +62,6 @@ var OptionalProductsModal = Dialog.extend(ServicesMixin, VariantMixin, {
|
||||
this._productImageField = 'image_medium';
|
||||
|
||||
// reset any previously populated properties maps
|
||||
productNameMap = {};
|
||||
optionalProductsMap = {};
|
||||
|
||||
this._opened.then(function () {
|
||||
@@ -303,11 +301,6 @@ var OptionalProductsModal = Dialog.extend(ServicesMixin, VariantMixin, {
|
||||
$parent.find('.td-qty').addClass('text-center');
|
||||
$parent.find('.td-qty').append($parent.find('.optional_product_quantity'));
|
||||
|
||||
// change product name to display_name (containing attribute values) when it's added to cart
|
||||
// the "simple" name is kept into a map to revert to it if the product is removed from the cart
|
||||
productNameMap[productTemplateId] = $parent.find(".product-name").html();
|
||||
$parent.find(".product-name").html($parent.find(".product_display_name").val());
|
||||
|
||||
var productCustomVariantValues = self.getCustomVariantValues($parent);
|
||||
var noVariantAttributeValues = self.getNoVariantAttributeValues($parent);
|
||||
if (productCustomVariantValues || noVariantAttributeValues) {
|
||||
@@ -408,10 +401,6 @@ var OptionalProductsModal = Dialog.extend(ServicesMixin, VariantMixin, {
|
||||
var $select_options_text = $modal.find('.o_select_options');
|
||||
$select_options_text.show();
|
||||
|
||||
// revert back to original product name and clean the entry
|
||||
$parent.find(".product-name").html(productNameMap[productTemplateId]);
|
||||
delete productNameMap[productTemplateId];
|
||||
|
||||
this._removeOptionOption($modal, productTemplateId);
|
||||
|
||||
$modal.find('tr:last').after($parent);
|
||||
|
||||
@@ -165,13 +165,12 @@
|
||||
<td class="td-img">
|
||||
<input type="hidden" class="product_template_id" t-att-value="product.id"/>
|
||||
<input type="hidden" class="product_id" t-attf-name="optional-product-#{product.id}" t-att-value="product_variant.id"/>
|
||||
<input type="hidden" class="product_display_name" t-attf-name="optional-productname-#{product.id}" t-att-value="combination_info['display_name']"/>
|
||||
<img t-if="product_variant" t-att-src="'/web/image/product.product/%s/image_medium' % product_variant.id" class="variant_image" alt="Product Image"/>
|
||||
<img t-else="" t-att-src="'/web/image/product.template/%s/image_medium' % product.id" class="variant_image" alt="Product Image"/>
|
||||
</td>
|
||||
<td class='td-product_name' colspan="2">
|
||||
<div class="float-left">
|
||||
<strong class="product-name" t-esc="combination_info['display_name']"/>
|
||||
<strong class="product-name product_display_name" t-esc="combination_info['display_name']"/>
|
||||
<div class="text-muted small" t-field="product.description_sale"/>
|
||||
</div>
|
||||
<div class="float-right">
|
||||
|
||||
Reference in New Issue
Block a user