');
jQuery('td#prod_item_' + this.sPKey + ' div.actions input.btn_addtocart').removeAttr('disabled');
//HideLoading();
}; //- Uom.drawPrice
Uom.loading = function () {
jQuery('td#prod_item_' + this.sPKey + ' div.actions input.btn_addtocart').attr('disabled','disabled');
jQuery('td#prod_item_' + this.sPKey + ' div.item_pricing').html(sLoadingMessage);
}; //- Uom.loading
/**
* toggleQty
*/
Uom.toggleQty = function () {
/*if(jQuery('#uom_type_' + this.sPKey).val() == 'sales'){
jQuery('#qty_' + this.sPKey).attr("name", 'sales_qty_' + this.sPKey);
} else {
jQuery('#qty_' + this.sPKey).attr("name", 'qty_' + this.sPKey);
}//-if(jQuery('#uom_type_' + vPKey).val() == 'sales')
NO! Don't do this!
*/
}; //- Uom.toggleDisplay
/**
* error
*/
Uom.error = function () {
alert('There was an error retrieving the information for the product you selected.');
}; //- Uom.error
})(UomJQ);
/**
* AJAX Call to remove item from favorites list.
*
* @author johns
* @since 10/15/2009
*/
function fncRemoveItem ( sProdKey ) {
jQuery.ajax({
url: sPageName,
data: 'pageaction=removefavitems&p_key=' + sProdKey + '&fl_key=' + sFl_Key + '&r_id=' + new Date().getTime(),
type: 'GET',
async: false,
dataType: 'text',
success: function () { fncRemoveItemCompleted ( sProdKey ); }
});
} //- function fncRemoveItem ( sProdKey )
//- EVENT FUNCTIONS ==================================================
function fncRemoveItemCompleted( p_key ) {
//list view
var $container = jQuery('td#prod_item_' + p_key);
var $container2 = jQuery('tr#' + p_key);
if ($container.length > 0) {
// $container.hide();
$container.remove();
} else {
// $container2.hide();
$container2.remove();
}
//gallery view
$container = jQuery('div#prod_item_' + p_key);
if ($container.length > 0) {
$container.remove();
}
} //- function fncRemoveItemCompleted( p_key )
//================================================================
function closeCartLightbox() {
if (jQuery('#cart_window_unused').length) {
//cart_window
oAjax.Reset();
oAjax.RequestFile = 'i_i_shopping_cart_window.asp'
oAjax.Method = 'GET';
oAjax.onCompletion = function () {
jQuery('#cart_window_unused').replaceWith(oAjax.Response);
jQuery("#atc_msg_buttons").show();
tb_init('#cartwin_shipping a.thickbox');
};
oAjax.ResponseType = 'text'; //- The format of returned data. xml, text, json.
oAjax.RunAJAX();
}
jQuery('#atc_msg_product, #atc_msg_notice').empty();
}
/**
* This will perform an ajax get request on the ORDERFRONTURL's
* showcart.asp page to create a cookie of the SSL domain to
* maintain session information such as the shopping cart.
*
* @author lroselli
* @since 04/10/2013
*/
function fncBuildSSLCookie() {
// ddara - 9/22/2014
// This is only required when the SSL is on a domain that is different from the rest of the site.
// We must strip the protocol since they are often times different, even if the domains are the same.
// ASP detected that the storefront and orderfront domains are the same and thus the SSL
// cookie pass through is not required.
} //- fncBuildSSLCookie
/**
* This function handles calling the add to cart page via ajax for
* a single product key.
*
* @author johns
* @since 03/19/2013
*
* @modified johns - 3/19/2013: added param "bIsAccessory" and the code w/ it
*
* @param p_key (string): key of the product to be added to
* cart
* @param bIsAccessory (bool): is the call coming from product addon window
*
* @return
*/
function ajaxAddKeys(p_key, bIsAccessory) {
var sStockStatus = '';
var sAtcType = 'POST';
var sAtcSfx = '_' + p_key;
if (bIsAccessory === undefined) {
bIsAccessory = false;
}
var sUomData = '';
var sUomType = '';
var sUom = '';
var sUomStd = '';
var iUomSalesConv = 0;
var iMaxQty = '';
var iMinQty = '';
try {
$qtybox = jQuery('#qty_' + p_key);
var iQtyMultiplier = jQuery('#multiplier_on_qty_display_' + p_key).val();
if (iQtyMultiplier === undefined) {
iQtyMultiplier = 1;
}
if (bShowSalesUOM) {
sUomType = jQuery('#uom_type_' + p_key).val();
sUom = jQuery('#uom_' + sUomType + '_' + p_key).val();
sUomStd = jQuery('#uom_std_' + p_key).val();
iUomSalesConv = jQuery('#uom_conv_' + p_key).val();
sUomData += '&uom=' + sUom + '&uomconv=' + iUomSalesConv + '&uomtype=' + sUomType;
if (bShowNativeUOMinCart) {
sUomData += '&stduom=' + sUomStd;
}
}
var sQty = $qtybox.val();
var sProduct;
var sProductImage;
var $container;
if (jQuery('#prod_item_' + p_key).length > 0) {
// product html for gallery view
$container = jQuery('#prod_item_' + p_key).children('.prod_item_pad');
sProductName = $container.children('.nm').html();
sInStock = jQuery('#in_stock_' + p_key).val();
if (sInStock !== undefined && sInStock !== '') {
sStockStatus = '&in_stock_' + p_key + '=' + sInStock;
}
jQuery('#atc_msg_product').addClass('prod_item');
sProductImage = '
' + $container.children('.thumb').html() + '
';
if ($container.children('.thumb').html() === null || typeof $container.children('.thumb').html() == 'undefined') {
sProductImage = '';
}
sProduct = sProductImage + '' + sProductName + ' (' + sQty + ')';
} else {
// product html for list view
$container = jQuery('#' + p_key);
sProdName = $container.children('td.product_desc').children('p').html();
sProdImage = $container.children('td.product_thumb').html();
if (sProdImage === null || typeof sProdImage == 'undefined') {
sProdImage = '';
}
sProduct = sProdImage + '' + sProdName + ' (' + sQty + ')';
} //- if ( jQuery('#prod_item_' + p_key).length > 0 )
var sPWID = '&pw_id' + sAtcSfx + '=' + (jQuery('#pw_id_' + p_key).val() || '');
if (parseFloat(sQty) > 0) {
if (bUsingOrderDetailTableForCarts) {
jQuery.ajax({
url: 'i_i_add_to_cart.asp?ajax=listview&action=postlogic',
data: 'type=ajaxadd&key=' + p_key + '&qty'+sAtcSfx+'=' + sQty + '&maxqty'+sAtcSfx+'='+iMaxQty + '&minqty'+sAtcSfx+'=' +iMinQty + '&multiplier_on_qty_display'+sAtcSfx+'='+iQtyMultiplier + sStockStatus + sUomData + sPWID,
cache: false,
type: sAtcType,
dataType: 'json',
success: function (jsonOrder) {
handleAjaxATCSuccess(bIsAccessory, p_key, sProduct, jsonOrder);
},
complete: function (jsonOrder) {
// Enable the ATC button for the particular product that it was clicked on.
$('button.order_btn[data-pkey="' + p_key + '"]').prop('disabled', false)
.children('i.icon-spinner').remove();
},
error: function (XMLHttpRequest, textStatus, errorThrown) {
alert('Error: ' + errorThrown);
}
});
} else {
jQuery.ajax({
url: 'i_i_add_to_cart.asp?ajax=listview',
data: 'type=ajaxadd&key=' + p_key + '&qty'+sAtcSfx+'=' + sQty + sStockStatus + sUomData,
cache: false,
type: sAtcType,
dataType: 'text',
error: function (jqXHR, textStatus, errorThrown) {
alert('Error: ' + errorThrown);
},
success: function (oData) {
handleAjaxATCSuccess(bIsAccessory, p_key, sProduct, oData);
},
complete: function () {
// Enable the ATC button for the particular product that it was clicked on.
$('button.order_btn[data-pkey="' + p_key + '"]').prop('disabled', false)
.children('i.icon-spinner').remove();
}
});
} //- if ( bUsingOrderDetailTableForCarts )
return true;
} else {
return false;
}
} catch (oError) {
jQuery('.atc_msg').hide()
return false;
}
} //- function ajaxAddKeys
/**
* This function the success of the ajax ATC call.
*
* @author johns
* @since 03/19/2013
*
* @param sP_Key (string): key of the product detail page loaded
* @param $oProd (jQuery object): contains the html of the product info
* to be loaded in the modal popup window
* @param bIsAccessory (bool): is the call coming from product addon window
*
* @return void
*/
function handleAjaxATCSuccess(bIsAccessory, sP_Key, $oProd, jsonOrder) {
/*
* added js var to perform based on whether or not the item just added was an addon product
* johns - 02/20/2013
*/
if ( bShowRecommendedItems && bIsAccessory ) {
jQuery('#atc_msg_product').html('');
jQuery('#qty_' + sP_Key).val('');
jQuery('#atc_msg').css('height', '400px');
} else if ( bShowRecommendedItems && ! bIsAccessory ) {
jQuery('#atc_msg_product').html($oProd);
jQuery.get('i_i_pc_add_ons.asp?searchstring=searchexact~p_id~' + sP_Key + '&modal=1&display=' + sRecommendedItemsView)
.done(function ( sData ) {
jQuery('#atc_msg_addon_container').html(sData);
if ( jQuery('#ors_eof_result').val().toLowerCase() !== 'false' ) {
jQuery('#atc_msg').removeClass('with-recommended');
jQuery('.viewport').css('height', '0');
jQuery('#atc_msg').show();
jQuery('#atc_msg_container').show();
} else {
jQuery('#atc_msg').show();
jQuery('#atc_msg_container').show();
} //- if ( jQuery('#ors_result').val().toLowerCase() !== 'false'
});
jQuery('body').addClass('modal-open');
try {
if(typeof jsonOrder == 'undefined') {
fncCartRefresh();
} else {
fncCartRefresh(jsonOrder[1].item_count, jsonOrder[1].o_total);
}
} catch(err) {
// Silently fail because this is only relevant
// with newer versions of cart preview
}
/*
* normal ajax atc window
* johns - 02/20/2013
*/
} else {
jQuery('#atc_msg_product').html($oProd);
jQuery('#atc_msg_buttons').show();
try {
if(typeof jsonOrder == 'undefined') {
fncCartRefresh();
} else {
fncCartRefresh(jsonOrder[1].item_count, jsonOrder[1].o_total);
}
} catch(err) {
// Silently fail because this is only relevant
// with newer versions of cart preview
}
} //- if ( bShowRecommendedItems && bIsAccessory )
if (!false) {
populateAtcConfirmationModal(sP_Key).done(showAtcConfirmationModal);
}
runHook('handleAtcSuccess',{
ProductKey: sP_Key
});
} //- function fncHandleAjaxATCSuccess ()
if (bDisableATCZeroQtyWarehouse) {
jQuery('td').delegate('[id^=pw_id_]', 'change', function(event) {
if (jQuery(event.target).children(':selected').text().indexOf("(Qty: 0)") > -1 || jQuery(event.target).children(':selected').text() == "[Select One]") {
sKey = jQuery(event.target).attr("id").replace('pw_id_', '')
jQuery('#' + sKey + ' .btn_addtocart').attr('disabled', 'disabled')
} else {
sKey = jQuery(event.target).attr("id").replace('pw_id_', '')
jQuery('#' + sKey + ' .btn_addtocart').removeAttr('disabled')
}
});
}
jQuery('[id*="get_wh_btn_"]').click(function(){
var sPKey = '';
sKey = $(this).attr("ID");
sPKey = sKey.replace('get_wh_btn_','');
fncGetNewProductWarehouse(sPKey);
});
function populateAtcConfirmationModal(sProductKey) {
var aRequirements = [];
aRequirements.push(populatePromoNotificationBar(sProductKey));
// Return a promise representing when all the requirements are finished.
return jQuery.when.apply(jQuery, aRequirements);
}
function populatePromoNotificationBar(sProductKey) {
return jQuery.ajax({
/* Can't use i_i_ page because the necessary classes are in the template. */
url: 'i_promo_notification_html.asp',
type: 'GET',
dataType: 'html',
data: {
pageaction: 'promo_notification_bar',
p_keys: sProductKey
}
}).done(function(sData) {
if (sData.length > 0) {
jQuery('#atc_msg').removeClass('modal-small').addClass('modal-large');
jQuery('#atc_promo_bar').html(sData);
jQuery('#atc_msg').one('hidden', resetPromotionNotificationBar);
// The ticker cannot be started until the elements are visible.
jQuery('#atc_msg').one('shown', function () {
jQuery('#atc_promo_bar .notification-center').trigger('notification-center-added');
});
} else {
resetPromotionNotificationBar();
}
}).fail(function() {
console.error("Unable to retrive promotion messages");
resetPromotionNotificationBar();
});
}
function resetPromotionNotificationBar() {
// Disable the notification bar before removing it so the function which runs on an
// interval doesn't error on the missing elements.
disableNotificationBar(jQuery('#atc_promo_bar'));
jQuery('#atc_msg').removeClass('modal-large').addClass('modal-small');
jQuery('#atc_promo_bar').empty();
}
function showAtcConfirmationModal() {
jQuery('#atc_msg').modal('show');
}
function fncGetNewProductWarehouse(sPKey) {
try {
jQuery.ajax({
url: sPageName
, data: ({ pageaction : 'getproductwarehouse'
,ajax : genID()
,key : sPKey
,getall : bInStockShowEmptyWarehouses
})
, cache: false
, dataType: "text"
, async: false
, success: function(data){
sDefaultWH = jQuery('#pw_id_' + sPKey).val();
fncDrawNewProductWarehouse(data,sPKey);
if (sDefaultWH.Len == 32) {
jQuery('#pw_id_' + sPKey).val(sDefaultWH);
} else {
jQuery("#pw_id_" + sPKey + " option").not(':contains("Qty: 0")').filter(':first').attr('selected',true);
}
}
});
} catch (err){
//alert(err.message);
}
}
function fncDrawNewProductWarehouse(data,sPKey) {
var aWareHouses, aSubWareHouses;
var sDisplay;
var bSelected = false;
if (data!='') {
$('#wh_td_' + sPKey).html('');
aWareHouses = data.split('|');
for (var i = 0; i [Select One]')
if (data!='') {
aWareHouses = data.split('|');
for (var i =0; i 1 [johns - 02/26/2016]
$('form input').each(function() {
if ($(this)[0].hasAttribute('step') && ( $(this).attr('step') !== '' || $(this).attr('step') > 1 )) {
$('form').attr('novalidate', 'novalidate');
return false;
}
});
});
// Broken Image Replacement
var utils = {};
utils.handleImageError = function (img) {
if ($(img).attr('src') !== 'images/no-image.png')
$(img).attr('src', 'images/no-image.png');
};