Using the items id as a key.
Whenever something is bought, save an integer on a random hashtable under the key of it's id. If you want to count how many times its been bought, up the count. If you want to count how many are available, you'll just have to init the hashtables key to something appropriate (which would be a pain).
If you want to get supersupersuper complicated, you couldd theoreticlaly recreate the shop and order a dummy unit to keep buying items from it and get a count of how much stuff there is, and use that as a starting count. (I'd actually use that, but I dont even know what the order is to get something to buy from a shop).