Skip to content

CATALOG-2408 - Bulk Pricing updates per-variant#1167

Merged
mjschock merged 1 commit intobigcommerce:masterfrom
bookernath:bulk-pricing-tiers
Feb 21, 2018
Merged

CATALOG-2408 - Bulk Pricing updates per-variant#1167
mjschock merged 1 commit intobigcommerce:masterfrom
bookernath:bulk-pricing-tiers

Conversation

@bookernath
Copy link
Contributor

@bookernath bookernath commented Feb 21, 2018

What?

Price Lists support different bulk pricing tiers for each variant, so we need to update the viewModel whenever these tiers change.

Tickets / Documentation

Screenshots (if appropriate)

GIF

@bigbot
Copy link

bigbot commented Feb 21, 2018

Autotagging @bigcommerce/storefront-team @davidchin

package.json Outdated
"license": "MIT",
"dependencies": {
"@bigcommerce/stencil-utils": "^1.0.10",
"@bigcommerce/stencil-utils": "bookernath/stencil-utils#d263f2ef03aa88e1361c8b4331204e4e4e8bd5e4",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this gets replaced with a new version once the utils PR is merged.

@bookernath bookernath changed the title (WIP) CATALOG-2408 - Bulk Pricing updates per-variant CATALOG-2408 - Bulk Pricing updates per-variant Feb 21, 2018
const $messageBox = $('.alertMessageBox');
const item = $('[name="item_id"]', $form).attr('value');

utils.api.productAttributes.optionChange(item, $form.serialize(), (err, result) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looking at the new optionChange api, it seems that we don't need to pass null here

utils.api.productAttributes.optionChange(productId, $form.serialize(), 'products/bulk-discount-rates', (err, response) => {
const productAttributesData = response.data || {};

const bulkPricingHtml = response.content || {};
Copy link
Contributor

@mjschock mjschock Feb 21, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could we match the productAttributesData here, like so:

const productAttributesContent = response.content || {};

...

updateView(data, content)

etc.

}

// If Bulk Pricing rendered HTML is available
if (content) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does this work? i thought it was grabbing a field off of content... like this instead:

updateView(data, content) { // content will be {} if response.content is empty above

...

if (content.bulkPricingContent) { // or whatever it's called
  viewModel.$bulkPricing.html(content.bulkPricingContent)

Copy link
Contributor Author

@bookernath bookernath Feb 21, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Content returns a blank string which evaluates to false if there are no tiers. Content is returned as another top-level property, but it's just a string and not an object.

@bookernath
Copy link
Contributor Author

@mjschock I think I've addressed most of your feedback if you wanna take a peek. Also rebased to pull in the JQ update.

@mjschock mjschock merged commit 21a6c7c into bigcommerce:master Feb 21, 2018
@bookernath bookernath deleted the bulk-pricing-tiers branch February 21, 2018 21:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants