You could introduce a new field called count. Adding an item to the items purchased increments the variable, while bying sets it to 0.