Skip to content

Conversation

@crissanclick
Copy link
Contributor

@crissanclick crissanclick commented Oct 9, 2017

Description

When grouped product is duplicated the simple products links doesn't copied.

Fixed Issues

  1. Duplication of Grouped Products does not work as expected #10679

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 on Travis CI are green)

@crissanclick
Copy link
Contributor Author

What information do you need? @vkublytskyi @magento-team

@vkublytskyi
Copy link

@crissanclick, needs update label was added by mistake. Sorry for disturbing you. We are still verifying your fix.

@crissanclick
Copy link
Contributor Author

Ok!!! Thanks!

Copy link

@vkublytskyi vkublytskyi left a comment

Choose a reason for hiding this comment

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

Provided fix is not full and does not cover next scenario:

  1. Go to Admin > Catalog > Product > Add Simple Product
  2. Fill all required fields and click Save button
  3. Go to Admin > Catalog > Product > Add Grouped Product
  4. Fill all required fields and add created simple product as Grouped product.
  5. Click SAve & Duplicate.

Duplicated product will not have linked simple product.

If Grouped product already exists and new product added to group and after this click on Save & Duplicate then duplicated broduct will not have added products.

The same issue occurs with other "linked" products (up-sells, cross-sells, ralated).

Product links are properly stored only if they are available in product during product save.

//\Magento\Catalog\Model\Product\Link\SaveHandler::execute

$productLinks = $entity->getProductLinks();
if (count($productLinks) > 0) {
     foreach ($entity->getProductLinks() as $link) {
          $this->productLinkRepository->save($link);
     }
}

As duplicate product does not have links they are missed in duplicate.

In some flows, this issue may be hidden by cache usage but cache is not an issue and it should be cleaned on product save as after saving some properties may expects reload.

To provide a valid fix seems we should add one more implementation of \Magento\Catalog\Model\Product\CopyConstructorInterface which will copy product links on product duplication.

@okorshenko
Copy link
Contributor

Hi @crissanclick
We are closing this PR due to inactivity. Feel free to reopen it once ready

@okorshenko okorshenko closed this Dec 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants