Skip to content

Commit

Permalink
fixing the display error if no image is uploaded
Browse files Browse the repository at this point in the history
  • Loading branch information
grossmann committed Nov 8, 2012
1 parent a29f8d5 commit 5a4312b
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,12 @@
$_product = $this->getProduct();
$_helper = $this->helper('catalog/output');
?>
<?php if (count($this->getGalleryImages()) > 1): ?>
<?php if (count($this->getGalleryImages()) == 0): ?>
<?php
$_img = '<img src="'.$this->helper('catalog/image')->init($_product, 'image')->resize().'" alt="'.$this->htmlEscape($this->getImageLabel()).'" title="'.$this->htmlEscape($this->getImageLabel()).'" />';
echo $_helper->productAttribute($_product, $_img, 'image');
?>
<?php elseif (count($this->getGalleryImages()) > 0): ?>
<?php foreach ($this->getGalleryImages() as $_image): ?>
<img src="<?php echo $this->helper('catalog/image')->init($this->getProduct(), 'thumbnail', $_image->getFile())->resize(); ?>" alt="<?php echo $this->htmlEscape($_image->getLabel()) ?>" title="<?php echo $this->htmlEscape($_image->getLabel()) ?>" />
<?php endforeach; ?>
Expand Down

3 comments on commit 5a4312b

@fernandofleury
Copy link

Choose a reason for hiding this comment

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

Ah, is this the final fix yet? I tried replacing the original media.phtml with no success.

I bumped on another issue as well. The first fix of setting the first image to [exclude] works just fine with more than 2 images. But if I have only 2 images (base + second one), the second one is gone. Just not showing up on the final product page.

@grossmann
Copy link
Owner Author

Choose a reason for hiding this comment

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

With this fix you don't have to check the exclude button anymore. Just upload your images and select the one for base, small and thumb. If no image is uploaded a generic magento image will be displayed. Your behavior with the disapearing second image seems strange and may be another issue. I suggest to just give this fix a try an look if it works for you.

@fernandofleury
Copy link

Choose a reason for hiding this comment

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

Yeah, it works like a charm right not. you guys could place a [FIXED] before the: fixing the display error if no image is uploaded... Thanks a lot for the quick answer.

Please sign in to comment.