Skip to content
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

[Forwardport] Correctly save Product Custom Option values #16838

Conversation

JeroenVanLeusden
Copy link
Member

Original Pull Request

#13569

Description

This occurred because the same value object is used for saving all values. After the save updateStoredData() is called and is used in prepareDataForUpdate().

protected function prepareDataForUpdate($object)
{
$data = $object->getData();
foreach ($object->getStoredData() as $key => $value) {
if (array_key_exists($key, $data) && $data[$key] === $value) {
unset($data[$key]);
}
}
$dataObject = clone $object;
$dataObject->setData($data);
$data = $this->_prepareDataForTable($dataObject, $this->getMainTable());
unset($data[$this->getIdFieldName()]);
unset($dataObject);
return $data;
}

Fixed Issues (if relevant)

  1. Custom option values do not save correctly #5067: Custom option values do not save correctly

Manual testing scenarios

  1. Install module ReachDigital_CustomOption.zip
  2. An extra column as added to the Product Custom Options (http://cloud.h-o.nl/pP3N).
  3. Uncheck all Changes Appearance checkboxes and save product.
  4. Only the first checkbox is saved.

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)

@JeroenVanLeusden JeroenVanLeusden added Release Line: 2.3 forwardport partners-contribution Pull Request is created by Magento Partner Partner: Reach Digital Pull Request is created by partner Reach Digital Partner: H&O labels Jul 15, 2018
@magento-engcom-team
Copy link
Contributor

Hi @JeroenVanLeusden. 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-engcom-team give me test instance - deploy test instance based on PR changes
  • @magento-engcom-team give me {$VERSION} instance - deploy vanilla Magento instance

For more details, please, review the Magento Contributor Assistant documentation

@magento-engcom-team
Copy link
Contributor

Hi @JeroenVanLeusden. Thank you for your contribution.
We will aim to release these changes as part of 2.3.0.
Please check the release notes for final confirmation.

@JeroenVanLeusden JeroenVanLeusden deleted the 2.3-develop-PR-port-13569 branch July 18, 2018 20:01
MarsArt pushed a commit to ConvertGroupsAS/magento2-patches that referenced this pull request Aug 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Catalog Partner: H&O Partner: Reach Digital Pull Request is created by partner Reach Digital partners-contribution Pull Request is created by Magento Partner Progress: accept Release Line: 2.3
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants