Product script to add a discount present under a product in line item
Hi,
I have a script which will add a discount present under a product in the line item on selecting the product,the discount is coming from the profile attribute value@@:
function Cfg_ChildItemChanged (ChangedItem)
{
var nCnt = ChangedItem.GetChildCount();
var x;
var item;
var item_name;
var new_val;
for ( var i = 0; i<nCnt; i++) {
item = ChangedItem.GetChild(i);
item_name= item.GetProperty("ObjName");
new_val = item.GetProperty("NewQty");
var Descuento = TheApplication().GetProfileAttr(item_name);
if (Descuento!= "" && new_val==1){
var str = "$.[DQS Movil_2]#1.[R1]#["+item_name+"]";
AddItem(str, "Rel_a", Descuento, "1");
Below line as per my understanding is saving the path of the product in str: