Skip to content

Instantly share code, notes, and snippets.

View tomakun's full-sized avatar
💻
Diving into Mastodon

Thomas Soubrier tomakun

💻
Diving into Mastodon
View GitHub Profile
@tomakun
tomakun / gist:9003a1f923e9f18b22b7
Created November 28, 2014 01:40
Same code without else
<?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 endif; ?>
@tomakun
tomakun / gist:a0553d4e3f455a4ed62b
Created November 28, 2014 01:36
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; ?>