Skip to content

Instantly share code, notes, and snippets.

@tomakun
Created November 28, 2014 01:36
Show Gist options
  • Save tomakun/a0553d4e3f455a4ed62b to your computer and use it in GitHub Desktop.
Save tomakun/a0553d4e3f455a4ed62b to your computer and use it in GitHub Desktop.
If image existe show image, else show placeholder
<?php if ($this->getPackageImage()): ?>
<?php echo '<img src="'.$this->helper('catalog/image')->init($_product, 'package_image')->keepFrame(false)->resize(null, 300).'" alt="'.$this->escapeHtml($this->getImageLabel()).'" title="'.$this->escapeHtml($this->getImageLabel()).'" />'; ?>
<?php else: ?>
<img src="http://placehold.it/220x300">
<?php endif; ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment