// Apply responsive bag body classname
if( window["responsiveBagAbTestOn"] != null && responsiveBagAbTestOn ) {
// Add responsiveBag classname to body
document.body.className += ' responsiveShoppingBag';
}
/****** END TOP NAV DROP DOWN *******/
jQuery(document).ready(function(){
jQuery("#divisionContainer li.division").on('mouseenter',function(){
if(jQuery(this).children('ul').length > 0){
var jSubmenu = jQuery(this).children('ul');
jSubmenu.prev().addClass('open');
jSubmenu.stop().slideDown();
}
});
jQuery("#divisionContainer li.division").on('mouseleave',function(){
if(jQuery(this).children('ul').length > 0){
var jSubmenu = jQuery(this).children('ul');
jSubmenu.stop().slideUp(1,function(){
jSubmenu.prev().removeClass('open');
});
}
});
//set on click handler for touchscreens
if(Modernizr.touch){
jQuery("#divisionContainer li.division").on('click',function(){
var retVal = true;
var jTrigger = jQuery(this).children('a');
if(jQuery(this).children('ul').length > 0 && !jTrigger.hasClass('open')){
var jSubmenu = jQuery(this).children('ul');
jTrigger.addClass('open');
jSubmenu.stop().slideDown();
var temp = setTimeout(function(){
jSubmenu.stop().slideUp(function(){
jTrigger.removeClass('open');
});
},4000);
retVal = false;
}
return retVal;
});
}
});
//check if we are in a petite or tall channel
jQuery(document).on('personalizationData:ready',function(){
if(typeof s != "undefined" && typeof s.channel != "undefined"){
if(s.channel.indexOf(":Tall") > 0){
jQuery(".division41728_notSelected").attr('class','division41728_selected');
}else if(s.channel.indexOf(":Petite") > 0){
jQuery(".division41714_notSelected").attr('class','division41714_selected');
}
}
})
/****** END TOP NAV DROP DOWN *******/
/*** FIX BACKGROUND FOR PREVIEW ONLY ***/
// if(location.host.indexOf(".gidapps.") >= 0 && typeof objPreview != "undefined"){
// objPreview.hidePreviewBar = objPreview.hidePreviewBar.wrap(function(originalMethod){
// originalMethod();
// var previewBarHeight = jQuery('#previewBar:visible').length > 0 ? jQuery('#previewBar').height() : 0;
// var offsetHeight = (jQuery('#universalBar').height() + previewBarHeight) - 20 ;
// if( window["responsiveBagAbTestOn"] != null && responsiveBagAbTestOn ) {
// offsetHeight += 10;
// }
// jQuery("body").css("background-position","center " + offsetHeight + "px");
// jQuery("#mastheadStamp").css("top",offsetHeight + "px");
// // jQuery("body").css("background-position","");
// // jQuery("#mastheadStamp").css("top","52px");
// });
// if(typeof objPreview != "undefined"){
// objPreview.setSiteWidePageStatus = objPreview.setSiteWidePageStatus.wrap(function(originalMethod,pages){
// originalMethod(pages);
// if(jQuery('#previewBar').css('display') == "block"){
// var previewBarHeight = jQuery('#previewBar:visible').length > 0 ? jQuery('#previewBar').height() : 0;
// var offsetHeight = (jQuery('#universalBar').height() + previewBarHeight) - 10;
// if( window["responsiveBagAbTestOn"] != null && responsiveBagAbTestOn ) {
// offsetHeight += 10;
// }
// jQuery("body").css("background-position","center " + offsetHeight + "px");
// jQuery("#mastheadStamp").css("top",offsetHeight + "px");
// }
// });
// }
// }
if(location.host.indexOf(".gidapps.") >= 0 && typeof objPreview != "undefined"){
objPreview.hidePreviewBar = objPreview.hidePreviewBar.wrap(function(originalMethod){
originalMethod();
fixPageBodyBackgroundPosition();
});
if(typeof objPreview != "undefined"){
objPreview.setSiteWidePageStatus = objPreview.setSiteWidePageStatus.wrap(function(originalMethod,pages){
originalMethod(pages);
fixPageBodyBackgroundPosition();
});
}
}
var fixPageBodyBackgroundPosition = function(){
offsetTopPos = jQuery("#divisionContainer").offset().top - 76;
jQuery("body").css("background-position","center " + offsetTopPos + "px");
}
jQuery(document).ready(fixPageBodyBackgroundPosition);
jQuery(window).load(fixPageBodyBackgroundPosition);
/*** END FIX BACKGROUND FOR PREVIEW ONLY ***/
//Fixes the left logo and page header for checkout page
jQuery(document).ready(function(){
if(location.pathname == "/checkout/order.do"){
jQuery("#topNav").css({height:"80px"});
jQuery("#storeLogoContainer").css({"height":"79px","border-bottom":"1px solid #134881"});
jQuery("body").css("background-position","center 52px");
}
});
Store Search:
var searchPage = false;
function detectSearch(){
if( jQuery('#newInputBox_topSearchText').val().toLowerCase() == 'search' || searchPage == true){
jQuery('#topSearchForm')[0].reset();
}
}
var expandSearchElements = function(){
var isExpanded = jQuery("#newInputBox_topSearchText").data('isexpanded') == 'true' ? true : false;
if(!isExpanded){
jQuery("#newInputBox_topSearchText").data('isexpanded','true');
jQuery("#newtopSearchInputs").animate({
"width":"160px"
});
jQuery("#divwrapper_topSearchText").animate({
"width":"155px"
});
jQuery("#newInputBox_topSearchText").animate({
"width":"130px"
});
if(clientBrowser.isIE7){
jQuery("#topSearch").css({"margin-left":"-90px"});
}
}
}
var collapseSearchElements = function(){
var searchStr = jQuery("#newInputBox_topSearchText").val();
var isEmpty = searchStr.toLowerCase() == 'search' || searchStr == '' ? true : false;
if(isEmpty){
jQuery("#newInputBox_topSearchText").data('isexpanded','false');
if(clientBrowser.isIE7){
jQuery("#topSearch").css({"margin-left":"0px"});
}
jQuery("#newtopSearchInputs").animate({
"width":"90px"
});
jQuery("#divwrapper_topSearchText").animate({
"width":"85px"
});
jQuery("#newInputBox_topSearchText").animate({
"width":"55px"
});
}
}
var svgSwitch = function(){
if(window.SVGAngle || document.implementation.hasFeature("http://www.w3.org/TR/SVG11/feature#BasicStructure", "1.1")){
jQuery('#divwrapper_topSearchText').css("background", "url(/Asset_Archive/ONWeb/content/0009/610/563/assets/magnifier_vector.svg) no-repeat");
jQuery('#divwrapper_topSearchText').css("background-size","11px 11px");
jQuery('#divwrapper_topSearchText').css('background-position', "center right");
}else if(clientBrowser.isFirefox3){
jQuery('#divwrapper_topSearchText').css("background", "url(/Asset_Archive/ONWeb/content/0009/610/563/assets/magnifier_bitmap.png) no-repeat");
jQuery('#divwrapper_topSearchText').css("background-size","11px 11px");
jQuery('#divwrapper_topSearchText').css('background-position', "7px 5px");
}
var searchText = document.URL.toQueryParams().searchText;
if (searchText !== undefined) {
searchPage = true;
var searchTextResult = document.URL.toQueryParams().searchText.split('+').join(' ');
jQuery('#newInputBox_topSearchText').val(searchTextResult);
}else{
jQuery('#newInputBox_topSearchText').val('SEARCH');
}
}
jQuery(document).ready(svgSwitch);
jQuery(document).ready(function(){
jQuery("#newInputBox_topSearchText").focusin(function(){
detectSearch();
expandSearchElements();
});
jQuery("#newInputBox_topSearchText").blur(function(){
collapseSearchElements();
});
});
/* search box submit handler OVERRIDE
* need to change strDefaultText so submit handler stops submitting searches for "search" */
objSearchBox.strDefaultText = "SEARCH";
if (location.pathname.match(/category.do/)) {
jQuery(document).ready(function() {
var navigationDiv = jQuery('#universalTopNavLayout');
newNavHeight = navigationDiv.height() + 135 + "px";
navigationDiv.css('height',newNavHeight);
jQuery('#eos-categeory-banner').show();
});
}
// Responsive bag JS overrides
if( window["responsiveBagAbTestOn"] != null && responsiveBagAbTestOn ) {
// Update EDFS popups - wipe inline CSS and jbox popups
jQuery('#EDFS_container_seg_1, #EDFS_container_seg_2, #EDFS_container_seg_3, #EDFS_container_seg_4, #EDFS_container_seg_5, #edfsContainer').attr('style','');
jQuery(document).ready( function() {
var edfsPostageStamp = jQuery('#EDFS_container_seg_1 a');
var edfsPopupStr = '/buy/info.do?cid=42021';
var edfsPopupWidth = '472';
var edfsPopupHeight = '450';
if( jQuery(window).width() < 569 ) {
//edfsPopupStr = '/Asset_Archive/ONWeb/content/0008/042/168/assets/popup.html';
edfsPopupWidth = '300';
edfsPopupHeight = '350';
}
if( edfsPostageStamp.length > 0 ) {
edfsPostageStamp.attr({ 'xxonclick':'', 'rel':'jbox', 'data-jbox-url':edfsPopupStr, 'data-jbox-width':edfsPopupWidth, 'data-jbox-height':edfsPopupHeight });
} //
jbox.checkDataAttributes();
});
}
Main Content
Skip to Shopping Bag , Skip to top of Save For Later , Skip to top of Subtotal , Skip to top of Shipping section , Skip to top of Checkout , Skip to About your order link , Skip to Security and policies link ,
Subtotal (14 items)
$187.29
Subtotal Before Tax
$194.29
Checkout
Saved for Later (0 items)
Save items while you're still exploring.
Select “Save for Later” for each item above that you'd like to save.
Sign in to see items you saved earlier.
KEEP SHOPPING
if (window.addEventListener) {
window.addEventListener('load', function() {
FastClick.attach(document.body);
}, false);
}
(function($) {
/* this is for the static edfs, logo and hiding universal bar in s bp*/
$(function () {
var shouldCare = /(order|orderConfirm|shopping_bag)\.do/.test(window.location.pathname) && $('.newSmBPLogo').length == 0,
universalBar;
if(shouldCare) {
universalBar = $('#universalBar')[0] || $('#responsiveUniversalBar')[0];
$($("#onesite-brandbar").text())
.insertAfter(universalBar);
}
});
})(jQuery);
/* Left Nav Override
* Override left nav links for Disney Category to InventoryCheck/Sold Out Redirect page
*/
// jQuery(document).ready(function(){
// var linkElement = jQuery('a.category:contains(Mickey Mouse Shop), a.categorySelected:contains(Mickey Mouse Shop)');
// if(linkElement.length > 0){
// var newHREF = linkElement.attr('href').replace('/browse/category.do?cid=','/browse/info.do?cid=96371&targetCID=');
// linkElement.attr('href',newHREF);
// }
// });
// jQuery(document).ready(function(){
// var catName = "Today Only: $5 Swim";
// var linkElement = jQuery('a.category:contains(catName), a.categorySelected:contains(catName)');
// if(linkElement.length > 0){
// var newHREF = linkElement.attr('href').replace('/browse/category.do?cid=','/browse/info.do?cid=96371&targetCID=');
// linkElement.attr('href',newHREF);
// }
// });
/* Limited Edition VI Bursts -- Spot Light*/
//productIDs : [],
var categoryVIBurstSpotL = {
model : {
cid : '8710245',
productIDs : [
977375092,
978794032,
978740022,
977279002,
977277042,
977369002,
123762012,
120362022,
978423022,
978395032,
122122002,
977887052,
143879032,
978407042,
978324022,
610900022
],
existingProductIDs : [],
iconPath : '',
excludeCID : '1017370'
},
controller : {
init : function(){
categoryVIBurstSpotL.controller.setAllProductIDs();
categoryVIBurstSpotL.model.iconPath = wcdLib.getAssetPath(categoryVIBurstSpotL.model.cid,'081614_US_Refinery29_channel_flag.gif');
categoryVIBurstSpotL.view.insertIcon();
},
/* set all the product id's on the current page into array */
setAllProductIDs : function(){
jQuery("img.gridProdImg").each(function(index,element){
categoryVIBurstSpotL.model.existingProductIDs.push(jQuery(element).attr('id'));
});
}
},
view : {
//insert icon for each product id that exists on current page
insertIcon : function(){
var model = categoryVIBurstSpotL.model;
var pid = '';
for(var i=0;i= 0){
jQuery("#" + model.existingProductIDs[i]).parent().append(" ");
}
}
}
}
};
var thisCIID = gidLib.getQuerystringParam("cid");
if( location.pathname == "/browse/category.do" && thisCIID != categoryVIBurstSpotL.model.excludeCID) {
jQuery(document).on('categoryFacetedSearchGrid:ready', function() {
var temp = setTimeout(categoryVIBurstSpotL.controller.init,500);
});
}
var doubleClickPixelPartner = new pixelManagementService.constructors.AbstractPixelPartner();
pixelManagementService.controller.pixelPartnerManager.setPixelPartnerToPixelPartnerRegistry(doubleClickPixelPartner);
with (doubleClickPixelPartner) {
isReadyForTransmission = false;
isWaitReport = false;
pixelPartnerId = "doubleClickPixelPartner";
pixelPartnerName = "DoubleClick Iframe Pixel Partner";
pixelPartnerCookieVarPrefix = "doubleClick";
pixelPartnerInboundParameterList = [];
pixelPartnerPersistedParameterList = [];
pixelPartnerStartDate = "2011/10/20";
pixelPartnerEndDate = "2020/10/24";
controller.setPixelPartnerModel = function() {
// Set DoubleClick config parameters for brands
this.model.config_gap_us = {
confirmation: { type : 'usgap534', cat : 'usgap269'},
bag: { type : 'usgap090', cat : 'usgap542'},
browse: { type : 'usgap090', cat : 'usgap037'},
currency : "USD",
src : 2840522
};
this.model.config_br_us = {
confirmation: { type : 'usban166', cat : 'usban828'},
bag: { type : 'usban607', cat : 'usban981'},
browse: { type : 'usban607', cat : 'usban884'},
currency : "USD",
src : 2840522
};
this.model.config_on_us = {
confirmation: { type : 'usold624', cat : 'usold194'},
bag: { type : 'usold987', cat : 'usold108'},
browse: { type : 'usold987', cat : 'usold797'},
currency : "USD",
src : 2840522
};
this.model.config_pl_us = {
confirmation: { type : 'uspip864', cat : 'uspip652'},
bag: { type : 'uspip685', cat : 'uspip428'},
browse: { type : 'uspip685', cat : 'uspip655'},
currency : "USD",
src : 2840522
};
this.model.config_at_us = {
confirmation: { type : 'usath604', cat : 'usath169'},
bag: { type : 'usath562', cat : 'usath310'},
browse: { type : 'usath562', cat : 'usath994'},
currency : "USD",
src : 2840522
};
// Set up configs for entering brand code
this.model.configs = { '1': this.model.config_gap_us, '2': this.model.config_br_us, '3' : this.model.config_on_us, '4' : this.model.config_pl_us, '10' : this.model.config_at_us };
this.model.config = this.model.config_on_us;
// Set metrics from PixMan library
var metricsLibrary = pixelManagementService.model.metricsLibrary;
this.model.enteringBrandCode = ( metricsLibrary.common.enteringBrandCode ) ? metricsLibrary.common.enteringBrandCode : '';
this.model.pageUrl = ( metricsLibrary.common.pageUrl ) ? encodeURIComponent(metricsLibrary.common.pageUrl) : '';
this.model.pageName = ( metricsLibrary.common.pageName ) ? encodeURIComponent(metricsLibrary.common.pageName) : '';
this.model.pageType = ( metricsLibrary.common.pageType ) ? metricsLibrary.common.pageType : '';
if( this.model.pageType.substr(0,1) == "/" ) { this.model.pageType = this.model.pageType.substr(1); }
this.model.pageId = ( metricsLibrary.common.pageId ) ? metricsLibrary.common.pageId : '';
this.model.lastInTID = ( metricsLibrary.common.tid ) ? metricsLibrary.common.tid : '';
this.model.apCode = ( metricsLibrary.common.ap ) ? metricsLibrary.common.ap : '';
this.model.isNewCustomer = ( metricsLibrary.common.isNewCustomer ) ? metricsLibrary.common.isNewCustomer : '';
this.model.visitorFlag = ( metricsLibrary.common.isRecognizedVisitor ) ? metricsLibrary.common.isRecognizedVisitor : '';
this.model.proto = window.location.protocol;
// Set product variables
var productList = ( metricsLibrary.shoppingBag.productList ) ? metricsLibrary.shoppingBag.productList : [];
var skus = "";
var prices = "";
var productNames = "";
var brands = "";
var prodQty = ( metricsLibrary.shoppingBag.productCount ) ? metricsLibrary.shoppingBag.productCount : 0;
if (typeof(productList != "undefined") && Object.isArray(productList) && productList.length != 0 && productList[0].skuId != "") { //to be changed
prices = productList.pluck('price').join('|');
productNames = productList.pluck('productName').join('|');
brands = productList.pluck('productBrandCode').join('|');
productList.each( function( prod, i ) {
skus += prod.skuId;
if( ( i + 1 ) != productList.length ) { skus += "|"; }
});
}
this.model.itemPrices = prices;
this.model.itemBrands = brands;
this.model.qty = prodQty;
this.model.productSkus = skus;
}
controller.setPixelPartnerTransmissionTemplate = function() {
var shoppingBagUrls = ['/buy/shopping_bag.do','/buy/shopping_bag_delete_item.do','/buy/shopping_bag_save_item.do','/buy/shopping_bag_move_item.do','/buy/edit_shipping_method_bag.do'];
var metricsLibrary = pixelManagementService.model.metricsLibrary;
var axel = Math.random() + "";
var a = axel * 10000000000000;
if (location.pathname == "/checkout/orderConfirm.do") {
if( this.model.enteringBrandCode ) {
this.model.config = this.model.configs[ this.model.enteringBrandCode ] || this.model.config;
}
// Set order metrics
// Quantity fix
var orderProductList = ( metricsLibrary.order.productList ) ? metricsLibrary.order.productList : [];
var orderProductQty = 0;
if (typeof(orderProductList != "undefined") && Object.isArray(orderProductList) && orderProductList.length != 0 && orderProductList[0].productBusinessId != "") {
orderProductList.each( function( prod, i ) {
orderProductQty += parseInt( prod.quantity );
});
}
this.model.qty = orderProductQty.toString();
// Check/set metrics to partner
this.model.grossMerchDemand = ( metricsLibrary.order.orderTotal ) ? metricsLibrary.order.orderTotal : 0;
this.model.checkoutBrand = ( metricsLibrary.order.checkoutBrand ) ? metricsLibrary.order.checkoutBrand : '';
this.model.shippingZip = ( metricsLibrary.order.shippingZip ) ? encodeURIComponent( metricsLibrary.order.shippingZip ) : '';
this.model.billingZip = ( metricsLibrary.order.billingZip ) ? encodeURIComponent( metricsLibrary.order.billingZip ) : '';
this.model.orderId = ( metricsLibrary.order.orderId ) ? metricsLibrary.order.orderId : '';
this.model.promotionSubTotal = ( metricsLibrary.order.promotionSubTotal ) ? parseFloat( metricsLibrary.order.promotionSubTotal ) : 0;
this.model.promotionRewardsTotal = ( metricsLibrary.order.promotionRewardsTotal ) ? parseFloat( metricsLibrary.order.promotionRewardsTotal ) : 0;
this.model.giftServicesTotal = ( metricsLibrary.order.giftServicesTotal ) ? parseFloat( metricsLibrary.order.giftServicesTotal ) : 0;
this.model.shippingTotal = ( metricsLibrary.order.shippingTotal ) ? parseFloat( metricsLibrary.order.shippingTotal ) : 0;
this.model.taxTotal = ( metricsLibrary.order.taxTotal ) ? parseFloat( metricsLibrary.order.taxTotal ) : 0;
this.model.orderTotal = ( metricsLibrary.order.orderTotal ) ? parseFloat( metricsLibrary.order.orderTotal ) : 0;
// Fixes rounding problem and convert data back to string for passing in URL
this.model.myShipTotal = parseInt( this.model.shippingTotal*100 );
this.model.myTaxTotal = parseInt( this.model.taxTotal*100 );
this.model.myOrderTotal = parseInt( this.model.orderTotal*100 );
this.model.myTotal = this.model.myOrderTotal - this.model.myShipTotal - this.model.myTaxTotal;
this.model.myTotal = parseFloat(this.model.myTotal/100);
this.model.netDemand = this.model.myTotal;
this.model.grossMerchandise = this.model.netDemand + this.model.promotionSubTotal;
this.model.grossMerchandise = this.model.grossMerchandise.toString();
this.pixelPartnerTransmissionTemplate = new Template(
"");
}
else if ( shoppingBagUrls.include( location.pathname ) ) {
this.model.pageType = "shopping_bag";
this.pixelPartnerTransmissionTemplate = new Template(
"<\/iframe>" );
}
else if (window.location.protocol != "https:") {
this.pixelPartnerTransmissionTemplate = new Template(
"<\/iframe>" );
}
}
controller.setCleanUp = function() {
// alert("setCleanUp() running: pixelPartnerName = " + this.pixelPartnerName);
}
}
var rangeDoubleClickPixelPartner = new pixelManagementService.constructors.AbstractPixelPartner();
pixelManagementService.controller.pixelPartnerManager.setPixelPartnerToPixelPartnerRegistry(rangeDoubleClickPixelPartner);
with (rangeDoubleClickPixelPartner) {
isReadyForTransmission = false;
isWaitReport = false;
pixelPartnerId = "rangeDoubleClickPixelPartner";
pixelPartnerName = "Range DoubleClick Pixel Partner";
pixelPartnerCookieVarPrefix = "rangeDoubleClick";
pixelPartnerInboundParameterList = [];
pixelPartnerPersistedParameterList = [];
pixelPartnerStartDate = "2011/10/20";
pixelPartnerEndDate = "2020/10/24";
controller.setPixelPartnerModel = function() {
// Range DFA Configs
this.model.config_range_gap_us = {
confirmation: { type : 'confi102', cat : 'gapco477'},
currency : "USD",
src : 1890739
};
this.model.config_range_br_us = {
confirmation: { type : 'confi102', cat : 'brcon200'},
currency : "USD",
src : 1890739
};
this.model.config_range_on_us = {
confirmation: { type : 'confi102', cat : 'oncon155'},
currency : "USD",
src : 1890739
};
this.model.config_range_pl_us = {
confirmation: { type : 'confi102', cat : 'piper427'},
currency : "USD",
src : 1890739
};
this.model.config_range_at_us = {
confirmation: { type : 'confi102', cat : 'at_co303'},
currency : "USD",
src : 1890739
};
// Set up configs for entering brand code
this.model.configs_range = { '1': this.model.config_range_gap_us, '2': this.model.config_range_br_us, '3' : this.model.config_range_on_us, '4' : this.model.config_range_pl_us, '10' : this.model.config_range_at_us };
this.model.config_range = this.model.config_range_on_us;
// Set metrics from PixMan library
var metricsLibrary = pixelManagementService.model.metricsLibrary;
this.model.enteringBrandCode = ( metricsLibrary.common.enteringBrandCode ) ? metricsLibrary.common.enteringBrandCode : '';
this.model.pageUrl = ( metricsLibrary.common.pageUrl ) ? encodeURIComponent(metricsLibrary.common.pageUrl) : '';
this.model.pageName = ( metricsLibrary.common.pageName ) ? encodeURIComponent(metricsLibrary.common.pageName) : '';
this.model.pageType = ( metricsLibrary.common.pageType ) ? metricsLibrary.common.pageType : '';
if( this.model.pageType.substr(0,1) == "/" ) { this.model.pageType = this.model.pageType.substr(1); }
this.model.pageId = ( metricsLibrary.common.pageId ) ? metricsLibrary.common.pageId : '';
this.model.lastInTID = ( metricsLibrary.common.tid ) ? metricsLibrary.common.tid : '';
this.model.apCode = ( metricsLibrary.common.ap ) ? metricsLibrary.common.ap : '';
this.model.isNewCustomer = ( metricsLibrary.common.isNewCustomer ) ? metricsLibrary.common.isNewCustomer : '';
this.model.visitorFlag = ( metricsLibrary.common.isRecognizedVisitor ) ? metricsLibrary.common.isRecognizedVisitor : '';
this.model.proto = window.location.protocol;
// Set product variables
var productList = ( metricsLibrary.shoppingBag.productList ) ? metricsLibrary.shoppingBag.productList : [];
var skus = "";
var prices = "";
var productNames = "";
var brands = "";
var prodQty = ( metricsLibrary.shoppingBag.productCount ) ? metricsLibrary.shoppingBag.productCount : 0;
if (typeof(productList != "undefined") && Object.isArray(productList) && productList.length != 0 && productList[0].skuId != "") { //to be changed
prices = productList.pluck('price').join('|');
productNames = productList.pluck('productName').join('|');
brands = productList.pluck('productBrandCode').join('|');
productList.each( function( prod, i ) {
skus += prod.skuId;
if( ( i + 1 ) != productList.length ) { skus += "|"; }
});
}
this.model.itemPrices = prices;
this.model.itemBrands = brands;
this.model.qty = prodQty;
this.model.productSkus = skus;
}
controller.setPixelPartnerTransmissionTemplate = function() {
var shoppingBagUrls = ['/buy/shopping_bag.do','/buy/shopping_bag_delete_item.do','/buy/shopping_bag_save_item.do','/buy/shopping_bag_move_item.do','/buy/edit_shipping_method_bag.do'];
var metricsLibrary = pixelManagementService.model.metricsLibrary;
var axel = Math.random() + "";
var a = axel * 10000000000000;
var partnerCookieValue = metricsLibrary.common.ap;
if (location.pathname == "/checkout/orderConfirm.do" && partnerCookieValue == "14") {
if( this.model.enteringBrandCode ) {
this.model.config_range = this.model.configs_range[ this.model.enteringBrandCode ] || this.model.config_range;
}
// Set order metrics
// Quantity fix
var orderProductList = metricsLibrary.order.productList;
var orderProductQty = 0;
if (typeof(orderProductList != "undefined") && Object.isArray(orderProductList) && orderProductList.length != 0 && orderProductList[0].productBusinessId != "") {
orderProductList.each( function( prod, i ) {
orderProductQty += parseInt( prod.quantity );
});
}
this.model.qty = orderProductQty.toString();
this.model.grossMerchDemand = ( metricsLibrary.order.orderTotal ) ? metricsLibrary.order.orderTotal : 0;
this.model.checkoutBrand = ( metricsLibrary.order.checkoutBrand ) ? metricsLibrary.order.checkoutBrand : '';
this.model.shippingZip = ( metricsLibrary.order.shippingZip ) ? encodeURIComponent( metricsLibrary.order.shippingZip ) : '';
this.model.billingZip = ( metricsLibrary.order.billingZip ) ? encodeURIComponent( metricsLibrary.order.billingZip ) : '';
this.model.orderId = ( metricsLibrary.order.orderId ) ? metricsLibrary.order.orderId : '';
this.model.promotionSubTotal = ( metricsLibrary.order.promotionSubTotal ) ? parseFloat( metricsLibrary.order.promotionSubTotal ) : 0;
this.model.promotionRewardsTotal = ( metricsLibrary.order.promotionRewardsTotal ) ? parseFloat( metricsLibrary.order.promotionRewardsTotal ) : 0;
this.model.giftServicesTotal = ( metricsLibrary.order.giftServicesTotal ) ? parseFloat( metricsLibrary.order.giftServicesTotal ) : 0;
this.model.shippingTotal = ( metricsLibrary.order.shippingTotal ) ? parseFloat( metricsLibrary.order.shippingTotal ) : 0;
this.model.taxTotal = ( metricsLibrary.order.taxTotal ) ? parseFloat( metricsLibrary.order.taxTotal ) : 0;
this.model.orderTotal = ( metricsLibrary.order.orderTotal ) ? parseFloat( metricsLibrary.order.orderTotal ) : 0;
// Fixes rounding problem
this.model.myShipTotal = parseInt( this.model.shippingTotal*100 );
this.model.myTaxTotal = parseInt( this.model.taxTotal*100 );
this.model.myOrderTotal = parseInt( this.model.orderTotal*100 );
this.model.myTotal = this.model.myOrderTotal - this.model.myShipTotal - this.model.myTaxTotal;
this.model.myTotal = parseFloat(this.model.myTotal/100);
this.model.netDemand = this.model.myTotal;
this.model.grossMerchandise = this.model.netDemand + this.model.promotionSubTotal;
this.pixelPartnerTransmissionTemplate = new Template(
" ");
}
}
controller.setCleanUp = function() {
// alert("setCleanUp() running: pixelPartnerName = " + this.pixelPartnerName);
}
}
var trialPayPixelPartner = new pixelManagementService.constructors.AbstractPixelPartner();
pixelManagementService.controller.pixelPartnerManager.setPixelPartnerToPixelPartnerRegistry(trialPayPixelPartner);
var shoppingBagUrls = ['/buy/shopping_bag.do','/buy/shopping_bag_delete_item.do','/buy/shopping_bag_save_item.do','/buy/shopping_bag_move_item.do','/buy/edit_shipping_method_bag.do'];
//Workaround for PixMan DATE_IN_USE
if ( shoppingBagUrls.include( location.pathname ) ){
gidLib.setCookieVar("PixManDateInUse", "dateInUse", pixelManagementService.constants.DATE_IN_USE);
}
if (location.pathname == "/checkout/order.do"){
pixelManagementService.constants.DATE_IN_USE =
gidLib.getCookieVar("PixManDateInUse", "dateInUse");
}
with (trialPayPixelPartner) {
isReadyForTransmission = false;
isWaitReport = false;
pixelPartnerId = "trialPayPixelPartner";
pixelPartnerName = "Trial Pay Pixel Partner";
pixelPartnerCookieVarPrefix = "trialPay";
pixelPartnerInboundParameterList = ["sid"];
pixelPartnerPersistedParameterList = ["sid"];
pixelPartnerStartDate = "2010/11/02";
pixelPartnerEndDate = "2020/12/20";
trialPayPixelPartner.model.aid = "103209";
controller.setPixelPartnerModel = function() {
var metricsLibrary = pixelManagementService.model.metricsLibrary;
var orderTotal = ( metricsLibrary.order.orderTotal ) ? parseFloat(metricsLibrary.order.orderTotal) : 0;
// Fixes rounding problem
var myShipTotal = ( metricsLibrary.order.shippingTotal ) ? parseInt(metricsLibrary.order.shippingTotal*100) : 0;
var myTaxTotal = ( metricsLibrary.order.taxTotal ) ? parseInt(metricsLibrary.order.taxTotal*100) : 0;
var myOrderTotal = parseInt(orderTotal*100);
var myTotal = myOrderTotal - myShipTotal - myTaxTotal;
model.netDemand = parseFloat(myTotal/100);
}
controller.setPixelPartnerTransmissionTemplate = function() {
var metricsLibrary = pixelManagementService.model.metricsLibrary;
var pageType = ( metricsLibrary.common.pageType ) ? metricsLibrary.common.pageType : '';
var partnerCookieValue = ( metricsLibrary.common.ap ) ? metricsLibrary.common.ap : '';
model.sid = controller.getCookieVar("sid");
if (pageType != null && pageType != undefined) {
/* order confirmation transmission template */
/* if (pageType == "orderConfirm" || pageType =="nav") { */
/* workaround for the pageTitle issue on VDEV */
if ((location.pathname == "/checkout/orderConfirm.do")&&(partnerCookieValue == "15")) {
this.pixelPartnerTransmissionTemplate = new Template(
" ");
}
}
}
}
var googleAdServicesPixelPartner = new pixelManagementService.constructors.AbstractPixelPartner();
pixelManagementService.controller.pixelPartnerManager.setPixelPartnerToPixelPartnerRegistry(googleAdServicesPixelPartner);
with (googleAdServicesPixelPartner) {
isReadyForTransmission = false;
isWaitReport = false;
pixelPartnerId = "googleAdServicesPixelPartner";
pixelPartnerName = "Google Ad Services Pixel Partner";
pixelPartnerCookieVarPrefix = "googleAdServices";
pixelPartnerInboundParameterList = [];
pixelPartnerPersistedParameterList = [];
pixelPartnerStartDate = "2011/01/26";
pixelPartnerEndDate = "2020/01/26";
googleAdServicesPixelPartner.model.google_conversion_id = "1003704305";
googleAdServicesPixelPartner.model.google_conversion_label = "WTmrCJ_gkgIQ8Z_N3gM";
googleAdServicesPixelPartner.model.guid = "ON";
controller.setPixelPartnerModel = function() {
// Pull in order subtotal (netDemand)
var metricsLibrary = pixelManagementService.model.metricsLibrary;
var orderTotal = ( metricsLibrary.order.orderTotal ) ? parseFloat(metricsLibrary.order.orderTotal) : 0;
var myShipTotal = ( metricsLibrary.order.shippingTotal ) ? parseInt(metricsLibrary.order.shippingTotal*100) : 0;
var myTaxTotal = ( metricsLibrary.order.taxTotal ) ? parseInt(metricsLibrary.order.taxTotal*100) : 0;
var myOrderTotal = parseInt(orderTotal*100);
var myTotal = myOrderTotal - myShipTotal - myTaxTotal;
model.netDemand = parseFloat(myTotal/100);
// Pull product list in proper format
var getFormattedProductListBound = this.controller.helper.getFormattedProductList.bind(this);
var formattedProductList = getFormattedProductListBound();
this.model.formattedProductList = formattedProductList;
}
controller.setPixelPartnerTransmissionTemplate = function() {
var metricsLibrary = pixelManagementService.model.metricsLibrary;
var pageType = ( metricsLibrary.common.pageType ) ? metricsLibrary.common.pageType : '';
var partnerCookieValue = ( metricsLibrary.common.ap ) ? metricsLibrary.common.ap : '';
if (pageType != null && pageType != undefined) {
if (( location.pathname == "/checkout/orderConfirm.do" ) && ( partnerCookieValue == "13" )) {
this.pixelPartnerTransmissionTemplate = new Template(
" ");
}
}
}
controller.setCleanUp = function() {
// alert("setCleanUp() running: pixelPartnerName = " + this.pixelPartnerName);
}
controller.helper = new Object();
// Product list with specific formatting
controller.helper.getFormattedProductList = function() {
var productList = null;
if( location.pathname == "/checkout/orderConfirm.do" ){
productList = ( this.model.metricsLibrary.order.productList ) ? this.model.metricsLibrary.order.productList : [];
}
var formattedProductList = "";
if( productList != null ) {
productList.each( function( prod ) {
var pricePer = prod.price/prod.quantity;
var sku9dig = '';
if( prod.skuId != null ) sku9dig = prod.skuId.substr(0,9);
formattedProductList += "("
formattedProductList += pricePer.toFixed(2) + "*";
formattedProductList += prod.quantity + "*";
formattedProductList += sku9dig + "*";
formattedProductList += "null*";
formattedProductList += sku9dig + ")";
});
}
return formattedProductList;
}
}
var brightTagPixelPartner = new pixelManagementService.constructors.AbstractPixelPartner();
pixelManagementService.controller.pixelPartnerManager.setPixelPartnerToPixelPartnerRegistry(brightTagPixelPartner);
with (brightTagPixelPartner) {
isReadyForTransmission = false;
isWaitReport = false;
pixelPartnerId = "brightTagPixelPartner";
pixelPartnerName = "Bright Tag Pixel Partner";
pixelPartnerCookieVarPrefix = "brightTag";
// 'sid' = TrialPay: maps to v1
pixelPartnerInboundParameterList = ['sid'];
pixelPartnerPersistedParameterList = ['sid'];
pixelPartnerStartDate = "2011/07/19";
pixelPartnerEndDate = "2020/07/19";
// BrightTag site id - region-specific (US, CA, EU)
brightTagPixelPartner.model.brighttag_site_id = "NaJ7y9Z";
// Currensy - u
brightTagPixelPartner.model.currencyType = "USD";
controller.getPixmanElement = function (variableName, pixManValue, suffix){
var returnKeyPair="";
if(suffix==null || suffix==undefined){
suffix="";
}
if(pixManValue!=null && pixManValue!=undefined && pixManValue!=""){
returnKeyPair = variableName + "=" + pixManValue + suffix;
}
else{
returnKeyPair="";
}
return returnKeyPair;
},
controller.setPixelPartnerModel = function() {
// Set BT variables from metricsLibrary
var metricsLibrary = pixelManagementService.model.metricsLibrary;
// Declare dynamic vendor metrics
this.model.vendorMetrics = { };
// TrialPay : AP=15 conditional; sid = v1
this.model.vendorMetrics.trialPay = { }
this.model.vendorMetrics.trialPay.sid = controller.getCookieVar("sid");
// BROWSE/BAG/ORDER CONF variables
// Total qty in cart - qty
if( location.pathname == "/checkout/orderConfirm.do" ) {
var orderProductList = ( metricsLibrary.order.productList ) ? metricsLibrary.order.productList : [];
var orderProductQty = 0;
if (typeof(orderProductList != "undefined") && Object.isArray(orderProductList) && orderProductList.length != 0 && orderProductList[0].productBusinessId != "") {
orderProductList.each( function( prod, i ) {
orderProductQty += parseInt( prod.quantity );
});
}
this.model.totalQty = orderProductQty.toString();
}
else {
this.model.totalQty = ( metricsLibrary.shoppingBag.productCount ) ? metricsLibrary.shoppingBag.productCount : 0;
}
// Entering brand code - tran - ONLY set if PARTNER cookie set
this.model.enteringBrandCode = ( metricsLibrary.common.enteringBrandCode ) ? metricsLibrary.common.enteringBrandCode : '';
var productList = ( metricsLibrary.shoppingBag.productList ) ? metricsLibrary.shoppingBag.productList : [];
// Product SKUs in Cart - pipe-delimited - u1
var skus = "";
// Product Item Prices in Cart - pipe-delimited - u6
var prices = "";
// Product Item Brands in Cart - pipe-delimited - u7
var brands = "";
// Product Item Quantities in Cart - pipe-delimited - u19
var prodQty = "";
if( typeof(productList != "undefined") && Object.isArray(productList) && productList.length != 0 && productList[0].skuDescription != "" ) {
// Set SKUs
productList.each( function( prod, i ) {
skus += prod.skuId;
if( ( i + 1 ) != productList.length ) { skus += "|"; }
});
// Set Item Prices
prices = productList.pluck('price').join('|');
// Set Item Brands
brands = productList.pluck('productBrandCode').join('|');
// Set Item Quantities
prodQty = productList.pluck('quantity').join('|');
}
this.model.itemPrices = prices;
this.model.itemBrands = brands;
this.model.prodQty = prodQty;
this.model.productSkus = skus;
// Page Type - u2
this.model.pageType = ( metricsLibrary.common.pageType ) ? metricsLibrary.common.pageType : '';
if( this.model.pageType.substr(0,1) == "/" ) { this.model.pageType = this.model.pageType.substr(1); }
// Page ID - u3 - CID, Outfit ID or Product ID
this.model.pageId = ( metricsLibrary.common.pageId ) ? metricsLibrary.common.pageId : '';
if( metricsLibrary.common.pageName && ( location.pathname == '/' || location.pathname == '/browse/home.do' ) ) {
// Fix CIDs not being pulled on home page content
if( metricsLibrary.common.pageName.substr( 0, 2 ) == 'gp' ) { this.model.pageId = '5058'; }
else if( metricsLibrary.common.pageName.substr( 0, 2 ) == 'on' ) { this.model.pageId = '5151'; }
else if( metricsLibrary.common.pageName.substr( 0, 2 ) == 'br' ) { this.model.pageId = '5001'; }
else if( metricsLibrary.common.pageName.substr( 0, 2 ) == 'bg' ) { this.model.pageId = '15956'; }
else if( metricsLibrary.common.pageName.substr( 0, 2 ) == 'at' ) { this.model.pageId = '46650'; }
}
// AP (Affiliate Partner) Value - u4 - ONLY set if PARTNER cookie set
this.model.apCode = ( metricsLibrary.common.ap ) ? metricsLibrary.common.ap : '';
// Last in TID - u5 - Last tracking ID recieved; ONLY set if PARTNER cookie set
this.model.lastInTID = ( metricsLibrary.common.tid ) ? metricsLibrary.common.tid : '';
// Page Name - u9 - Omniture Page Name
this.model.pageName = ( metricsLibrary.common.pageName ) ? encodeURIComponent( metricsLibrary.common.pageName ) : '';
// Page URL - u10 - Full page URL
this.model.pageURL = ( metricsLibrary.common.pageUrl ) ? encodeURIComponent( metricsLibrary.common.pageUrl ) : '';
// Is New Customer flag - u11
this.model.isNewCustomer = ( metricsLibrary.common.isNewCustomer ) ? metricsLibrary.common.isNewCustomer : '';
// Recognized Visitor flah - u14
this.model.isRecognizedVisitor = ( metricsLibrary.common.isRecognizedVisitor ) ? metricsLibrary.common.isRecognizedVisitor : '';
// Unknown shopper ID - u20 - GID unknown shopper ID
// "988B422DA188A5C5DFCD32567DDBA4ED|||"
if( gidLib.getCookie('unknownShopperId') != 0 ) {
this.model.unknownShopperID = gidLib.getCookie('unknownShopperId');
this.model.unknownShopperID = this.model.unknownShopperID.substr( 0, this.model.unknownShopperID.indexOf('|') );
}
else {
this.model.unknownShopperID = '';
}
// Customer ID - u21 - GID KNOWN customer ID
// "40895368|||"
if( gidLib.getCookie('customerId') != 0 ) {
this.model.customerID = gidLib.getCookie('customerId');
this.model.customerID = this.model.customerID.substr( 0, this.model.customerID.indexOf('|') );
}
else {
this.model.customerID = '';
}
// DotomiToken - u26 - 22-25 taken in EU/JP - to merge in
this.model.dotomiToken = ( metricsLibrary.common.dotomiToken ) ? metricsLibrary.common.dotomiToken : '';
// DI ID - u27 - DI/Email ID - pulled from mktUniversalPersist
this.model.diID = ( gidLib.getCookieVar('mktUniversalPersist','DI') != '' ) ? gidLib.getCookieVar('mktUniversalPersist','DI') : '';
// Encrypted email cipher - u40
this.model.encryptionCipher = ( metricsLibrary.common.cipher ) ? metricsLibrary.common.cipher : '';
// Encrypted email vector - u41
this.model.encryptionVector = ( metricsLibrary.common.vector ) ? metricsLibrary.common.vector : '';
// Encrypted email string - u42
this.model.encryptedEmail = ( metricsLibrary.common.userEmailEncrypt ) ? metricsLibrary.common.userEmailEncrypt : '';
// Mobile vs desktop user - u44
// GID mobile detection includes: iPhone, iPod, Android Mobile ONLY
this.model.mobileVsDesktop = 'desktop';
var userAgentCheck = navigator.userAgent.toLowerCase();
if( responsiveService.api.isMobileBrowser() || /iphone|ipod/i.test( userAgentCheck ) || ( userAgentCheck.indexOf('android') > -1 && userAgentCheck.indexOf('mobile') > -1 ) ) {
this.model.mobileVsDesktop = 'mobile';
}
// PRODUCT PAGE ONLY variables
if( location.pathname == '/browse/product.do' ) {
// Set up product page data
this.model.productName = '';
this.model.productBrandCode = '';
this.model.productPrice = '';
this.model.productImage = '';
this.model.productSizesInStock = '';
this.model.productSizesOutOfStock = '';
this.model.productVendorName = '';
this.model.productOriginalPrice = '';
this.model.productDefaultCID = '';
this.model.currentDivisionName = '';
this.model.categoryNameClicked = '';
this.model.productOnOrder = '';
this.model.productLowInventory = '';
if( window["productService"] != null && productService.objP && productService.objV ) {
// Update URL if there's no CID in it
if( gidLib.getQuerystringParam('cid') == '' && this.model.pageURL.indexOf('cid') == -1 && productPage.strDefaultCategoryId ) {
this.model.pageURL += '%26cid%3D' + productPage.strDefaultCategoryId;
}
// Set default CID if CID is not in URL
if( gidLib.getQuerystringParam('cid') == '' && productPage.strDefaultCategoryId ) {
this.model.productDefaultCID = productPage.strDefaultCategoryId;
}
// Highlighted division pulled from page name metric
var currentDivisionName = '';
if( metricsLibrary.common.pageName != '' ) {
var pageNameArr = metricsLibrary.common.pageName.split(':');
if( pageNameArr.length > 2 ) {
if( pageNameArr[1] == 'browse' ) {
currentDivisionName = pageNameArr[2];
}
}
}
this.model.currentDivisionName = encodeURIComponent( currentDivisionName );
// Highlighted category name pulled from page leftnav
var categoryNameClicked = '';
if( jQuery('#sideNavCategories').length > 0 ) {
var selectedCategory = jQuery('#sideNavCategories a[class*="categorySelected"]');
if( selectedCategory.length > 0 ) {
categoryNameClicked += selectedCategory.text();
}
}
this.model.categoryNameClicked = encodeURIComponent( categoryNameClicked );
// Product Name - u28
if( productService.objP.strProductStyleName ) {
this.model.productName = encodeURIComponent( productService.objP.strProductStyleName );
// Check whether item has a vendor (ie. Piperlime), if so prepend vendor name
if( this.model.productName != '' && productService.objP.strVendorName && productService.objP.strVendorName != '' ) {
this.model.productName = productService.objP.strVendorName + ' ' + this.model.productName;
this.model.productVendorName = encodeURIComponent( productService.objP.strVendorName );
}
}
// Product Brand - u29 - brand code sent
if( productService.objP.brandCode ) {
this.model.productBrandCode = productService.objP.brandCode;
}
// Variant/color based
if( productService.hasOwnProperty('objV') && productService.hasOwnProperty('activeColor') ) {
var currentProductColor = productService.activeColor;
var currentProductColorObj = productService.objV.arrayVariantStyleColors[ currentProductColor ];
// Product Price - u30 - find selected variant/color to determine best
if( currentProductColorObj.price ) {
this.model.productPrice = currentProductColorObj.price;
//console.log('price set');
}
// Product Original Price - u35
if( currentProductColorObj.strRegularPrice ) {
this.model.productOriginalPrice = currentProductColorObj.strRegularPrice.replace('$','');
}
// Product Image URL - u31
if( currentProductColorObj.hasOwnProperty('arrayVariantStyleColorImages') ) {
if( currentProductColorObj.arrayVariantStyleColorImages['Main'] ) {
this.model.productImage = 'http://' + location.hostname + currentProductColorObj.arrayVariantStyleColorImages['Main'].strImagePath;
//console.log('image set from Main');
}
else if( currentProductColorObj.arrayVariantStyleColorImages['MainThumb'] ) {
this.model.productImage = 'http://' + location.hostname + currentProductColorObj.arrayVariantStyleColorImages['MainThumb'].strImagePath;
}
}
}
// Product Sizes In Stock - u32 - pulling from page
// Product Sizes Out of Stock - u33
var allSkus = productPage.objV.arrayVariantSkus;
var allSize1s = productPage.arrayAllSizeDimension1;
var allSize2s = productPage.arrayAllSizeDimension2;
var currentSkuId = '';
var currentSkuSize1 = '';
var currentSkuSize2 = '';
var currentSkuSizeDescription = '';
var sizeDesc = '';
var arrSkuSizesAll = [];
var arrSkuSizesInStock = [];
var arrSkuSizesOutOfStock = [];
if( allSize1s.length > 0 && allSize2s.length > 0 ) {
for( var i=0; i < allSize1s.length; i++ ) {
for( var j=0; j < allSize2s.length; j++ ) {
sizeDesc = '';
sizeDesc += allSize1s[i].strName + ':' + allSize2s[j].strName;
arrSkuSizesAll.push( sizeDesc );
}
}
}
else if( allSize1s.length > 0 ) {
for( var i=0; i < allSize1s.length; i++ ) {
sizeDesc = '';
sizeDesc += allSize1s[i].strName;
arrSkuSizesAll.push( sizeDesc );
}
}
//console.log( 'all sizes ' + arrSkuSizesAll );
jQuery.each(allSkus, function(key,valueObj){
// If the value is an object that represents an in-stock color/size SKU of the initially loaded color
var currentPid = productPage.strDefaultStyleColorId;
if( jQuery.type( valueObj ) == 'object' ) {
// Restrict to initially loaded color
if( valueObj.strSkuId.indexOf( currentPid ) > -1 ) {
currentSkuSizeDescription = '';
currentSkuId = valueObj.strSkuId;
currentSkuSize1 = valueObj.strSizeDim1Id;
currentSkuSize2 = valueObj.strSizeDim2Id;
if( allSize1s.length > 0 ) {
for( var i=0; i < allSize1s.length; i++ ) {
if( allSize1s[i].strId == currentSkuSize1 ) {
currentSkuSizeDescription += allSize1s[i].strName;
}
}
}
if( allSize2s.length > 0 ) {
for( var j=0; j < allSize2s.length; j++ ) {
if( allSize2s[j].strId == currentSkuSize2 ) {
currentSkuSizeDescription += ':' + allSize2s[j].strName;
}
}
}
//console.log( 'sku = ' + currentSkuId + '; size1 = ' + currentSkuSize1 + '; size2 = ' + currentSkuSize2 + '; sizeDesc = ' + currentSkuSizeDescription );
arrSkuSizesInStock.push( currentSkuSizeDescription );
}
}
});
//console.log( 'sizes in stock ' + arrSkuSizesInStock );
arrSkuSizesOutOfStock = jQuery.grep( arrSkuSizesAll, function( elt ) {
return jQuery.inArray( elt, arrSkuSizesInStock ) == -1;
});
//console.log( 'sizes out of stock ' + arrSkuSizesOutOfStock );
if( arrSkuSizesInStock.length > 0 ) {
// Replace ' ½' with 'half'
for( var i=0; i < arrSkuSizesInStock.length; i++ ) {
arrSkuSizesInStock[i] = arrSkuSizesInStock[i].replace(' ½','half');
}
this.model.productSizesInStock = arrSkuSizesInStock.join();
this.model.productSizesInStock = this.model.productSizesInStock.toLowerCase();
//console.log('in stock sizes set');
}
if( arrSkuSizesOutOfStock.length > 0 ) {
// Replace ' ½' with 'half'
for( var j=0; j < arrSkuSizesOutOfStock.length; j++ ) {
arrSkuSizesOutOfStock[j] = arrSkuSizesOutOfStock[j].replace(' ½','half');
}
this.model.productSizesOutOfStock = arrSkuSizesOutOfStock.join();
this.model.productSizesOutOfStock = this.model.productSizesOutOfStock.toLowerCase();
//console.log('out of stock sizes set');
}
// Is product on order - u45 - based on existance of an on-order date
var productOnOrder = 'false';
if( productPage.isSkuOnOrder(productPage.activeColor, productPage.activeSizeDimension1, productPage.activeSizeDimension2) != null ) {
productOnOrder = 'true';
}
this.model.productOnOrder = productOnOrder;
// Low Inventory - u46 - based on return of Low Inventory function
var productLowInventory = 'false';
if( productPage.isSkuLowInventory(productPage.activeColor, productPage.activeSizeDimension1, productPage.activeSizeDimension2) != null && productPage.isSkuLowInventory(productPage.activeColor, productPage.activeSizeDimension1, productPage.activeSizeDimension2) == true ) {
productLowInventory = 'true';
}
this.model.productLowInventory = productLowInventory;
}
}
// ORDER CONF ONLY variables
else if (location.pathname == "/checkout/orderConfirm.do") {
// Page Type fix on order conf page
this.model.pageType = 'orderConfirm';
// Order ID - ord - Gap.com order ID
this.model.orderId = ( metricsLibrary.order.orderId ) ? metricsLibrary.order.orderId : '';
this.model.promotionSubTotal = ( metricsLibrary.order.promotionSubTotal ) ? parseFloat( metricsLibrary.order.promotionSubTotal ) : 0;
this.model.promotionRewardsTotal = ( metricsLibrary.order.promotionRewardsTotal ) ? parseFloat( metricsLibrary.order.promotionRewardsTotal ) : 0;
this.model.giftServicesTotal = ( metricsLibrary.order.giftServicesTotal ) ? parseFloat( metricsLibrary.order.giftServicesTotal ) : 0;
this.model.shippingTotal = ( metricsLibrary.order.shippingTotal ) ? parseFloat( metricsLibrary.order.shippingTotal ) : 0;
this.model.taxTotal = ( metricsLibrary.order.taxTotal ) ? parseFloat( metricsLibrary.order.taxTotal ) : 0;
this.model.orderTotal = ( metricsLibrary.order.orderTotal ) ? parseFloat( metricsLibrary.order.orderTotal ) : 0;
// Fixes rounding problem
this.model.myShipTotal = parseInt( this.model.shippingTotal*100 );
this.model.myTaxTotal = parseInt( this.model.taxTotal*100 );
this.model.myOrderTotal = parseInt( this.model.orderTotal*100 );
this.model.myTotal = this.model.myOrderTotal - this.model.myShipTotal - this.model.myTaxTotal;
this.model.myTotal = parseFloat(this.model.myTotal/100);
// Total Merch (ie. Net Demand) - u15 - Order total - shipping - tax
this.model.netDemand = this.model.myTotal;
// Total Merch + promo dolloers (ie. Gross Merch Demand) - cost - Order total - shipping - tax + promo dollares
this.model.grossMerchandise = this.model.netDemand + this.model.promotionSubTotal;
// Checkout Brand - u8 - brand a user checks out on
this.model.checkoutBrand = ( metricsLibrary.order.checkoutBrand ) ? metricsLibrary.order.checkoutBrand : '';
// Shipping & Billing zips - u12, u13 respectively - user zip codes
this.model.shippingZip = ( metricsLibrary.order.shippingZip ) ? metricsLibrary.order.shippingZip : '';
this.model.billingZip = ( metricsLibrary.order.billingZip ) ? metricsLibrary.order.billingZip : '';
// Promotional dollars - u16 - coupon dollars
this.model.promoDollars = this.model.promotionSubTotal;
// Tax - u17 - tax amount
this.model.tax = this.model.taxTotal;
// Shipping - u18 - total shipping charged
this.model.shipping = this.model.shippingTotal;
// Encrypted billing address string - u43
this.model.encryptedBillingAddress = ( metricsLibrary.order.billingAddressEncrypt ) ? metricsLibrary.order.billingAddressEncrypt : '';
}
document.fire('brightTagPixelPartner:dataModelLoaded');
}
controller.setPixelPartnerTransmissionTemplate = function() {
var shoppingBagUrls = ['/buy/shopping_bag.do','/buy/shopping_bag_delete_item.do','/buy/shopping_bag_save_item.do','/buy/shopping_bag_move_item.do','/buy/edit_shipping_method_bag.do'];
// Order conf page fire
if( location.pathname == "/checkout/orderConfirm.do" ) {
this.pixelPartnerTransmissionTemplate = new Template(
"");
}
// Product Page fire
else if( location.pathname == '/browse/product.do' ) {
this.pixelPartnerTransmissionTemplate = new Template(
"");
}
// Other non-secure pages
else if( window.location.protocol != "https:" || shoppingBagUrls.include( location.pathname ) ) {
this.pixelPartnerTransmissionTemplate = new Template(
"");
}
}
controller.setCleanUp = function() {
// alert("setCleanUp() running: pixelPartnerName = " + this.pixelPartnerName);
}
controller.helper = new Object();
}
// WCD in-page event BrightTag service - Quicklook, QL Add To Bag, Find It Now, Reserve In Store, Add To Bag
if( location.pathname == '/browse/product.do' || location.pathname == '/browse/outfit.do' || location.pathname == '/browse/category.do' || location.pathname == '/browse/categorySearch.do' || location.pathname == '/browse/search.do' ) {
var wcdBrightTagService = {
model: {
supportedEvents: ['QuickLook','AddToQLBag','FindItNow','ReserveInStore','AddToBag','LoadVariantProduct'],
btFrameId: 'wcdBrightTagServiceFrame',
brFrameUrl: '',
btDataModel: '',
btFrameExists: false,
btLoadVariantCalls: 0
},
init: function() {
// Copy data model over from existing BT tag
if( window["brightTagPixelPartner"] != null ) {
if( brightTagPixelPartner.model ) {
wcdBrightTagService.model.btDataModel = {};
jQuery.extend( wcdBrightTagService.model.btDataModel, brightTagPixelPartner.model );
}
}
},
controller: {
// Creates dynamic BT frame if not present
createBrightTagFrame: function() {
var model = wcdBrightTagService.model;
if( jQuery('#' + model.btFrameId + ' iframe').length == 0 ) {
jQuery('body').append('
');
//jQuery('body').append('
');
model.btFrameExists = true;
}
},
updateBrightTagFrame: function() {
var model = wcdBrightTagService.model;
if( model.btFrameUrl != '' && jQuery('#' + model.btFrameId + ' iframe').length > 0 ) {
jQuery('#' + model.btFrameId + ' iframe' ).attr('src', model.btFrameUrl );
//console.log('iframe URL set');
}
},
fireBrightTag: function( eventName, eventModifier ) {
//console.log('fired for ' + eventName );
var wcdBTRef = wcdBrightTagService;
var model = wcdBTRef.model;
var btDataModel = model.btDataModel;
var controller = wcdBTRef.controller;
var btFrameUrl = '';
// Fire BrightTag for supported events only
if( jQuery.inArray( eventName, model.supportedEvents ) > -1 && btDataModel != '' ) {
if( ! model.btFrameExists ) {
controller.createBrightTagFrame();
}
btDataModel.pageName = brightTagPixelPartner.model.pageName;
if( btDataModel.pageName && btDataModel.pageName.indexOf( eventName ) == -1 ) {
btDataModel.pageName += '%3A' + eventName;
}
// Update Add to Bag events to pass price of product added to bag
if( eventName == 'AddToBag' || eventName == 'AddToQLBag' ) {
btDataModel.addToBagSellPrice = '';
btDataModel.addToBagOutfitSkus = '';
if( eventName == 'AddToBag' ) {
if( eventModifier == null ) {
var currentProductColor = productPage.activeColor;
var currentProductColorObj = productPage.objV.arrayVariantStyleColors[ currentProductColor ];
if( currentProductColorObj.price ) {
btDataModel.addToBagSellPrice = currentProductColorObj.price;
}
if( productPage.strSelectedQty ) {
if( productPage.strSelectedQty != '1' ) {
btDataModel.addToBagSellPrice = parseFloat( btDataModel.addToBagSellPrice ) * parseInt( productPage.strSelectedQty );
btDataModel.addToBagSellPrice = btDataModel.addToBagSellPrice.toFixed(2);
btDataModel.addToBagSellPrice = btDataModel.addToBagSellPrice.toString();
}
}
}
else if( eventModifier == 'outfitPage' ) {
if( outfitPage.arrayProducts != null && outfitPage.arrayProducts.length > 0 ) {
var currentOutfitProductColor = '';
var currentOutfitProductColorObj = null;
var currentOutfitProductSku = '';
for( var i=0; i < outfitPage.arrayProducts.length; i++ ) {
if( outfitPage.arrayProducts[i].selectedToAdd ) {
currentOutfitProductColor = '';
currentOutfitProductColorObj = null;
currentOutfitProductSku = '';
currentOutfitProductColor = outfitPage.arrayProducts[i].activeColor;
currentOutfitProductColorObj = outfitPage.arrayProducts[i].objV.arrayVariantStyleColors[ currentOutfitProductColor ];
if( currentOutfitProductColorObj.price ) {
btDataModel.addToBagSellPrice += currentOutfitProductColorObj.price + '|'
}
if( currentOutfitProductColorObj.strColorCodeId ) {
btDataModel.addToBagOutfitSkus += currentOutfitProductColorObj.strColorCodeId + '|'
}
}
}
if( btDataModel.addToBagSellPrice != '' && btDataModel.addToBagSellPrice.substr( btDataModel.addToBagSellPrice.length - 1 ) == '|' ) {
btDataModel.addToBagSellPrice = btDataModel.addToBagSellPrice.substr( 0, btDataModel.addToBagSellPrice.length - 1 );
}
if( btDataModel.addToBagOutfitSkus != '' && btDataModel.addToBagOutfitSkus.substr( btDataModel.addToBagOutfitSkus.length - 1 ) == '|' ) {
btDataModel.addToBagOutfitSkus = btDataModel.addToBagOutfitSkus.substr( 0, btDataModel.addToBagOutfitSkus.length - 1 );
}
}
}
}
else if( eventName == 'AddToQLBag' ) {
var currentProductColor = quickLook.activeColor;
var currentProductColorObj = quickLook.objV.arrayVariantStyleColors[ currentProductColor ];
if( currentProductColorObj.price ) {
btDataModel.addToBagSellPrice = currentProductColorObj.price;
}
if( model.qtySelected ) {
if( model.qtySelected != '1' ) {
btDataModel.addToBagSellPrice = parseFloat( btDataModel.addToBagSellPrice ) * parseInt( model.qtySelected );
btDataModel.addToBagSellPrice = btDataModel.addToBagSellPrice.toFixed(2);
btDataModel.addToBagSellPrice = btDataModel.addToBagSellPrice.toString();
}
}
}
}
// Update Add to Bag event to pass full product ID in page URL
if( eventName == 'AddToBag' && eventModifier == null ) {
// Update URL if there's no CID in it
if( gidLib.getQuerystringParam('cid') == '' && btDataModel.pageURL.indexOf('cid') == -1 && productPage.strDefaultCategoryId ) {
btDataModel.pageURL += '%26cid%3D' + productPage.strDefaultCategoryId;
}
if( productPage.objV.objStyleSizeInfo.intSizeDimensionsCount >= 1 ) {
var strColorId = productPage.objV.arrayVariantStyleColors[ productPage.selectedColor ].strColorCodeId;
var strSize1Id = productPage.arrayAllSizeDimension1[ productPage.selectedSizeDimension1 ].strId;
var strSize2Id = "";
}
if( productPage.objV.objStyleSizeInfo.intSizeDimensionsCount == 2 ) {
strSize2Id = productPage.arrayAllSizeDimension2[ productPage.selectedSizeDimension2 ].strId;
}
var strSkuID = productPage.objV.arrayVariantSkus[ strColorId + "_" + strSize1Id + "_" + strSize2Id ].strSkuId;
// Parse URL and replace product ID with selected
var currentProductId = btDataModel.pageURL;
currentProductId = currentProductId.substr( currentProductId.indexOf('pid%3D') + 6 );
if( currentProductId.indexOf('%26') > -1 ) {
currentProductId = currentProductId.substr( 0, currentProductId.indexOf('%26') );
}
var arrAddedProductURL = btDataModel.pageURL.split( currentProductId );
var addedProductURL = '';
if( arrAddedProductURL.length > 0 ) {
addedProductURL = arrAddedProductURL[0] + strSkuID;
if( arrAddedProductURL.length > 1 ) { addedProductURL += arrAddedProductURL[1]; }
}
btDataModel.pageURL = addedProductURL;
}
// If Load Product Variant, adjusts product page elements for new variant
else if( eventName == 'LoadVariantProduct' ) {
if( productPage.objP && productPage.objV ) {
// New product ID of variant
var currentProductColor = productPage.activeColor;
var currentProductColorObj = productPage.objV.arrayVariantStyleColors[ currentProductColor ];
var newVariantProductId = currentProductColorObj.strColorCodeId;
// Update Page ID with variant ID
btDataModel.pageId = newVariantProductId;
// Update Page URL with variant ID
// Parse URL and replace product ID with selected
var currentProductId = btDataModel.pageURL;
currentProductId = currentProductId.substr( currentProductId.indexOf('pid%3D') + 6 );
if( currentProductId.indexOf('&') > -1 ) {
currentProductId = currentProductId.substr( 0, currentProductId.indexOf('%26') );
}
var arrVariantProductURL = btDataModel.pageURL.split( currentProductId );
var variantProductURL = '';
if( arrVariantProductURL.length > 0 ) {
variantProductURL = arrVariantProductURL[0] + newVariantProductId;
if( arrVariantProductURL.length > 1 ) { variantProductURL += arrVariantProductURL[1]; }
}
btDataModel.pageURL = variantProductURL;
// Update URL if there's no CID in it
if( gidLib.getQuerystringParam('cid') == '' && btDataModel.pageURL.indexOf('cid') == -1 && productPage.strDefaultCategoryId ) {
btDataModel.pageURL += '%26cid%3D' + productPage.strDefaultCategoryId;
}
// Product Name - u28, Product Vendor Name - u34
if( productPage.objP.strProductStyleName ) {
btDataModel.productName = '';
btDataModel.productName = encodeURIComponent( productPage.objP.strProductStyleName );
// Check whether item has a vendor (ie. Piperlime), if so prepend vendor name
if( btDataModel.productName != '' && productPage.objP.strVendorName && productPage.objP.strVendorName != '' ) {
btDataModel.productName = encodeURIComponent( productPage.objP.strVendorName ) + '%20' + btDataModel.productName;
btDataModel.productVendorName = encodeURIComponent( productPage.objP.strVendorName );
}
}
// Product Brand - u29 - brand code sent
if( productPage.objP.brandCode ) {
btDataModel.productBrandCode = '';
btDataModel.productBrandCode = productPage.objP.brandCode;
}
// Variant/color based
if( productPage.hasOwnProperty('objV') && productPage.hasOwnProperty('activeColor') ) {
btDataModel.productPrice = '';
var currentProductColor = productPage.activeColor;
var currentProductColorObj = productPage.objV.arrayVariantStyleColors[ currentProductColor ];
// Product Price - u30 - find selected variant/color to determine best
if( currentProductColorObj.price ) {
btDataModel.productPrice = currentProductColorObj.price;
//console.log('price set');
}
// Product Original Price - u35
if( currentProductColorObj.strRegularPrice ) {
btDataModel.productOriginalPrice = currentProductColorObj.strRegularPrice.replace('$','');
}
// Product Image URL - u31
if( currentProductColorObj.hasOwnProperty('arrayVariantStyleColorImages') ) {
btDataModel.productImage = '';
if( currentProductColorObj.arrayVariantStyleColorImages['Main'] ) {
btDataModel.productImage = encodeURIComponent('http://' + location.hostname + currentProductColorObj.arrayVariantStyleColorImages['Main'].strImagePath );
//console.log('image set from Main');
}
else if( currentProductColorObj.arrayVariantStyleColorImages['MainThumb'] ) {
btDataModel.productImage = encodeURIComponent('http://' + location.hostname + currentProductColorObj.arrayVariantStyleColorImages['MainThumb'].strImagePath );
}
}
}
// Product Sizes In Stock - u32 - pulling from page
// Product Sizes Out of Stock - u33
var allSkus = productPage.objV.arrayVariantSkus;
var allSize1s = productPage.arrayAllSizeDimension1;
var allSize2s = productPage.arrayAllSizeDimension2;
var currentSkuId = '';
var currentSkuSize1 = '';
var currentSkuSize2 = '';
var currentSkuSizeDescription = '';
var sizeDesc = '';
var arrSkuSizesAll = [];
var arrSkuSizesInStock = [];
var arrSkuSizesOutOfStock = [];
if( allSize1s.length > 0 && allSize2s.length > 0 ) {
for( var i=0; i < allSize1s.length; i++ ) {
for( var j=0; j < allSize2s.length; j++ ) {
sizeDesc = '';
sizeDesc += allSize1s[i].strName + ':' + allSize2s[j].strName;
arrSkuSizesAll.push( sizeDesc );
}
}
}
else if( allSize1s.length > 0 ) {
for( var i=0; i < allSize1s.length; i++ ) {
sizeDesc = '';
sizeDesc += allSize1s[i].strName;
arrSkuSizesAll.push( sizeDesc );
}
}
//console.log( 'all sizes ' + arrSkuSizesAll );
jQuery.each(allSkus, function(key,valueObj){
// If the value is an object that represents an in-stock color/size SKU of the initially loaded color
var currentPid = productPage.strDefaultStyleColorId;
if( jQuery.type( valueObj ) == 'object' ) {
// Restrict to initially loaded color
if( valueObj.strSkuId.indexOf( currentPid ) > -1 ) {
currentSkuSizeDescription = '';
currentSkuId = valueObj.strSkuId;
currentSkuSize1 = valueObj.strSizeDim1Id;
currentSkuSize2 = valueObj.strSizeDim2Id;
if( allSize1s.length > 0 ) {
for( var i=0; i < allSize1s.length; i++ ) {
if( allSize1s[i].strId == currentSkuSize1 ) {
currentSkuSizeDescription += allSize1s[i].strName;
}
}
}
if( allSize2s.length > 0 ) {
for( var j=0; j < allSize2s.length; j++ ) {
if( allSize2s[j].strId == currentSkuSize2 ) {
currentSkuSizeDescription += ':' + allSize2s[j].strName;
}
}
}
//console.log( 'sku = ' + currentSkuId + '; size1 = ' + currentSkuSize1 + '; size2 = ' + currentSkuSize2 + '; sizeDesc = ' + currentSkuSizeDescription );
arrSkuSizesInStock.push( currentSkuSizeDescription );
}
}
});
//console.log( 'sizes in stock ' + arrSkuSizesInStock );
arrSkuSizesOutOfStock = jQuery.grep( arrSkuSizesAll, function( elt ) {
return jQuery.inArray( elt, arrSkuSizesInStock ) == -1;
});
//console.log( 'sizes out of stock ' + arrSkuSizesOutOfStock );
btDataModel.productSizesInStock = '';
if( arrSkuSizesInStock.length > 0 ) {
// Replace ' ½' with 'half'
for( var i=0; i < arrSkuSizesInStock.length; i++ ) {
arrSkuSizesInStock[i] = arrSkuSizesInStock[i].replace(' ½','half');
}
btDataModel.productSizesInStock = arrSkuSizesInStock.join();
btDataModel.productSizesInStock = btDataModel.productSizesInStock.toLowerCase();
//console.log('in stock sizes set');
}
btDataModel.productSizesOutOfStock = '';
if( arrSkuSizesOutOfStock.length > 0 ) {
// Replace ' ½' with 'half'
for( var j=0; j < arrSkuSizesOutOfStock.length; j++ ) {
arrSkuSizesOutOfStock[j] = arrSkuSizesOutOfStock[j].replace(' ½','half');
}
btDataModel.productSizesOutOfStock = arrSkuSizesOutOfStock.join();
btDataModel.productSizesOutOfStock = btDataModel.productSizesOutOfStock.toLowerCase();
//console.log('out of stock sizes set');
}
}
}
// If QuickLook or AddToQLBag, add product elements
else if( eventName == 'QuickLook' || eventName == 'AddToQLBag' ) {
if( ( eventName == 'QuickLook' || eventName == 'AddToQLBag' ) && window["quickLook"] != null && quickLook.objP && quickLook.objV ) {
// Fake URL to be product page
var qlProductId = quickLook.objP.strProductId;
var currentCid = gidLib.getQuerystringParam('cid');
currentCid = currentCid.substr(0,6);
// Update Add to Bag QL event to override product ID to pass full product ID of item added
if( eventName == 'AddToQLBag' ) {
if( quickLook.objV.objStyleSizeInfo.intSizeDimensionsCount >= 1 ) {
var strColorId = quickLook.objV.arrayVariantStyleColors[ quickLook.selectedColor ].strColorCodeId;
var strSize1Id = quickLook.arrayAllSizeDimension1[ quickLook.selectedSizeDimension1 ].strId;
var strSize2Id = "";
}
if( quickLook.objV.objStyleSizeInfo.intSizeDimensionsCount == 2 ) {
strSize2Id = quickLook.arrayAllSizeDimension2[ quickLook.selectedSizeDimension2 ].strId;
}
qlProductId = quickLook.objV.arrayVariantSkus[ strColorId + "_" + strSize1Id + "_" + strSize2Id ].strSkuId;
}
btDataModel.pageURL = 'http://' + location.hostname + location.pathname.replace('category','product').replace('categorySearch','product').replace('search','product') + '?cid=' + currentCid + '&pid=' + qlProductId;
btDataModel.pageURL = encodeURIComponent( btDataModel.pageURL );
// Product Name - u28
if( quickLook.objP.strProductStyleName ) {
btDataModel.productName = '';
btDataModel.productVendorName = '';
btDataModel.productName = encodeURIComponent( quickLook.objP.strProductStyleName );
// Check whether item has a vendor (ie. Piperlime), if so prepend vendor name
if( btDataModel.productName != '' && quickLook.objP.strVendorName && quickLook.objP.strVendorName != '' ) {
btDataModel.productName = encodeURIComponent( quickLook.objP.strVendorName ) + '%20' + btDataModel.productName;
btDataModel.productVendorName = encodeURIComponent( quickLook.objP.strVendorName );
}
}
// Product Brand - u29 - brand code sent
if( quickLook.objP.brandCode ) {
btDataModel.productBrandCode = '';
btDataModel.productBrandCode = quickLook.objP.brandCode;
}
// Variant/color based
if( quickLook.hasOwnProperty('objV') && quickLook.hasOwnProperty('activeColor') ) {
btDataModel.productPrice = '';
var currentProductColor = quickLook.activeColor;
var currentProductColorObj = quickLook.objV.arrayVariantStyleColors[ currentProductColor ];
// Product Price - u30 - find selected variant/color to determine best
if( currentProductColorObj.price ) {
btDataModel.productPrice = currentProductColorObj.price;
//console.log('price set');
}
// Product Original Price - u35
if( currentProductColorObj.strRegularPrice ) {
btDataModel.productOriginalPrice = currentProductColorObj.strRegularPrice.replace('$','');
}
// Product Image URL - u31
if( currentProductColorObj.hasOwnProperty('arrayVariantStyleColorImages') ) {
btDataModel.productImage = '';
if( currentProductColorObj.arrayVariantStyleColorImages['Main'] ) {
btDataModel.productImage = encodeURIComponent('http://' + location.hostname + currentProductColorObj.arrayVariantStyleColorImages['Main'].strImagePath );
//console.log('image set from Main');
}
else if( currentProductColorObj.arrayVariantStyleColorImages['MainThumb'] ) {
btDataModel.productImage = encodeURIComponent('http://' + location.hostname + currentProductColorObj.arrayVariantStyleColorImages['MainThumb'].strImagePath );
}
}
}
// Product Sizes In Stock - u32 - pulling from page
// Product Sizes Out of Stock - u33
var allSkus = quickLook.objV.arrayVariantSkus;
var allSize1s = quickLook.arrayAllSizeDimension1;
var allSize2s = quickLook.arrayAllSizeDimension2;
var currentSkuId = '';
var currentSkuSize1 = '';
var currentSkuSize2 = '';
var currentSkuSizeDescription = '';
var sizeDesc = '';
var arrSkuSizesAll = [];
var arrSkuSizesInStock = [];
var arrSkuSizesOutOfStock = [];
if( allSize1s.length > 0 && allSize2s.length > 0 ) {
for( var i=0; i < allSize1s.length; i++ ) {
for( var j=0; j < allSize2s.length; j++ ) {
sizeDesc = '';
sizeDesc += allSize1s[i].strName + ':' + allSize2s[j].strName;
arrSkuSizesAll.push( sizeDesc );
}
}
}
else if( allSize1s.length > 0 ) {
for( var i=0; i < allSize1s.length; i++ ) {
sizeDesc = '';
sizeDesc += allSize1s[i].strName;
arrSkuSizesAll.push( sizeDesc );
}
}
//console.log( 'all sizes ' + arrSkuSizesAll );
jQuery.each(allSkus, function(key,valueObj){
// If the value is an object that represents an in-stock color/size SKU of the initially loaded color
var currentPid = quickLook.objQuickLookTarget.strDefaultStyleColor;
if( jQuery.type( valueObj ) == 'object' ) {
// Restrict to initially loaded color
if( valueObj.strSkuId.indexOf( currentPid ) > -1 ) {
currentSkuSizeDescription = '';
currentSkuId = valueObj.strSkuId;
currentSkuSize1 = valueObj.strSizeDim1Id;
currentSkuSize2 = valueObj.strSizeDim2Id;
if( allSize1s.length > 0 ) {
for( var i=0; i < allSize1s.length; i++ ) {
if( allSize1s[i].strId == currentSkuSize1 ) {
currentSkuSizeDescription += allSize1s[i].strName;
}
}
}
if( allSize2s.length > 0 ) {
for( var j=0; j < allSize2s.length; j++ ) {
if( allSize2s[j].strId == currentSkuSize2 ) {
currentSkuSizeDescription += ':' + allSize2s[j].strName;
}
}
}
//console.log( 'sku = ' + currentSkuId + '; size1 = ' + currentSkuSize1 + '; size2 = ' + currentSkuSize2 + '; sizeDesc = ' + currentSkuSizeDescription );
arrSkuSizesInStock.push( currentSkuSizeDescription );
}
}
});
//console.log( 'sizes in stock ' + arrSkuSizesInStock );
arrSkuSizesOutOfStock = jQuery.grep( arrSkuSizesAll, function( elt ) {
return jQuery.inArray( elt, arrSkuSizesInStock ) == -1;
});
//console.log( 'sizes out of stock ' + arrSkuSizesOutOfStock );
btDataModel.productSizesInStock = '';
if( arrSkuSizesInStock.length > 0 ) {
// Replace ' ½' with 'half'
for( var i=0; i < arrSkuSizesInStock.length; i++ ) {
arrSkuSizesInStock[i] = arrSkuSizesInStock[i].replace(' ½','half');
}
btDataModel.productSizesInStock = arrSkuSizesInStock.join();
btDataModel.productSizesInStock = btDataModel.productSizesInStock.toLowerCase();
//console.log('in stock sizes set');
}
btDataModel.productSizesOutOfStock = '';
if( arrSkuSizesOutOfStock.length > 0 ) {
// Replace ' ½' with 'half'
for( var j=0; j < arrSkuSizesOutOfStock.length; j++ ) {
arrSkuSizesOutOfStock[j] = arrSkuSizesOutOfStock[j].replace(' ½','half');
}
btDataModel.productSizesOutOfStock = arrSkuSizesOutOfStock.join();
btDataModel.productSizesOutOfStock = btDataModel.productSizesOutOfStock.toLowerCase();
//console.log('out of stock sizes set');
}
}
}
//console.log('data dump');
//console.log( btDataModel );
// Set the iframe URL and fire
btFrameUrl = '//s.thebrighttag.com/tag?' +
'site=' + btDataModel.brighttag_site_id + '&' +
'mode=iframe&' +
'qty=' + btDataModel.totalQty + '&' +
'tran=' + btDataModel.enteringBrandCode + '&' +
'u=' + btDataModel.currencyType + '&' +
'u1=' + btDataModel.productSkus + '&' +
'u2=' + btDataModel.pageType + '&' +
'u3=' + btDataModel.pageId + '&' +
'u4=' + btDataModel.apCode + '&' +
'u5=' + btDataModel.lastInTID + '&' +
'u6=' + btDataModel.itemPrices + '&' +
'u7=' + btDataModel.itemBrands + '&' +
'u9=' + btDataModel.pageName + '&' +
'u10=' + btDataModel.pageURL + '&' +
'u11=' + btDataModel.isNewCustomer + '&' +
'u14=' + btDataModel.isRecognizedVisitor + '&' +
'u19=' + btDataModel.prodQty + '&' +
'u20=' + btDataModel.unknownShopperID + '&' +
'u21=' + btDataModel.customerID + '&' +
brightTagPixelPartner.controller.getPixmanElement('u26', btDataModel.dotomiToken, '&') +
'u27=' + btDataModel.diID + '&';
if( location.pathname == '/browse/product.do' || eventName == 'QuickLook' || eventName == 'AddToQLBag' || eventName == 'LoadVariantProduct' ) {
btFrameUrl += 'u28=' + btDataModel.productName + '&' +
'u29=' + btDataModel.productBrandCode + '&' +
'u30=' + btDataModel.productPrice + '&' +
'u31=' + btDataModel.productImage + '&' +
'u32=' + btDataModel.productSizesInStock + '&' +
'u33=' + btDataModel.productSizesOutOfStock + '&' +
'u34=' + btDataModel.productVendorName + '&' +
'u35=' + btDataModel.productOriginalPrice + '&';
}
if( ( eventName == 'AddToBag' || eventName == 'AddToQLBag' ) && btDataModel.addToBagSellPrice ) {
btFrameUrl += 'u39=' + btDataModel.addToBagSellPrice + '&';
}
// Adding mobile vs desktop metric
btFrameUrl += 'u44=' + btDataModel.mobileVsDesktop + '&';
// Adding outfit SKUs added to bag
if( location.pathname == '/browse/outfit.do' && eventName == 'AddToBag' && btDataModel.addToBagOutfitSkus ) {
btFrameUrl += 'u47=' + btDataModel.addToBagOutfitSkus + '&';
}
model.btFrameUrl = btFrameUrl;
//console.log('updating iframe URL');
//console.log( model.btFrameUrl );
controller.updateBrightTagFrame();
}
}
}
}
Event.observe( document, 'brightTagPixelPartner:dataModelLoaded', function() {
wcdBrightTagService.init();
});
// Quicklook wrap
if( ( location.pathname == '/browse/category.do' || location.pathname == '/browse/categorySearch.do' || location.pathname == '/browse/search.do' || location.pathname == '/browse/product.do' ) && window["quickLook"] != null ) {
Event.observe( document, 'quicklook:load', function() {
//quickLook.launchQuickLook = quickLook.launchQuickLook.wrap( function( originalMethod ) {
//console.log('quicklook loaded');
//originalMethod();
wcdBrightTagService.controller.fireBrightTag('QuickLook');
});
quickLook.addToBag = quickLook.addToBag.wrap( function( originalMethod ) {
if( quickLook.strSelectedQty ) {
wcdBrightTagService.model.qtySelected = quickLook.strSelectedQty;
}
originalMethod();
wcdBrightTagService.controller.fireBrightTag('AddToQLBag');
});
}
// Find-it-now wrap
if( location.pathname == '/browse/product.do' && window["merchLocationsManager"] != null ) {
if( merchLocationsManager.view && merchLocationsManager.view.storeLocationsListOverlay && merchLocationsManager.view.storeLocationsListOverlay.open ) {
merchLocationsManager.view.storeLocationsListOverlay.open = merchLocationsManager.view.storeLocationsListOverlay.open.wrap( function( originalMethod ) {
originalMethod();
wcdBrightTagService.controller.fireBrightTag('FindItNow');
});
}
}
// Reserve-in-store wrap
if( location.pathname == '/browse/product.do' && window["reserveInStoreManager"] != null ) {
if( reserveInStoreManager.api && reserveInStoreManager.api.open ) {
reserveInStoreManager.api.open = reserveInStoreManager.api.open.wrap( function( originalMethod, parentContainer, triggeredBy, productImgUrl ) {
originalMethod( parentContainer, triggeredBy, productImgUrl );
wcdBrightTagService.controller.fireBrightTag('ReserveInStore');
});
}
}
// Add-to-bag wrap - product and outfit page
if( location.pathname == '/browse/product.do' && window["productPage"] != null ) {
productPage.addToBag = productPage.addToBag.wrap( function( originalMethod ) {
originalMethod();
wcdBrightTagService.controller.fireBrightTag('AddToBag');
});
}
if( location.pathname == '/browse/outfit.do' && window["outfitPage"] != null ) {
outfitPage.addToBag = outfitPage.addToBag.wrap( function( originalMethod ) {
originalMethod();
wcdBrightTagService.controller.fireBrightTag('AddToBag','outfitPage');
});
}
// Load Variant wrap
if( location.pathname == '/browse/product.do' && window["productPage"] != null ) {
productPage.loadVariantProduct = productPage.loadVariantProduct.wrap( function( originalMethod, strProductId, strVariantId ) {
originalMethod( strProductId, strVariantId );
wcdBrightTagService.model.btLoadVariantCalls++;
if( wcdBrightTagService.model.btLoadVariantCalls > 1 ) {
wcdBrightTagService.controller.fireBrightTag('LoadVariantProduct');
}
});
}
}
//////////////////////////////////////////////////////////////////
// IE StyleTag to get around 31 tags consolidation script 1.0 //
// Jeff Held, Director - Web Content Development //
//////////////////////////////////////////////////////////////////
var IEStyleTagConsolidator = function() {
var myClientBrowserType = navigator.userAgent;
if (myClientBrowserType.indexOf("MSIE") > 0) {
var browserVersionString = myClientBrowserType.split("MSIE ")[1];
var browserVersionNumber = browserVersionString.split(".")[0];
browserVersionNumber = parseInt(browserVersionNumber);
// do this only for IE 9 and below...
if (browserVersionNumber < 10){
var styleArr = $$('body')[0].select("style");
var newStyleString = "";
for (i=0; i< styleArr.length; i++) {
var workingHTML = styleArr[i].innerHTML;
newStyleString += workingHTML;
styleArr[i].remove();
}
var mynewtag = "";
document.write(mynewtag);
}
}
}
IEStyleTagConsolidator();
https://securemetrics.gap.com/b/ss/gapoldnavyproduction,gapgidproduction/1/H.26/s53872480113244?AQB=1&ndh=1&t=1%2F4%2F2015%200%3A45%3A25%205%20-540&fid=1654AC26D0B8D9AA-2E63503B9D594871&ns=gap&cdp=2&pageName=on%3Abuy%3AShopping%20Bag&g=https%3A%2F%2Fsecure-oldnavy.gap.com%2Fbuy%2Fshopping_bag.do&r=http%3A%2F%2Foldnavy.gap.com%2Fbrowse%2Fcategory.do%3Fcid%3D6157%26departmentRedirect%3Dtrue&cc=USD&ch=on%3Abuy&events=scView&products=ON%3B173937002%3B1%3B9.00%3B%3B%2CGAP%3B228102022%3B1%3B10.99%3B%3B%2CGAP%3B976185052%3B1%3B12.99%3B%3B%2CGAP%3B215022012%3B1%3B12.99%3B%3B%2CGAP%3B215014002%3B1%3B19.99%3B%3B%2CON%3B674614002%3B1%3B4.00%3B%3B%2CON%3B717941022%3B1%3B7.00%3B%3B%2CON%3B344113002%3B1%3B7.00%3B%3B%2CGAP%3B475615012%3B1%3B5.99%3B%3B%2CGAP%3B389165002%3B1%3B20.99%3B%3B%2CGAP%3B410399002%3B1%3B19.95%3B%3B%2CGAP%3B215077012%3B1%3B17.46%3B%3B%2CGAP%3B215011012%3B1%3B13.99%3B%3B%2CGAP%3B227834012%3B1%3B24.95%3B%3B&c8=38F69CC49972D2846E44F529F3AFF818&c9=6fd3a93c-a018-4f3d-9ace-c5678625d043&c11=9509732%2C9008074%2C9703764%2C8710245%2C8955461%2C9665750%2C5810012%2C9723534%2C9706065%2C9707318%2C9187572%2C9683746%2C9445918%2C8980862%2C8980858%2C8710410%2C9668004&v22=38F69CC49972D2846E44F529F3AFF818&c32=on&c33=shopping_bag&v35=ON&v49=en_US&c53=D%3Dv61&c54=D%3Dv62&v61=1451x744&v62=xlarge%7Clandscape&v67=OutfitPrototypeSegA&h1=on%3Abuy%3AShopping%20Bag&s=1920x1080&c=32&j=1.5&v=Y&k=Y&bw=1455&bh=748&ct=lan&hp=N&pid=on%3Abrowse%3AToddler%20Boys%3ANew%20Arrivals&pidt=1&oid=https%3A%2F%2Fsecure-oldnavy.gap.com%2Fbuy%2Fshopping_bag.do&ot=A&oi=435&AQE=1
비밀글 해당 댓글은 작성자와 운영자만 볼 수 있습니다.15.05.01 01:33