title: How to display just the number of products in cart Virtuemart
body: <p>I am running Virtuemart 2.0.18 and Joomla 1.5. What I need to accomplish is to just display the total number of products in the cart with a number like "10". I have a cart image and want to place that next to the image.</p>
  
  <p>I have found similar questions-but, the answers did not apply-nor work for my situation.</p>
  
  <p>I did find this thread on stackoverflow: <a href="https://stackoverflow.com/questions/15006030/display-the-number-of-items-in-the-cart-on-virtuemart-joomal-2-5">display the number of items in the cart on virtuemart joomla 2.5?</a></p>
  
  <p>That did not solve my problem:</p>
  
  <pre><code>&lt;?php 
      $array = unserialize($_SESSION['__vm']['vmcart']); 
      $total = 0;
      foreach($array-&gt;products as $product){
          $total += $product-&gt;amount;
      }
      echo "Total Products: " . $total;
  ?&gt;
  </code></pre>
  
  <p>This only works if I go to my cart (as the cart is ran by cookies). The php isn't working also if I add a few products the number count is off. Basically the whole code does not function at all.</p>
  
  <p>Is there a JavaScript that will work to access the cookies and retrieve the amount of products in the cart, or is there a similar way to do this with PHP?</p>
  
  <p>Thank you in advance for your help, I really appreciate it!</p>