Skip to content

Instantly share code, notes, and snippets.

@genee19
Created September 13, 2011 11:43
Show Gist options
  • Save genee19/1213646 to your computer and use it in GitHub Desktop.
Save genee19/1213646 to your computer and use it in GitHub Desktop.
Adds class with category ID into div.ecwid-productBrowser so various CSS customizations can be targeted to products in some particular category
Ecwid.OnAPILoaded.add(function(){var a;a=window.document.getElementById("ProductBrowser-1");window.Ecwid.ProductBrowser.element=a.getElementsByClassName&&a.getElementsByClassName("ecwid-productBrowser")[0]||function(){var b,c;c=/(^| )ecwid-productBrowser( |$)/;for(b in a.getElementsByTagName("div"))if(b.className.match(c))return b}()});Ecwid.OnPageLoaded.add(function(a){if(a.type==="PRODUCT")window.Ecwid.ProductBrowser.element.className+=" ecwid-productBrowser-ProductInCategory-"+a.categoryId});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment