/* 
  Shopping cart tags for UNICA's NetInsight Retail Activity reporting
*/

// The following 3 functions are for Shopping Carts

function tag_product_views(rtv) {
  // Tag product views for the page
  // SKUs or ID of the products on the page separated by semicolon (;)
  // example: tag_product_views("FY210;SX042;EP260");
  NTPT_PGEXTRA="rtv="+rtv;
}

function tag_shoppingcart_addremove(Type, Id, Qty, Price) {
   // Tag additions to the shopping cart 

   // Type = "A" = add or "R" = remove  (from cart)
   // Id = SKUs or ID of the product
   // Qty = Quantity 
   // Price = per item price.
   // example: tag_shoppingcart_addremove("A",Id,Qty,Price);

   var lType = Type;

   switch(Type) {
     case 'A':
       lType = "rta";
       break;
     case 'R':
       lType = "rtr";
       break;
     default:
       alert("Type must be A-Add or R-Remove");
       return lType;
   }
   ntptAddPair( lType, Id + ";" + Qty + ";" + Price);
   ntptEventTag( "pv=0");
}

function tag_shoppingcart_checkout(orderid,totalrevenue,rtc) {
  // Tag the shopping cart checkout 
  // Id = SKUs or ID of the product
  // Qty = Quantity 
  // Price = per item price.
  // example: tag_shoppingcart_checkout(orderid,totalrevenue,Id+";"+Qty+":"+Price+";");
  var lOrderId = "";
  if (orderid == "") {
    lOrderId = "";
  } else {
    lOrderId = "rti="+orderid+"&";
  }
  NTPT_PGEXTRA=lOrderId+"rtt="+totalrevenue+"&rtc="+rtc;
  ntptEventTag( "pv=0" );
}
