Fix issue region not showing properly in shipping calculator.

* Wrong sort function was being used, caused array key value associations to be lost.

**Also...**
Removed unsues globals from function
Fixed some code formatting
Updated phpdoc

Closes issue #1088