Skip to content

Commit

Permalink
fix(catalog): CATALOG-3085 refrain from updating the price shown on
Browse files Browse the repository at this point in the history
    quickview by default when the modal is rendered unless theres an
    actual default selection to be made.
  • Loading branch information
Ziad Abdo committed Apr 9, 2018
1 parent 2128fd6 commit 0ef71be
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions assets/js/theme/common/product-details.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@ export default class ProductDetails {
const attributesData = response.data || {};
const attributesContent = response.content || {};
this.updateProductAttributes(attributesData);
this.updateView(attributesData, attributesContent);
if (hasDefaultOptions) {
this.updateView(attributesData, attributesContent);
} else {
this.updateDefaultAttributesForOOS(attributesData);
}
});
} else {
this.updateProductAttributes(productAttributesData);
Expand Down Expand Up @@ -388,19 +392,25 @@ export default class ProductDetails {
viewModel.stock.$input.text(data.stock);
}

this.updateDefaultAttributesForOOS(data);

// If Bulk Pricing rendered HTML is available
if (data.bulk_discount_rates && content) {
viewModel.$bulkPricing.html(content);
} else if (typeof (data.bulk_discount_rates) !== 'undefined') {
viewModel.$bulkPricing.html('');
}
}

updateDefaultAttributesForOOS(data) {
const viewModel = this.getViewModel(this.$scope);
if (!data.purchasable || !data.instock) {
viewModel.$addToCart.prop('disabled', true);
viewModel.$increments.prop('disabled', true);
} else {
viewModel.$addToCart.prop('disabled', false);
viewModel.$increments.prop('disabled', false);
}
// If Bulk Pricing rendered HTML is available
if (data.bulk_discount_rates && content) {
viewModel.$bulkPricing.html(content);
} else if (typeof (data.bulk_discount_rates) !== 'undefined') {
viewModel.$bulkPricing.html('');
}
}

/**
Expand Down

0 comments on commit 0ef71be

Please sign in to comment.