Adding Quantity value for particular Ctalog Item

sach1
Tera Guru

Hello Everyone,

 

I want to add some new value to the quantity field in Shopping cart of catalog item.

 

I tried using the sys_choice table to enter new values but this new values reflect for every catalog item present.

 

To increase or reduce the quantities that a customer can select for catalog items:

  1. Navigate to System Definition > Choice Lists.
  2. Filter the list for records with Table set to sc_cart_item and the Element set to quantity. The existing quantity choices appear.

 

Is there any way to restrict the new choices only to a particular catalog item ??

 

Regards,

Sachin

1 ACCEPTED SOLUTION

sach1
Tera Guru

Well at the end catalog client script helped.



Wrote a small onLoad script for the catalog item.



function onLoad() {


  document.getElementById("quantity").innerHTML ='<option value="1" SELECTED="SELECTED">1</option><option value="4">4</option><option value="8">8</option><option value="12">12</option><option value="16">16</option><option value="20">20</option>';


}


View solution in original post

7 REPLIES 7

Naveen6
Tera Contributor

Hi Sachin,


Thanks for your reply..


But for me It did not worked with the same script in IE8.



Finally It worked after changing the code like this



$('quantity').update('<option value="1" SELECTED="SELECTED">1</option><option value="2">2</option><option value="3">3</option><option value="4">4</option><option value="5">5</option><option value="6">6</option><option value="7">7</option><option value="8">8</option><option value="9">9</option><option value="10">10</option>');


Yang Lu
ServiceNow Employee
ServiceNow Employee

The original thread was from 5 years ago.  Was hoping someone has figured it out for the Service Portal world since NOW is using AngularJS.  I hope some smart HTML/CSS/AngularJS guru can assist.  It looks like we just need to modify the SC Catalog Item widget.  And this is the line of code:

<select id="catItemQuantity"
                     ng-if="c.showQuantitySelector()"
                     ng-disabled="submitting || submitted"
                        class="m-b sn-select-basic"
                     ng-model="c.quantity"
                        aria-label="${Quantity}">
               <option ng-repeat="num in data.choiceListQuantity" value={{::num.value}}>{{::num.label}}</option>
             </select>

Any ideas on how to turn that code into a key in field?

shouvik
ServiceNow Employee
ServiceNow Employee

The quantity in cart comes from choices defined for quantity in sc_cart_item.

Thanks
Shouvik