price not updating when changing quantity in service portal item

Community Alums
Not applicable

Hi All,

In SP Service Catalog Item, price is not updating as per quantity..Can someone suggest

13 REPLIES 13

Community Alums
Not applicable

dave.slusher

Hi Dave,



Can you please suggest on this.



Thanks and Regards,


Kirti


Rushit Patel2
Tera Guru

Hi Kirti,



follow below steps.


1)clone "sc catalog item" widget as you can not update OOB widget. clone it and replace it on "sc_cat_item" page with page designer.


2) update select line on widget with highlighted text. i.e add ng-change attribute with function call.


find_real_file.png


3)define function like below in client script section of your widget.




c.updatePrice = function(){


  var quantity = c.quantity;


  var price = c.data.sc_cat_item._pricing.price;


  var recprice =   c.data.sc_cat_item._pricing.recurring_price;



  var priceTotal = parseFloat(price*quantity).toFixed(2);


  var recPriceTotal ;


  if(c.data.sc_cat_item.recurring_price){


  recPriceTotal = parseFloat(recprice*quantity).toFixed(2);


  }


  c.data.sc_cat_item.price = c.data.sc_cat_item.price.substring(0,1) + priceTotal;


  c.data.sc_cat_item.recurring_price = c.data.sc_cat_item.recurring_price.substring(0,1) + recPriceTotal +" " +   c.data.sc_cat_item._pricing.rfd;



}





let me know if any questions.



(please mark helpful/like/correct if it helps)


Community Alums
Not applicable

This isnt working as expected..it is changing my proce to 0$


i tested this in my instance..it is working fine..can you post your code.