Quick Question about Javascript wording in Launch Rules
Hey Community,
I would like to update one of my rules in Adobe Launch which is set with Custom Code.
The goal of the rule is to set my eVar8 value (Product Type) according to the value I'm getting in my eVar7.
Example :
if eVar7 = "ABC"
Then eVar8 = "ABC.com"
Else eVar8 = "Marketplace".
s.products = flatMap(orders, function(order){
var shippingMethod = order.total.shippingMethod;
var storeName = order.total.shippingMethodID === "9" ? order.profile.shippingAddress.name : "Autre livraison";
return order.item.map(function(item){
var availabilityID = item.attributes.availabilityID || "0";
var attributes = item.attributes;
var isMarketplace = attributes.sellerName === "ABC";
var isDigital = attributes.nature === "digital";
var prid = _satellite.getVar("Adobe Analytics - Helper - Product Identifier", item);
var quantity = item.quantity || 1;
return [
// Category
"",
// Product name
prid,
// Quantity
quantity,
// Price
item.price.priceWithTax * quantity,//total
// Events
"",
// eVars
keyValues({
evar7: attributes.sellerName,
//evar8: isMarketplace ? "ABC.com" : "Marketplace",
evar8: (isDigital && isMarketplace) ? "Dematerialise" : (isMarketplace ? "ABC.com" : "Marketplace"),
evar9: Number(attributes.condition === "new"),
evar23: storeName,
evar24: shippingMethod,
}),
].join(";");
});
}).join();
As you can see above, the var isMarketplace is set with the following method :
var isMarketplace = attributes.sellerName === "ABC";
All the code above has been implemented by another developer.
I would like to get your help to understand a bit more what means the var declaration isMarketplace ? I don't get how the value is set as we have the following code in the declaration.
attributes.sellerName === "ABC";
My final goal is to update my code as the following :
if eVar7 = "ABC" || "ClickAndCollectOnly",
Then eVar8 = "ABC.com"
Else eVar8 = "Marketplace".
I'm not sure if I need to modify the declaration of var isMarketplace line or if I need to modify the ternary operator present in the keyValues Object for eVar8.
Thanks a lot for your help