magento2 icon indicating copy to clipboard operation
magento2 copied to clipboard

MAGETWO-99236 Fix for #22063 Category data is changed after saving category linkfor different stores

Open ilnytskyi opened this issue 3 years ago • 45 comments

Description (*)

When there is a loop going through a few products and linking those products to categories. Some categories get data copied from another store.

Load a category from the default store instead of taking the last cached from CategoryRepository.

I think it would also be better to save the category via its repository. Unfortunately the CategoryRepository ignores posted products

$category->setPostedProducts($productPositions);

(probably a case for another bug)

Related Pull Requests

Fixed Issues (if relevant)

  1. Fixes magento/magento2#22063
  2. Fixes magento/magento2#32478

Manual testing scenarios (*)

  1. Create a few stores
  2. Give different descriptions and short descriptions to a category in each store.
  3. Loop through different stores e.g. with emulation or just load categories based on product store id
  4. Link a product to a category.
  5. Category has correct data (data was not copied from the category instance that loaded in different store)
\Magento\Catalog\Model\CategoryRepository::get

Questions or comments

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)
  • [ ] README.md files for modified modules are updated and included in the pull request if any README.md predefined sections require an update
  • [ ] All automated tests passed successfully (all builds are green)

ilnytskyi avatar Oct 02 '21 12:10 ilnytskyi