medusa icon indicating copy to clipboard operation
medusa copied to clipboard

Product in multiple collections

Open maxpanakov opened this issue 3 years ago • 5 comments

Hi, i started work on this feature: https://github.com/medusajs/medusa/issues/2165, not finished yet, i'm waiting for your feedback,if everything is fine, I'll continue working on that.

maxpanakov avatar Sep 12 '22 05:09 maxpanakov

⚠️ No Changeset found

Latest commit: 3cfac0ddcffa12282f23be182babd1485111d227

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

changeset-bot[bot] avatar Sep 12 '22 05:09 changeset-bot[bot]

Hi @maxpanakov! Thanks for contributing - we would be happy to accept a PR for this. Here are a couple of things to make sure are covered:

  • DiscountConditions on collections
    • Should be modified to work similarly to DiscountConditions for product tags
  • Importing and Exporting products
    • Should be possible to import a product and associate it with multiple collections; similar to what is done with Sales Channels
    • When exporting there should be a full overview of collections
  • This change can likely not be made backward compatible, but you should consider adding a data migration that takes care of changing data for users who have existing products/collections in their DB
  • Finally, this will also require changes in medusajs/admin

If we can get all this into good shape we'd love to include it :)

srindom avatar Sep 12 '22 06:09 srindom

@srindom, I'm not sure about the migration command. In the script file, I'm thinking of something like this:

  1. add a new table
  2. update the relationship from collection_id to collections 3)remove the collection_id column from the products table is it possible not to create a migration file ? What is the best way for users who have existing products/collections? Do i need to trigger an update event for products ?

maxpanakov avatar Sep 16 '22 09:09 maxpanakov

@maxpanakov - we place data migration scripts here: https://github.com/medusajs/medusa/tree/master/packages/medusa/src/scripts

It is then the user's responsibility to run the script after they have upgraded; we will include this step in the upgrade guide for the version.

srindom avatar Sep 19 '22 10:09 srindom

@srindom any further comments on pr ? Can you review ?

maxpanakov avatar Sep 19 '22 11:09 maxpanakov

Hi, can you check my branch, there is still a lot of work left to rewrite the test and meta. I want to make sure I'm going in the right direction before I continue working

maxpanakov avatar Sep 26 '22 05:09 maxpanakov

Hey, thanks for the PR! Since v2 brought a lot of architectural changes, we will be closing this PR since it no longer applies to our new setup.

If you would still like to open this PR, please rebase with the v1 branch and re-request a review.

riqwan avatar Jul 05 '24 11:07 riqwan