Catalog Item Free Text Quantity Field

Cuneyt
Tera Contributor

Hi,

I'm having some technical difficulties about the catalog item quantity field. The question is, how can I make the quantity field in the catalog item unlimited (like integer field). It is an integer field but I assume due to portal configurations It is shown as a choice list. I don't want to add choices up to 10.000 quantities. It doesn't seem like a good way to do. Is there a better option that people can edit the field with the quantity they want ?

 

The reason why I'm trying to this is that our customer is providing some equipments which are being sold with a minimum quantities like 100, 1.000, 10.000. We are planning to make a field which the customer will declare the minimum quantity of the item. Than the user will only be able to order within that quantity range.

 

1 ACCEPTED SOLUTION

Brad Bowman
Kilo Patron
Kilo Patron

Here are more details about how we implemented this, which may get you closer.  I am seeing the user-supplied free text quantity in the cart with the correct total price based on this quantity.

 

1. Create a variable set containing only the new Quantity (single line text).

2. Add the variable set to the catalog item(s).

3. Create a before Insert/Update business rule on the sc_item_option table:

    a.  add a condition: Question is <<new quantity>>

    b.  Script on the Advanced tab:

(function executeRule(current, previous /*null when async*/) {

// Get the current Cart Item and Value from the catalog item option.
var cartItem = current.cart_item;
var qty = current.value;

// Query the cart and update its Quantity value with the value from the variable.
var gr = new GlideRecord('sc_cart_item');
gr.addQuery('sys_id', cartItem);
gr.query();
while(gr.next()){
gr.quantity = qty;
gr.update();
}

})(current, previous);

View solution in original post

7 REPLIES 7

Thank you so much, It worked. My Business Rule was working on sc_cart_item, this is a way better solution.

Hi Brad,

 

Greetings!

 

If same I want to use in order guide then what modifications I need to do?

 

Thanks,

Tejas

Hi @Brad Bowman  

 

Greetings!

 

If same I want to use in order guide then what modifications I need to do?

 

Please reply.

 

Thanks,

Tejas