Its all playing with JS. You can manipulated alot with JS, if you are hitting at right area.
1st Part ...
CQ.WCM.getPagePath(); will give you current page path
Get the last part the page like this...
x = "/a/b/c/d";
y = x.substring(x.lastIndexOf("/");
y will be "/b" which in you case will be item code.
2nd part
You can sent a GET request to /etc/map/http.1.json to get json response.
Thats it...
Pass the full path which you want to give as a hyperlink to CQ.shared.Util.open(url);
Refer to the above shared article for help.....its talks about all this.......