Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add-ons: Add Variations Attributes row #4350

Merged
merged 12 commits into from
Jun 4, 2021

Conversation

Ecarrion
Copy link
Contributor

@Ecarrion Ecarrion commented Jun 3, 2021

closes #4312
fixes #3702

Why

As part of the Variations changes, we are trying to make the variation flow simpler. This PR takes out the "Product Variation Attributes" section that was inside the "Variations List" screen and makes it accessible from the "Product Form" screen.

How

  • Update ProductAttribute to conform to GeneratedCopiable

  • Update ProductFormActionsFactory to include the .attributes actions for the variable products when the product has at least one attribute.

  • Update DefaultProductFormTableViewModel to properly render the .attributes row and update the .variations row to show the variations count.

  • Update ProductFormViewController to navigate to the "Edit Attributes" screen after the new "Variation Attributes" row is tapped.

  • Update ProductVariationsViewController to remove the ability to edit product attributes for that screen.

Demo

attributes-demo.mov

Testing Steps

  • Launch the app and navigate to a product with variations

  • See that there is a "Variations" row stating how many variations the product has.

  • See that there is a "Variations Attributes" row.

  • Tap on the "Variations Attributes" row and see that it navigates to the "Edit Attributes" screen.

  • Edit/Add/Delete an attribute

  • Go back the to the main product screen, see that the "Variations Attribute" row is updated.

Update release notes:

  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

@Ecarrion Ecarrion added feature: product details Related to adding or editing products, including Product Settings. feature: variation list Related to the variations list for variable products. labels Jun 3, 2021
@Ecarrion Ecarrion added this to the 6.9 milestone Jun 3, 2021
@Ecarrion Ecarrion requested a review from a team June 3, 2021 03:18
@rachelmcr rachelmcr self-assigned this Jun 3, 2021
Copy link
Contributor

@rachelmcr rachelmcr left a comment

Choose a reason for hiding this comment

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

LGTM! Tests well with various cases:

  • New variable product
  • Existing variable product with no variations or attributes
  • Existing variable product with attributes but no existing variations
  • Existing variable product with one or more variations/attributes

let icon = UIImage.customizeImage
let title = Localization.productVariationAttributesTitle

let format = NSLocalizedString("%1$@ (%2$ld options)", comment: "Format for each Product attribute")
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Maybe add this string to the Localization enum.

Copy link
Contributor

Choose a reason for hiding this comment

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

Since we're working on this section now, it might also be worth updating this string to fix #3702? We could check for when options.count is 1 and use a different string in that case.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh, I wasn't aware of that issue.
Fixed in 85ac157

Screen Shot 2021-06-03 at 7 13 17 AM

}()

return String.localizedStringWithFormat(format, count)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This is a really clear way to handle the singular/plural cases! ⭐ I wish we could properly handle plurals for languages (like Russian) that have different plural forms (not just 1 or many), but until we can do that this is great. (We don't have an open issue for supporting different plural forms, but it's the same issue described in wordpress-mobile/WordPress-iOS#6327.)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Stringdict would be the tool to help us with that but I think it is not supported by Glotpress yet :-(

@peril-woocommerce
Copy link

peril-woocommerce bot commented Jun 3, 2021

You can trigger optional UI/connected tests for these changes by visiting CircleCI here.

@peril-woocommerce
Copy link

peril-woocommerce bot commented Jun 3, 2021

You can trigger an installable build for these changes by visiting CircleCI here.

Base automatically changed from issue/4313-show-variation-price-inf0 to develop June 4, 2021 21:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature: product details Related to adding or editing products, including Product Settings. feature: variation list Related to the variations list for variable products.
Projects
None yet
2 participants