title: Change foreach to show only first/last added image
body: <p>I have following code construction. It gives out an image of the product, which was even added to the shopping card. Images appear in the adding order: the image on top is the image, which was added last.</p>
  
  <p>How can i change this code so, that i get showing only one image, from recently added product (but not all images from all added products)? I guess, i need change something in  <em>foreach ($items as $item)</em> so, that the image is showing not for each $item, but only for one $item, but don't know how to modify this code exactly...</p>
  
  <p>Thanks for your help and advises!</p>
  
  <p>Here is the code:</p>
  
  <pre><code>&lt;table&gt;
      &lt;?php $i=0; $k=0; $subtotal = 0;?&gt;
      &lt;?php foreach ($items as $item) : ?&gt;
  
      &lt;?php
          $link = K2StoreItem::getK2Link($item-&gt;product_id);
          $link = JRoute::_($link);
          $image_path = K2StoreItem::getK2Image($item-&gt;product_id, $this-&gt;params);
      ?&gt;
      &lt;tr class="row&lt;?php echo $k; ?&gt;"&gt;
          &lt;?php if($this-&gt;params-&gt;get('show_thumb_cart')) : ?&gt;
          &lt;td class="warkorb2"&gt;
              &lt;?php if(!empty($image_path)) : ?&gt;
              &lt;img src="&lt;?php echo $image_path; ?&gt;" class="itemImg&lt;?php echo $this-&gt;params-&gt;get('cartimage_size','small') ?&gt;" /&gt;
              &lt;?php endif;?&gt;
          &lt;/td&gt;
          &lt;?php endif; ?&gt;
      &lt;/tr&gt;
      &lt;?php ++$i; $k = (1 - $k); ?&gt;
      &lt;?php endforeach; ?&gt;
  &lt;table&gt;
  </code></pre>