Created
May 18, 2012 14:53
-
-
Save genee19/2725680 to your computer and use it in GitHub Desktop.
A quick snippet to have the zero prices automatically hidden in the product details page in Ecwid. Add the code into the HTML of your store page, after Ecwid widgets.
This file contains hidden or 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 type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.js"></script> | |
<script> | |
(function() { | |
var __indexOf = [].indexOf || function(item) { for (var i = 0, l = this.length; i < l; i++) { if (i in this && this[i] === item) return i; } return -1; }; | |
var categories; | |
/* if you need to have the zero price generally visible in the store and hide them only in some categories, you can put those categories' IDs, comma separated, into categories array below */ | |
categories = []; | |
/* like | |
categories = [2222333, 44455555]; | |
*/ | |
Ecwid.OnAPILoaded.add(function() { | |
var zeroval; | |
zeroval = Ecwid.formatCurrency(0); | |
Ecwid.OnPageLoaded.add(function(page) { | |
var $, _ref; | |
$ = window.jQuery; | |
if (page.type === 'PRODUCT' && ((__indexOf.call(categories, page.categoryId) >= 0) || categories.length === 0)) { | |
$('div.ecwid-productBrowser-price:contains("'+zeroval+'")').css({ | |
display: 'none' | |
}); | |
} | |
}); | |
}); | |
})(); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment