Fixed the shop trade conditions check

Previously, it would check only the trade conditions as if only one item was bought, even for several ones.
Also, the total cost of the items wasn't checked.

I also simplified a bit the logic there.