Navy/Marine Corps Ribbon
Price: $2.99
Navy/Marine Corps Medal Ribbon, Presented to US Navy and Marine Corps.
curInventory) {
// Whoops! Not enough inventory!
var s = (curInventory==1)? '':'s';
alert('Sorry, but we only have '+curInventory+' item'+s+' in stock. You may only choose up to that many items.');
$('#qty').val(curInventory).focus();
return false;
}
// Just a small "are you sure"
if(quantity >= 99) {
if(!confirm('Are you sure you want this quantity?')) {
$('#qty').val(1);
return false;
}
}
// Submit form if everything is good
return true;
} else { // Invalid!
alert('Please select a value for each product option.');
invalidField.focus();
return false;
}
});
// Image swap
function updateProduct() {
$.post('http://www.collarsrus.com/products/compute_price', $('#options-form').serialize(), function(data) {
curInventory = Number(data.inventory);
// Defaults
$('.add-cart-btn').show();
$('.stock-amount').show();
$('.quantity-field').show();
// No Tracking
if (data.inventory === '') {
curInventory = false;
$('.stock-amount').hide();
// Out of Stock
} else if (data.inventory == 0) {
$('.stock-amount span').text('Out Of Stock');
$('.add-cart-btn').hide();
$('.quantity-field').hide();
// Stock Available
} else {
$('.stock-amount span').text(data.inventory);
}
if(data.image_url) {
$('.main-img img').attr('src', data.image_url);
$('.main-img a').attr('href', data.image_url).css('background-image', 'url('+data.image_url+')');
}
if (data.price) {
// Pad with zeros
var cents = data.price.toString().split('.'); // Note: toString() needed for IE
if (cents[1]==null) data.price += '.00'; // No cents at all
else if (cents[1].length == 1) data.price += '0'; // Divisible by ten
var formatter = new Intl.NumberFormat('en-US', {
style: 'currency',
currency: 'USD',
});
$('span.price').html(formatter.format(data.price));
}
// If any option hasn't yet been set, we should NOT show the "out of stock" message
var notSelected = false;
var options = $('#options-form select');
if (options.length>1) for (var i=0; i