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).
neoverve
Subscribe to the feed for this blog