Display Cart Line Item Count

This code can be used on the display the total number of items that are in a cart. For example, if the cart contains five of one line item, and three of another line item, this code would display Total items in cart: 8.


<ss:set name="math" value="$system.getMath('0')"/>
<ss:foreach item="detail" within="$cart.details">
  <ss:directive source="$math.set($math.add($detail.quantity))"/>
</ss:foreach>
Total items in cart: <ss:value source="$math.get()"/>

If you use this code on the Cart template, you can just add the ss:set tag before the existing ss:foreach, add the ss:directive tag anywhere within the ss:foreach, and then add the Total Quantity line to the end (after the close ss:foreach).

About this Entry

This page contains a single blog entry by Eric Anderson published on November 1, 2007 3:03 PM.

ProStores V8.2 Features was the previous entry in this blog.

Birdwatching is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.