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

Exception thrown where no Product Image file found #5184

Closed
mcspronko opened this issue Jun 23, 2016 · 6 comments
Closed

Exception thrown where no Product Image file found #5184

mcspronko opened this issue Jun 23, 2016 · 6 comments

Comments

@mcspronko
Copy link
Contributor

@mcspronko mcspronko commented Jun 23, 2016

Steps to reproduce

  1. Remove image file for a product (pub/media/catalog/product directory)
  2. Navigate to Admin to edit product
  3. Then navigate to Category page/Product page
  4. Observe the results

Expected result

  1. User is able to edit a product
  2. User is able to see the product without image with default image placeholder
  3. User is able to see products assigned to a category

Actual result

  1. Exception is thrown on all pages where a product without image is shown

Magento versions

Magento 2.1 RC1, Magento 2.1 RC2, Magento 2.1 RC3, develop branch, 2.0 branch

How to fix the issue

The absolute image path should be checked before an instance of Image is created.

    public function generateSwatchVariations($imageUrl)
    {
        $absoluteImagePath = $this->mediaDirectory->getAbsolutePath($this->getAttributeSwatchPath($imageUrl));
        if (!file_exists($absoluteImagePath)) {
            return $this;
        }
        foreach ($this->swatchImageTypes as $swatchType) {
            $imageConfig = $this->getImageConfig();
            $swatchNamePath = $this->generateNamePath($imageConfig, $imageUrl, $swatchType);
            $image = $this->imageFactory->create($absoluteImagePath);
            $this->setupImageProperties($image);
            $image->resize($imageConfig[$swatchType]['width'], $imageConfig[$swatchType]['height']);
            $this->setupImageProperties($image, true);
            $image->save($swatchNamePath['path_for_save'], $swatchNamePath['name']);
        }
        return $this;
    }
@duhon duhon self-assigned this Jun 23, 2016
@duhon duhon removed their assignment Jun 23, 2016
@mcspronko

This comment has been minimized.

Copy link
Contributor Author

@mcspronko mcspronko commented Jun 23, 2016

Hi @duhon,

This is definitely a bug. Why would Magento stop processing whole category page if only one product has no image file?

Thanks,
Max

@antboiko

This comment has been minimized.

Copy link

@antboiko antboiko commented Jun 23, 2016

@mcspronko

Hello Max, thanks for reporting this issue. We've created internal ticket MAGETWO-54718 to fix it.

Best,
Anton.

@mcspronko

This comment has been minimized.

Copy link
Contributor Author

@mcspronko mcspronko commented Jun 23, 2016

Hi @antboiko

Thank you for internal ticket. Do you have any estimate when do you guys planning to fix this issue? It is pretty critical for Merchant to be able to add/edit a product from Admin.

Thanks,
Max

@pboisvert

This comment has been minimized.

Copy link

@pboisvert pboisvert commented Jun 23, 2016

@mcspronko the team will need to rank this against all other open issues but given your help in spotting the issue it seems like we should be able to address fairly soon (perhaps next patch but need some analysis first).

@palamar

This comment has been minimized.

Copy link
Contributor

@palamar palamar commented Jul 15, 2016

Issue has been fixed in scope of #5497 and should to appear in develop branch at the nearest time.

@palamar palamar closed this Jul 15, 2016
mmansoor-magento pushed a commit that referenced this issue Sep 2, 2016
[EAST] MAGETWO-54718: [GitHub] Exception thrown where no Product Image file found #5184 #5497 #5871
okorshenko pushed a commit that referenced this issue Dec 14, 2016
MAGETWO-54718:  [GitHub] Exception thrown where no Product Image file found #5184

(cherry picked from commit 21dd4cc)
okorshenko pushed a commit that referenced this issue Dec 14, 2016
- MAGETWO-54718:  [GitHub] Exception thrown where no Product Image file found #5184

- (cherry picked from commit 16895be)
okorshenko pushed a commit that referenced this issue Dec 14, 2016
- MAGETWO-54718:  [GitHub] Exception thrown where no Product Image file found #5184

- (cherry picked from commit 39d7f39)
okorshenko pushed a commit that referenced this issue Dec 14, 2016
- MAGETWO-54718: [GitHub] Exception thrown where no Product Image file found #5184

- (cherry picked from commit 3459ef1)
okorshenko pushed a commit that referenced this issue Dec 14, 2016
- MAGETWO-54718: [GitHub] Exception thrown where no Product Image file found #5184

- (cherry picked from commit 2e03028)
okorshenko pushed a commit that referenced this issue Dec 14, 2016
- MAGETWO-54718: [GitHub] Exception thrown where no Product Image file found #5184 #5497 #5871

- (cherry picked from commit 1ef843d)
okorshenko pushed a commit that referenced this issue Dec 14, 2016
- MAGETWO-54718: [GitHub] Exception thrown where no Product Image file found #5184 #5497 #5871

- (cherry picked from commit 2240a1e)
okorshenko pushed a commit that referenced this issue Dec 14, 2016
- MAGETWO-54718: [GitHub] Exception thrown where no Product Image file found #5184 #5497 #5871

- (cherry picked from commit da52cad)
okorshenko pushed a commit that referenced this issue Dec 14, 2016
- MAGETWO-54718: [GitHub] Exception thrown where no Product Image file found #5184 #5497 #5871

- (cherry picked from commit 0bad8ab)
@elenleonova

This comment has been minimized.

Copy link

@elenleonova elenleonova commented Dec 15, 2016

The issue has been released in 2.1.3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants
You can’t perform that action at this time.