Skip to content

Instantly share code, notes, and snippets.

@pierreandreroy
Created August 16, 2013 15:38
Show Gist options
  • Save pierreandreroy/6250967 to your computer and use it in GitHub Desktop.
Save pierreandreroy/6250967 to your computer and use it in GitHub Desktop.
Add image to product recently viewed block in Magento
<?php if ($_products = $this->getRecentlyViewedProducts()): ?>
<div class="block block-list block-viewed">
<div class="block-title">
<strong><span><?php echo $this->__('Recently Viewed Products') ?></span></strong>
</div>
<div class="block-content">
<ol id="recently-viewed-items">
<?php foreach ($_products as $_item): ?>
<li class="item">
<p><img class="product-image" src="<?php echo $this->helper('catalog/image')->init($_item, 'small_image')->resize(50, 50) ?>" width="50" height="50" alt="<?php echo $this->htmlEscape($_item->getName()) ?>" /> </p>
<p class="product-name"><a href="<?php echo $this->getProductUrl($_item) ?>"><?php echo $this->helper('catalog/output')->productAttribute($_item, $_item->getName() , 'name') ?></a></p>
</li>
<?php endforeach; ?>
</ol>
<script type="text/javascript">decorateList('recently-viewed-items');</script>
</div>
</div>
<?php endif; ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment