-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Conversation
🦋 Changeset detectedLatest commit: 98ed6c0 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
@mortenengel is attempting to deploy a commit to the medusajs Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this 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.
packages/medusa/src/strategies/batch-jobs/product/types/index.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this 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 }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit(non-blocking):
columnSchema.accessor(variant, { product: product }) | |
columnSchema.accessor(variant, { product }) |
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 3 Ignored Deployments
|
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](https://private-user-images.githubusercontent.com/38915779/287051664-5a50821e-086a-4211-8ed0-8aed812d423d.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzg5NTk3NzUsIm5iZiI6MTczODk1OTQ3NSwicGF0aCI6Ii8zODkxNTc3OS8yODcwNTE2NjQtNWE1MDgyMWUtMDg2YS00MjExLThlZDAtOGFlZDgxMmQ0MjNkLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDclMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA3VDIwMTc1NVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTg1Mjg5OThlNmJmZjIzOTcxNWQwZjRiM2I0YjNlM2QyOWQ0ZDhjYzI5MTY1MDZjM2M1ZTBiOTk3N2YzNjk2OTkmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.UB3B4KAn3OcFUwjyme3kzRgIr2KBLjGN1rqIs0-J7XA)
and using the new code on the same data, and verifying that options are no longer mixed.
![image](https://private-user-images.githubusercontent.com/38915779/287051787-6b32fbfa-9311-471f-9e9d-fa266df0cd1d.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzg5NTk3NzUsIm5iZiI6MTczODk1OTQ3NSwicGF0aCI6Ii8zODkxNTc3OS8yODcwNTE3ODctNmIzMmZiZmEtOTMxMS00NzFmLTllOWQtZmEyNjZkZjBjZDFkLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDclMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA3VDIwMTc1NVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTk1YmIxMjMyNmVhNmZhZTg4MDVlYjUxYzAyYWIzOTQ5MTc2NGVkYTIxMjA3YWU5ODVmMGUzMGYxYTcxZDA5OGQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.nDsZ7ykljmKUGbVZF_9gZjJlIay8fI00tt9-9zzwkbk)
I have been unable to find a good way to add automated tests for the strategies