Improvements to API performance.

Refactor BaseController#product_scope to allow subclasses
to override the associations that are eager-loaded from a product.
In doing so, removed two associations that were eager-loaded
but never referenced (product.properties, variant.prices).

In Product#total_on_hand, don't load and instantiate all the
variants if all we need to know is whether any of them
track inventory. And don't load all the stock_items to sum their
counts on hand.  (Fix to 368b89786).

Fixes #5008