eCommerce enhancements

It seems very brittle to me to have raw sql like this.