Think about the pattern processing sampling from a database.
In General, the problem in simplified form is this: there is a selection of some set of goods from the database, you need to handle the values for each item:
— to apply discounts
to apply filters to the product to the buyer
— all bonuses
— additional attributes depending on the situation
Make class Items_pool and hang foreach for each case — the first thing that comes to mind, but I feel that it is ugly. Are there any best practice?