Skip to content

[Wishlist] Giving the possibility to set/update item description on item update #28222

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

Conversation

eduard13
Copy link
Contributor

@eduard13 eduard13 commented May 14, 2020

Description (*)

This PR improves the wishlist item update, by allowing to update the description while updating the wishlist item.

The problem occurs, when we want to set/update the item description in the same time when we update item's quantity, which doesn't seem to be supported for now.

Related Pull Requests

Fixed Issues (if relevant)

N/A

Manual testing scenarios (*)

  1. Create a simple product
  2. Log in on the storefront
  3. Add the simple product to wishlist
  4. Now, programmatically, try to update the quantity and the description for this item.
$wishlistId = 1;
$wishlistItemId = 1;

/** @var \Magento\Wishlist\Model\Wishlist $wishlist */
$wishlist = $objectManager->create(\Magento\Wishlist\Model\Wishlist::class);
$wishlistItemFactory = $objectManager->create(\Magento\Wishlist\Model\ItemFactory::class);
$wishlistItemResource = $objectManager->create(\Magento\Wishlist\Model\ResourceModel\Item::class);
$wishlist->load($wishlistId);

/** @var WishlistItem $wishlistItem */
$wishlistItem = $wishlistItemFactory->create();
$wishlistItemResource->load($wishlistItem, $wishlistItemId);
$wishlistItem->setDescription('My new description');
$wishlist->updateItem($wishlistItem, new \Magento\Framework\DataObject(['qty' => 22]));

After running this test code, we'll be able to see that we've updated only the qty, and not the description.

Questions or comments

Looks like the description, is only used in case there is a new wishlist item created, which only happens if we're trying to update the item with some different options(custom options/super_attribute, etc) that are already added to wishlist.

Contribution checklist (*)

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with unit/integration tests (if applicable)
  • All automated tests passed successfully (all builds are green)

Resolved issues:

  1. resolves [Issue] [Wishlist] Giving the possibility to set/update item description on item update #28261: [Wishlist] Giving the possibility to set/update item description on item update

@m2-assistant
Copy link

m2-assistant bot commented May 14, 2020

Hi @eduard13. 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 only 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). <test-build(s)> is a comma-separated list of build names. Allowed build names are Database Compare, Functional Tests CE, Functional Tests EE, Functional Tests B2B, Integration Tests, Magento Health Index, Sample Data Tests CE, Sample Data Tests EE, Sample Data Tests B2B, Static Tests, Unit Tests, WebAPI Tests.

ℹ️ 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 Component: Wishlist Release Line: 2.4 Partner: Atwix Pull Request is created by partner Atwix partners-contribution Pull Request is created by Magento Partner labels May 14, 2020
@eduard13
Copy link
Contributor Author

@magento run all tests

@rogyar rogyar self-assigned this May 17, 2020
@rogyar rogyar added Auto-Tests: Covered All changes in Pull Request is covered by auto-tests Award: test coverage labels May 17, 2020
@magento-engcom-team
Copy link
Contributor

Hi @rogyar, thank you for the review.
ENGCOM-7561 has been created to process this Pull Request

@engcom-Alfa
Copy link
Contributor

✔️ QA Passed

Manual testing scenario:

  1. Create a simple product;
  2. Log in on the storefront
  3. Add the simple product to wishlist
  4. Now, programmatically, try to update the quantity and the description for this item.
$wishlistId = 1;
$wishlistItemId = 1;

/** @var \Magento\Wishlist\Model\Wishlist $wishlist */
$wishlist = $objectManager->create(\Magento\Wishlist\Model\Wishlist::class);
$wishlistItemFactory = $objectManager->create(\Magento\Wishlist\Model\ItemFactory::class);
$wishlistItemResource = $objectManager->create(\Magento\Wishlist\Model\ResourceModel\Item::class);
$wishlist->load($wishlistId);

/** @var WishlistItem $wishlistItem */
$wishlistItem = $wishlistItemFactory->create();
$wishlistItemResource->load($wishlistItem, $wishlistItemId);
$wishlistItem->setDescription('My new description');
$wishlist->updateItem($wishlistItem, new \Magento\Framework\DataObject(['qty' => 777]));

Before: ✖️ Quantity updated, but no description

screenshot_12

After: ✔️ Quantity and description updated

screenshot_13

@slavvka
Copy link
Member

slavvka commented May 18, 2020

@magento create issue

@slavvka slavvka added Priority: P3 May be fixed according to the position in the backlog. Severity: S3 Affects non-critical data or functionality and does not force users to employ a workaround. labels May 19, 2020
@slavvka slavvka added this to the 2.4.1 milestone May 19, 2020
@VladimirZaets VladimirZaets added QA: Ready to add to Regression Scope Should be analyzed and added to Regression Testing Scope(if applicable) and removed Progress: extended testing labels May 19, 2020
@engcom-Alfa engcom-Alfa added QA: Added to Regression Scope Scenario was analysed and added to Regression Testing Scope and removed QA: Ready to add to Regression Scope Should be analyzed and added to Regression Testing Scope(if applicable) labels Jun 9, 2020
@ghost ghost added the Progress: accept label Jun 9, 2020
magento-engcom-team pushed a commit that referenced this pull request Jun 9, 2020
@magento-engcom-team magento-engcom-team merged commit baf9b58 into magento:2.4-develop Jun 9, 2020
@m2-assistant
Copy link

m2-assistant bot commented Jun 9, 2020

Hi @eduard13, 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
Labels
Auto-Tests: Covered All changes in Pull Request is covered by auto-tests Award: test coverage Component: Wishlist Partner: Atwix Pull Request is created by partner Atwix partners-contribution Pull Request is created by Magento Partner Priority: P3 May be fixed according to the position in the backlog. Progress: accept QA: Added to Regression Scope Scenario was analysed and added to Regression Testing Scope Release Line: 2.4 Severity: S3 Affects non-critical data or functionality and does not force users to employ a workaround.
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

[Issue] [Wishlist] Giving the possibility to set/update item description on item update
7 participants