Skip to content

Visual swatch images/colors were not visible in backoffice #13134

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

Closed
wants to merge 1 commit into from

Conversation

Yonn-Trimoreau
Copy link

Visual swatch images/colors were not visible in backoffice

Description

In app/code/Magento/Swatches/Block/Adminhtml/Attribute/Edit/Options/Visual.php at line 95: $newSwatch was initialized as a string but it was used as an array in both the function body and in the calling function.
This resulted in $newSwatch was always set to "b" (the first letter of "background"), and so the view did not get a correct value for style="background: url('xxxxx.xxx'); background-size: cover;"
This issue is only visible for PHP 7

Fixed Issues (if relevant)

I fixed it before posting an issue. Maybe there is one but I could not find it.

Manual testing scenarios

  1. Install Magento 2.2.2 on a PHP 7.1.12 server
  2. Add a visual swatch product attribute
  3. Add some visual swatch options with an image or a color
  4. Save and continue edit
  5. Visual swatch images are now visible and were not before the fix

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)

$newSwatch was initialized as a string but it was used as an array in both the function body and in the calling function.
This resulted in $newSwatch was always set to "b" (the first letter of "background"), and so the view did not get a correct style="background: url('xxxxx.xxx'); background-size: cover;"
This issue is only visible for PHP 7
@ihor-sviziev
Copy link
Contributor

ihor-sviziev commented Jan 11, 2018

@Yonn-Trimoreau thank you for your contribution, but it looks like the same changes were already proposed in #13101

@Yonn-Trimoreau
Copy link
Author

Looks like you're right @ihor-sviziev ! Closing this pull request

@Yonn-Trimoreau Yonn-Trimoreau deleted the patch-1 branch January 11, 2018 13:46
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.

2 participants