Skip to content

Instantly share code, notes, and snippets.

@makfruit
Created December 13, 2011 06:40
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save makfruit/1470943 to your computer and use it in GitHub Desktop.
Save makfruit/1470943 to your computer and use it in GitHub Desktop.
A script for Ecwid to determine a product ID of a product page being displayed
// Add handler for Ecwid's OnPageLoad event
if (
typeof(Ecwid) == 'object'
&& typeof(Ecwid.OnPageLoad) == 'object'
) {
Ecwid.OnPageLoad.add(function(page) {
// Determine a product ID and do necessary actions
if (
typeof(page) == 'object'
&& 'PRODUCT' == page.type
) {
alert(page.productId);
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment