Add search result summary helper function

This commit introduces a helper function, buildInventorySummary(), to
abstract re-implemented tpl-building code in the onChooseLocation and
onChooseProduct functions. This helper function changes the behavior
of the tpl element slightly to include a base case (still provides a
summary when the user has not selected anything).