ckorski
10/25/2017 - 6:50 PM

To add new events into existing s.events to not wipe the current s.events

s.events += ',event41';

var productString = window.createProductStringBuilder();
var productSavings = event.detail.state.product.product.saving;
var productPrice = event.detail.state.product.product.priceWithoutEhf;
var productSavingsPercentage = window.getProdSavingPercentage(productSavings, productPrice);
var productBrand = event.detail.state.product.product.brandName.toLowerCase();
var isProductSingle = !!event.detail.state.product.product.bundleProducts ? 'bundle' : 'single';
var productRating = event.detail.state.product.product.customerRating;
var dthpurchasableStatus = event.detail.state.product.availability.shipping.purchasable;
var rpupurchasableStatus = event.detail.state.product.availability.pickup.purchasable;
var dthStatus = event.detail.state.product.availability.shipping.status.toLowerCase();
var rpuStatus = event.detail.state.product.availability.pickup.status.toLowerCase();

productSavings ? productString.addProp('event1', productSavings) : '';
productPrice ? productString.addProp('eVar96', productPrice) : '';
productPrice ? productString.addProp('eVar15', isProductSingle) : '';

productString.addProp('eVar17', productRating);
productString.addProp('eVar26', productBrand); 
productString.addProp('eVar80', _satellite.getVar("vendorType"));

if (isProductSingle == 'single') { // singple product vs bundle product check
	productString.addProp('eVar31', productSavingsPercentage);
  s.events += ',event78';
} else {
	productString.addProp('eVar36', productSavingsPercentage);
  productString.addProp();
  s.events += ',event79';
}


if (dthpurchasableStatus == false && rpupurchasableStatus == true) {
  s.events += ',event83';
} else if (dthpurchasableStatus == true && rpupurchasableStatus == false && rpuStatus != 'preorder') {
  s.events += ',event85';
} else if (dthpurchasableStatus == false && rpupurchasableStatus == false) {
  s.events += ',event41';
}

s.products = productString.getString();

_satellite.getVar('getGlobalVars');