Skip to content

Instantly share code, notes, and snippets.

@makfruit
makfruit / ecwid_clear_billing_form.html
Created November 30, 2012 14:05
An HTML/Javascript snippet for Ecwid to clear billing form inputs after the 'My billing address is the same as shipping' checkbox is un-ticked
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script>
if (typeof(Ecwid) == 'object') {
// Add handler for Ecwid's OnPageLoad event
Ecwid.OnPageLoaded.add(function(page) {
if ('CHECKOUT_PAYMENT_DETAILS' == page.type) {
jQuery('.ecwid-AddressForm input[type=checkbox]').first().click(function() {
if (!this.checked) {
jQuery('.ecwid-AddressForm input[type=text]').val('');
}
@makfruit
makfruit / ecwid_preorder_for_unlimited_stock.html
Created December 5, 2012 11:19
A script for Ecwid to display the 'Preorder' label instead of 'In stock' when a product has unlimited stock quantity
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script>
if (typeof(Ecwid) == 'object') {
Ecwid.OnAPILoaded.add(function() {
var preorderLabel = "Preorder";
function checkPreorder() {
if (
!jQuery(".ecwid-productBrowser-details-qtyAvailInfo").is(':visible')
&& jQuery(".ecwid-productBrowser-details-outOfStockLabel").length == 0
@makfruit
makfruit / ecwid_move_related_products.html
Last active December 15, 2015 02:19
A drop-in HTML/Javascript snippet for Ecwid to move the 'You may also like' section to underneath the product image (in between the image and the product description). Place it _after_ the Ecwid integration code.
@makfruit
makfruit / ecwid_alter_buy_now.css
Last active April 25, 2021 20:49
A CSS code snippet for Ecwid to alter the Buy now buttons styles. Online buttons generators used: - http://css3button.net/76603 - http://dabuttonfactory.com/
/* Styles for the 'Buy now' button */
button.ecwid-AccentedButton {
height: auto;
}
button.ecwid-AccentedButton {
font-size: 13px;
color: #ffffff;
padding: 9px 18px;
background: -moz-linear-gradient(
@makfruit
makfruit / ecwid_buy_now_shiny_blue.css
Last active April 25, 2021 20:48
A CSS snippet for Ecwid to alter buy now buttons. The button CSS styles is from this list: http://hellohappy.org/css3-buttons/ ('Shiny blue')
/*
* A CSS snippet for Ecwid to alter buy now buttons.
* The button CSS styles is from this list: http://hellohappy.org/css3-buttons/ ('Shiny blue')
*/
/* This code prevents the button height issues and default IE fallbacks in Ecwid */
button.ecwid-AccentedButton,
button.ecwid-AccentedButton:hover,
button.ecwid-AccentedButton:active {
height: auto;
@makfruit
makfruit / ecwid_options_expander.html
Last active December 15, 2015 18:19
An HTML/Javascript code snippet for Ecwid to show/hide product options depending on a trigger(expander) option
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript">
/* An HTML/Javascript code snippet for Ecwid to show/hide product options depending on a trigger(expander) option */
if (typeof(Ecwid) == 'object') {
Ecwid.OnAPILoaded.add(function() {
var expanderOptionName = "Do_you_want_extra_options";
var expanderOptionFlagValue = "Yes";
function checkExpandableOptions() {
@makfruit
makfruit / ecwid_force_logout_after_order.html
Created April 11, 2013 13:24
A drop-in HTML/JS script for Ecwid to force logout after an order is placed
<script type="text/javascript">
// A drop-in HTML/JS script for Ecwid to force logout after an order is placed
if (typeof(Ecwid) == 'object') {
Ecwid.OnPageLoaded.add(function(page) {
if ('ORDER_CONFIRMATION' == page.type) {
var localStoragePrefix = 'PSecwid__' + Ecwid.getOwnerId() + 'PS';
var isLoggedIn = (localStorage.getItem(localStoragePrefix + 'token') != null);
if (isLoggedIn) {
var itemsToRemove = ['token','customerid','profile'];
for (var i = 0; i < itemsToRemove.length; i++) {
@makfruit
makfruit / ecwid_disallow_purchasing_for_categories.html
Created April 19, 2013 10:22
An HTML/Javascript code snippet for Ecwid to disallow purchasing of products from certain categories
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript">
/* An HTML/Javascript code snippet for Ecwid to disallow purchasing of products from certain categories */
if (typeof(Ecwid) == 'object') {
Ecwid.OnAPILoaded.add(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 = [
1234567,
5286250
@makfruit
makfruit / ecwid_redirect_continue_shopping.html
Last active April 25, 2021 20:48
An HTML/Javascript code snippet for Ecwid to redirect continue shopping buttons to a custom page
<!-- An HTML/Javascript code snippet for Ecwid to redirect continue shopping buttons to a custom page -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
<script>
if (typeof(Ecwid) == 'object') {
Ecwid.OnAPILoaded.add(function() {
// Redirect address. Change it to the URL of page where you want to redirect your customers.
// You can use absolute or relative addresses, e.g. 'index.html', 'http://google.com'
var continueShoppingRedirect = "#!/~/category/id=0";
// Delay (ms), which is necessary for the empty cart page to appear after onCartChange event firing
@makfruit
makfruit / ecwid_move_pagination_bar_to_top.html
Created August 23, 2013 10:38
An HTML/Javascript code snippet for Ecwid to move the pagination bar to the top of product listing
<!-- An HTML/Javascript code snippet for Ecwid to redirect continue shopping buttons to a custom page -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
<script>
if (typeof(Ecwid) == 'object') {
Ecwid.OnAPILoaded.add(function() {
Ecwid.OnPageLoaded.add(function(page) {
jQuery('.ecwid-pager').removeClass('ecwid-pager-hasTopSeparator').insertAfter('div.ecwid-results-topPanel-itemsCountLabel');
});
});
}