Created
July 18, 2012 11:03
-
-
Save ndv/3135563 to your computer and use it in GitHub Desktop.
OnSetProfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="//app.ecwid.com/script.js?1003" type="text/javascript" charset="UTF-8"></script> | |
<script> | |
function dump(arr,level) { | |
var dumped_text = ""; | |
if (!level) level = 0; | |
// The padding given at the beginning of the line. | |
var level_padding = ""; | |
for (var j=0;j<level+1;j++) level_padding += " "; | |
if (typeof(arr) == 'object') { // Array/Hashes/Objects | |
for (var item in arr) { | |
var value = arr[item]; | |
if (typeof(value) == 'object') { // If it is an array, | |
dumped_text += level_padding + "'" + item + "' ...\n"; | |
dumped_text += dump(value,level+1); | |
} else { | |
dumped_text += level_padding + "'" + item + "' => \"" + value + "\"\n"; | |
} | |
} | |
} else { // Stings/Chars/Numbers etc. | |
dumped_text = "===>"+arr+"<===("+typeof(arr)+")"; | |
} | |
return dumped_text; | |
} | |
Ecwid.OnSetProfile.add(function(profile) { | |
if (profile == null) document.getElementById('CUSTOMER').innerText = 'not logged in'; | |
else document.getElementById('CUSTOMER').innerText = dump(profile); | |
}); | |
</script> | |
<div><pre id='CUSTOMER'/></div> | |
<script> | |
xProductBrowser(); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment