Skip to content

Conversation

@josefbehr
Copy link
Contributor

@josefbehr josefbehr commented Jul 7, 2017

Description

getSwatchAttributeImage calls generateSwatchVariations($file), which throws an Exception when the file $file does not exist in the file system (see line 189: $image = $this->imageFactory->create($absoluteImagePath), which calls Image->__construct() and then Image->open, throwing an Exception on !file_exists($file)). This leads to the rest of the page not being rendered, when just one swatch image is missing. Not great. This fixes it and returns an empty file url (could also return the intended one, or a placeholder).

Manual testing scenarios

Delete one or more of the images that are used for swatches (alternatively, copy a database from a productive system to a local machine without getting the files, too), then try to visit a category or product page using swatches.

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)

getSwatchAttributeImage calls generateSwatchVariations($file), which throws an Exception when the file $file does not exist in the file system (see line 189: $image = $this->imageFactory->create($absoluteImagePath), which calls Image->__construct() and then  Image->open, throwing an Exception on !file_exists($file)). This leads to the rest of the page not being rendered, when just one swatch image is missing. Not great. This fixes it and returns an empty file url (could also return the intended one, or a placeholder).
@okorshenko okorshenko self-assigned this Jul 7, 2017
@okorshenko okorshenko added this to the July 2017 milestone Jul 7, 2017
@magento-team magento-team merged commit 83ea21f into magento:develop Jul 10, 2017
@josefbehr josefbehr deleted the fix-missing-swatch-file branch July 11, 2017 07:18
@t-richards
Copy link
Contributor

t-richards commented May 17, 2018

It looks like this fix was included in the 2.3.0 release: https://devdocs.magento.com/guides/v2.3/release-notes/ReleaseNotes2.3.0OpenSource.html

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