Switch to using friendly_id for product permalink generation

It's better for other people (who know better) to maintain at least some of the permalink generation code than for us to do it.

Old permalinks will still function correctly.

Proposed fix for #4167 + others