Improvements to API performance.

Note: please also cherry pick this improvement back to 
2-2-stable and 2-3-stable.

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).

Speeds up the API (e.g., /api/products, /api/products/1) by a factor of 8
for a product with 1,000 variants.