cancel
Showing results for 
Search instead for 
Did you mean: 

Recently viewed products

Recently viewed products

I have made my own theme from the RWD theme and I am displaying recently viewed products on the homepage via:

 

<?php
	$collection = $this->getRecentlyViewedProducts();
	?>

<?php if ($_products = $this->getRecentlyViewedProducts()): ?>
   <h2>Your recently viewed</h2>
     <div class="jcarousel-wrapper">
                <div class="jcarousel">
                    <ul>
                           <?php foreach ($collection as $_product) {  ?>
                        <li><a href="<?php echo $_product->getProductUrl() ?>">
                        <img src="<?php echo $this->helper('catalog/image')->init($_product, 'small_image')->resize(200); ?>" alt="" /></a> 
                        <div class="productName">
                        <a href="<?php echo $_product->getProductUrl(); ?>"><?php echo $_product->getName(); ?></a>
                        </div> 
                        
                         <?php if($_product->isSaleable()): ?>
                        <p><button type="button" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart" onclick="setLocation('<?php echo $this->helper('checkout/cart')->getAddUrl($_product) ?>')"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button></p>
                    <?php else: ?>
                        <p class="availability out-of-stock"><span><?php echo $this->__('Out of stock') ?></span></p>
                    <?php endif; ?>
                   
                    <ul class="add-to-links">
                        <?php if ($this->helper('wishlist')->isAllow()) : ?>
                            <li><a href="<?php echo $this->helper('wishlist')->getAddUrl($_product) ?>" class="link-wishlist"><?php echo $this->__('Add to Wishlist') ?></a></li>
                        <?php endif; ?>
                      
                    </ul>
                    
                        </li>
                         <?php }?>
                    </ul>
                </div>

                <a href="#" class="jcarousel-control-prev">&lsaquo;</a>
                <a href="#" class="jcarousel-control-next">&rsaquo;</a>


            </div>
            <?php else:?>
	             <img src=""/>
<?php endif; ?>

 It all works fine, but obviously when a user hasn't viewed any products, it leaves empty space. So, I would like to have some content appear if no recent viewed products. i have tried as you can see to run a conditional statement, but it does not work. So, how could I if there is no recently viewed products, show an image ?