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

fix(medusa): Product option values in CSV Export #5781

Merged
merged 5 commits into from
Dec 6, 2023

Conversation

mortenengel
Copy link
Contributor

This PR introduces fixes to the problem of Product Option Values not following the Product Option Names in the Product Export CSV file, when there are more than one option.

The changes are made to keep the exports consistent with the data

I have created a new entityname consisting of both product and variant, and add them both, so that variant option values will be taken in the same order as product option names.

Testing has been done by doing an CSV export of the export with the old data and verifying that option data could be mixed:
image

and using the new code on the same data, and verifying that options are no longer mixed.
image

I have been unable to find a good way to add automated tests for the strategies

@mortenengel mortenengel requested a review from a team as a code owner November 30, 2023 19:50
Copy link

changeset-bot bot commented Nov 30, 2023

🦋 Changeset detected

Latest commit: 98ed6c0

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@medusajs/medusa Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

vercel bot commented Nov 30, 2023

@mortenengel is attempting to deploy a commit to the medusajs Team on Vercel.

A member of the Team first needs to authorize it.

@olivermrbl olivermrbl requested a review from fPolic December 3, 2023 12:31
@olivermrbl olivermrbl changed the title Fix for https://github.com/medusajs/medusa/issues/5712 fix(medusa): Product option values in CSV Export Dec 3, 2023
@olivermrbl olivermrbl linked an issue Dec 3, 2023 that may be closed by this pull request
Copy link
Contributor

@fPolic fPolic left a comment

Choose a reason for hiding this comment

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

Appreciate the contribution @mortenengel - Looks good!
I only have one typings related comment.

Copy link
Contributor

@fPolic fPolic left a comment

Choose a reason for hiding this comment

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

LGTM - thanks for the fix @mortenengel!

@@ -597,7 +603,7 @@ export default class ProductExportStrategy extends AbstractBatchJobStrategy {
}
if (columnSchema.entityName === "variant") {
const formattedContent = csvCellContentFormatter(
columnSchema.accessor(variant)
columnSchema.accessor(variant, { product: product })
Copy link
Contributor

Choose a reason for hiding this comment

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

nit(non-blocking):

Suggested change
columnSchema.accessor(variant, { product: product })
columnSchema.accessor(variant, { product })

Copy link

vercel bot commented Dec 6, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

3 Ignored Deployments
Name Status Preview Comments Updated (UTC)
api-reference ⬜️ Ignored (Inspect) Visit Preview Dec 6, 2023 2:11pm
docs-ui ⬜️ Ignored (Inspect) Visit Preview Dec 6, 2023 2:11pm
medusa-docs ⬜️ Ignored (Inspect) Visit Preview Dec 6, 2023 2:11pm

@olivermrbl olivermrbl merged commit 9b447f9 into medusajs:develop Dec 6, 2023
12 checks passed
@github-actions github-actions bot mentioned this pull request Dec 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Product Export can shuffle the option values
3 participants