WAStoreCart


Seaside-Examples-Store-Model

Comment:

A shopping cart.  This is essentially a specialized Bag: you can #add: or #remove: WAStoreItems to it, and calculate their #totalPrice.  You can also use #countsAndItems to get a collection of associations between the items and the number of times they appear in the cart, useful for summary displays.

Hierarchy:

ProtoObject
Object
WAStoreCart

Summary:

instance variables:

items

methods:

instance class
as yet unclassified no messages

Detail:

instance variables:

items
inferredType:
UndefinedObject

instance methods:

as yet unclassified
add: anObject

	items ifNil: [items _ Bag new].
	items add: anObject
countsAndItems

	^ items sortedCounts
hasItems

	^ items notNil and: [items isEmpty not]
items

	^ items
remove: anObject

	items remove: anObject ifAbsent: []
totalPrice

	^ items detectSum: [:ea | ea price]

class methods:

^top


- made by Dandelion -