Adding image to Shopp’s cart page

This is asked an awful lot on the Shopp Forums. User’s want to see a product thumbnail in their cart page next to the product name. It’s really quite simple.

Open your-theme/shopp/cart.php


<a href="<?php shopp('cartitem','url'); ?>"><?php shopp('cartitem','name'); ?></a>

Replace with

<a href="<?php shopp('cartitem','url'); ?>"><?php shopp('cartitem','coverimage','size=80'); ?></a>
<a href="<?php shopp('cartitem','url'); ?>"><?php shopp('cartitem','name'); ?></a>

You may want to change size=80 to make the thumbnail smaller or larger.

Here’s my full code to display cart items

	<?php while(shopp('cart','items')): ?>
			<td valign="middle"align="center">
				<a href="<?php shopp('cartitem','url'); ?>"><?php shopp('cartitem','coverimage','size=80&class=borderimage'); ?></a>
			<td valign="middle">
				 <a href="<?php shopp('cartitem','url'); ?>"><?php shopp('cartitem','name'); ?></a>
				<?php shopp('cartitem','options','show=selected'); ?>
				<?php shopp('cartitem','addons-list'); ?>
				<?php shopp('cartitem','inputs-list'); ?>
			<td><?php shopp('cartitem','quantity','input=text&size=2'); ?>
		<?php shopp('cartitem','remove','title=Remove'); ?>
			<td class="money"><?php shopp('cartitem','unitprice'); ?></td>
			<td class="money"><?php shopp('cartitem','total'); ?></td>
	<?php endwhile; ?>

Author: Kieran Barnes

Kieran is a PHP developer with 15 years commercial experience. Specialist in WordPress, CakePHP, CubeCart and all things PHP.

Leave a Reply

Your email address will not be published. Required fields are marked *