Attach basket to request before applying offers

apply_offers_to_basket may depend on it, so we attach it before calling
that.

Reported and code supplied by @vovanbo. I re-did the work to add
comments.

Fixes #1172