-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
Check if the product exists in the system before adding to comparing list. #23073
Conversation
Check if the product exists in the system before adding to comparing list. If the product doesn't exist, then we simply do nothing.
Hi @adarshkhatri. Thank you for your contribution
For more details, please, review the Magento Contributor Assistant documentation |
@magento give me test instance |
Hi @adarshkhatri. Thank you for your request. I'm working on Magento instance for you |
Hi @adarshkhatri, here is your new Magento instance. |
@adarshkhatri @dmytro-ch Is it not better to check if the product exists as first thing in the |
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.
After changes are applied and all builds are green, please squash them into a single commit so that we have perfectly clean history 😉
Using searchCriteriaBuilder to get the products from the system, filtered by (passed) productIds and then iterate that list of products to add to compare list.
@magento give me test instance |
Hi @adarshkhatri. Thank you for your request. I'm working on Magento instance for you |
Hi @adarshkhatri, here is your new Magento instance. |
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.
After changes are applied and all builds are green, please squash them into a single commit so that we have perfectly clean history 😉
@@ -51,6 +51,18 @@ class ListCompare extends \Magento\Framework\DataObject | |||
*/ | |||
protected $_compareItemFactory; | |||
|
|||
/** | |||
* Product Repository |
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.
Such comment is useless, please remove.
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.
removed.
Adding backward compatibility for constructor parameters.
Fixing typo "_condProdCombineF". Replacing it with "_condProdCombineFactory".
Hi @adarshkhatri, thank you for your contribution! |
Currently, the system tries to add any product id in to compare list, which is why it fails and throws an error. Allow only existing products to be added to compare list.
update to recent version
Hi @adarshkhatri. Thank you for your contribution
For more details, please, review the Magento Contributor Guide documentation. |
@magento give me test instance |
Hi @adarshkhatri. Thank you for your request. I'm working on Magento instance for you |
Hi @adarshkhatri, here is your new Magento instance. |
@adarshkhatri please, cover changes with automated tests |
I Couldn't understand them. First fail:
Second fail:
|
@adarshkhatri test failures caused by legacy implementation and you don't need to fix them. Please, cover newly added logic by tests |
Just couldn't understand what's the logic added by test in this? Should I just add Thanks. |
@adarshkhatri usage of the repository was added to the method, it should be covered at least by unit test. |
Closing this PR due to inactivity. |
Hi @adarshkhatri, thank you for your contribution! |
Check if the product exists in the system before adding to comparing list.
Description (*)
Check if the product exists in the system before adding to comparing list. If the product doesn't exist, then we simply do nothing.
Fixed Issues (if relevant)
Manual testing scenarios (*)
Make sure product ID doesn't exist in the system.
Questions or comments
Contribution checklist (*)