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

[FEATURE] display attribute value of child product in cart #214

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

rommelfreddy
Copy link

@rommelfreddy rommelfreddy commented Oct 11, 2022

Please make sure these boxes are checked before submitting your PR - thank you!

  • Pull request is based against develop branch
  • README.md reflects changes (if applicable)
  • New files contain a license header

Issue

none

Proposed changes

this PR prints the child-attribute value in the cart instead of the configurable attribute value.
This makes more sense, cause the admin would change the value in the child below. E.g. the SKU.

@@ -42,8 +43,34 @@ public function __construct(GetVisibleCheckoutAttributesServiceInterface $getVis
public function afterGetCustomOptions(Configuration $configuration, array $customOptions, ItemInterface $item)
{
$attributes = $this->getVisibleCheckoutAttributesService->execute();

$configurableAttributes = $item->getOptionByCode('attributes') ? $item->getOptionByCode('attributes')->getValue() : [];
$configurableAttributes = $configurableAttributes ? array_keys(json_decode($configurableAttributes, true)) : [];
Copy link
Member

Choose a reason for hiding this comment

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

I did not check how this is encoded, but most probably, we should use \Magento\Framework\Serialize\Serializer\Json instead of directly using json_decode?

@sprankhub
Copy link
Member

Thanks for your contribution, @rommelfreddy! Could you check my comments and the failing pipeline?

I think the change makes sense, but I would love to get a second opinion from e.g. @frostblogNet :)

@frostblogNet
Copy link
Member

@rommelfreddy thanks for the contribution. It would be nice if you could change the line metioned by @sprankhub. Sorry for the late response.

…utAttributesToCustomOptionsPlugin.php


Make comparison stricter

Co-authored-by: Simon Sprankel <sprankhub@users.noreply.github.com>
@sprankhub
Copy link
Member

@roman204, if you want to push this forward, feel free to send a new PR with the changes fixed. Since I don't need this at the moment and my time is very limited, I cannot just work on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants