Skip to content

[GraphQL] Compare products #29047

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

Merged
merged 69 commits into from
Feb 16, 2021

Conversation

Usik2203
Copy link
Contributor

@Usik2203 Usik2203 commented Jul 8, 2020

Description (*)

Based on this schema compare-list.graphqls we should provide functionality for list_id parameter in schema
New schema https://github.com/magento/architecture/pull/430/files
Purpose list_id is next:

The list_id becomes necessary since we want to move out the state from 
the app we have some freedom to build define a new schema GraphQL schema. 
The same as it was before for card, we need somehow to identify the list in the operations. 
Compare list may belong to a registered customer or a guest for both cases set of operation will be the same,
 technically there is no sense to associate compare list with a client unless you want to save the list for future usage. 
This is why we need to expose a new identifier list_id.
This new Id requires a new table that will have relation one to many (comparable items) and 
will represent the list as an entity.

This PR adds list_id parameter during comparing products and add CompareListGraphQl module

Related Pull Requests

Fixed Issues (if relevant)

  1. Fixes Catalog/Customer :: Product Compare List #28522>

Manual testing scenario

Create Compare List

mutation{
  createCompareList (input: { products: ["123", "456"] }) #products optional {
      uid
        items {
	uid
      	product {
              id
              sku
            }
      	attributes {
          code
          value
        }
      }
    attributes {
      code
      label
    }
  }
}

Getting compared list for Customer

{
  customer {
    firstname
    lastname
    
    compare_list {
      uid 
          items {
	uid
      	product {
              id
              sku
            }
      	attributes {
          code
          value
        }
      }
    attributes {
      code
      label
    }
    }
  }
}

Get compareList by ID

{
  compareList(uid: hash) {
    uid
           items {
	uid
      	product {
              id
              sku
            }
      	attributes {
          code
          value
        }
      }
    attributes {
      code
      label
    }
  }
}

Add Products to compare list

mutation {
  addProductsToCompareList(input: { uid: hash, products: [ 2049,  2048 ]}) {
    uid
        items {
	uid
      	product {
              id
              sku
            }
      	attributes {
          code
          value
        }
      }
    attributes {
      code
      label
    }
  }
}

Remove items from compare list

mutation {
   removeProductsFromCompareList(input: {uid: "hash" , products: [2047, 2048]}) {
      uid
         items {
	uid
      	product {
              id
              sku
            }
      	attributes {
          code
          value
        }
      }
    attributes {
      code
      label
    }
  }
}

Assign compare list to customer

mutation {
  assignCompareListToCustomer(uid: hash)
}

Delete compare list

mutation {
  deleteCompareList(uid:"zo8OIjXQR0r04lx8GEbg9Ivy0HabwFnS") {
    result
  }
}

@m2-assistant
Copy link

m2-assistant bot commented Jul 8, 2020

Hi @Usik2203. Thank you for your contribution
Here is some useful tips how you can test your changes using Magento test environment.
Add the comment under your pull request to deploy test or vanilla Magento instance:

  • @magento give me test instance - deploy test instance based on PR changes
  • @magento give me 2.4-develop instance - deploy vanilla Magento instance

❗ Automated tests can be triggered manually with an appropriate comment:

  • @magento run all tests - run or re-run all required tests against the PR changes
  • @magento run <test-build(s)> - run or re-run specific test build(s)
    For example: @magento run Unit Tests

<test-build(s)> is a comma-separated list of build names. Allowed build names are:

  1. Database Compare
  2. Functional Tests CE
  3. Functional Tests EE,
  4. Functional Tests B2B
  5. Integration Tests
  6. Magento Health Index
  7. Sample Data Tests CE
  8. Sample Data Tests EE
  9. Sample Data Tests B2B
  10. Static Tests
  11. Unit Tests
  12. WebAPI Tests

You can find more information about the builds here

ℹ️ Please run only needed test builds instead of all when developing. Please run all test builds before sending your PR for review.

For more details, please, review the Magento Contributor Guide documentation.

@magento-engcom-team magento-engcom-team added Release Line: 2.4 Partner: Atwix Pull Request is created by partner Atwix partners-contribution Pull Request is created by Magento Partner labels Jul 8, 2020
@Usik2203 Usik2203 marked this pull request as draft July 8, 2020 16:33
@nrkapoor nrkapoor added this to the 2.4.1 milestone Jul 9, 2020
@Usik2203
Copy link
Contributor Author

Hi @rogyar
Could I kindly ask you to review this PR if you have slot of free time?
Perhaps you will advise me something before I will start to do GraphQl coverage based on this functional.
Thanks a lot!

@nrkapoor nrkapoor modified the milestones: 2.4.1, 2.4.2 Aug 15, 2020
@Usik2203 Usik2203 changed the title [WIP][GraphQL] Compare products [GraphQL] Compare products Aug 17, 2020
@Usik2203 Usik2203 marked this pull request as ready for review August 17, 2020 17:18
Copy link
Contributor

@keharper keharper left a comment

Choose a reason for hiding this comment

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

A few more description updates

@Usik2203
Copy link
Contributor Author

@magento run all tests

@Usik2203
Copy link
Contributor Author

Hi @keharper
All your recommendations were applied.
Thanks

@prabhuram93
Copy link
Contributor

@magento run all tests

@Usik2203
Copy link
Contributor Author

@magento run all tests

@prabhuram93
Copy link
Contributor

@magento run all tests

@prabhuram93
Copy link
Contributor

@magento run all tests

@prabhuram93
Copy link
Contributor

@magento run all tests

@Usik2203
Copy link
Contributor Author

Usik2203 commented Dec 3, 2020

@magento run all tests

@prabhuram93
Copy link
Contributor

prabhuram93 commented Dec 15, 2020

@Usik2203 The changes are merged from our internal PR, but the PR is not because your last 2.4-develop merge commit is is not referenced in our internal PR. We will make sure to merge that commit on our next PR to 2.4-develop and this PR status will be updated. cc: @cpartica

@magento-engcom-team magento-engcom-team merged commit f0253ec into magento:2.4-develop Feb 16, 2021
@m2-assistant
Copy link

m2-assistant bot commented Feb 16, 2021

Hi @Usik2203, thank you for your contribution!
Please, complete Contribution Survey, it will take less than a minute.
Your feedback will help us to improve contribution process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Recently Merged
Development

Successfully merging this pull request may close these issues.

Catalog/Customer :: Product Compare List
8 participants