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

Brad Bowman
Kilo Patron
Kilo Patron

We've worked around this by hiding quantity on the item, then adding a variable for it.  You can copy the variable to sc_req_item.quantity on submit so that they are in agreement.

Hi, thanks for the answer, I thought about the same thing but all the price and other fields are connected to it. Doing that will require multiple changes in other widgets and scripts. I tried to change the quantity field based on that variable but the price in ritm and cart is not changing unless we use the oob quantity field.

Hi, 

Were you able to find a solution / work around? 

I am able to push my custom quantity to the quantity table on submit of the catalog items and this sets the quantity and total fields on the RITM, but I can't get the shopping cart and bundles to show the right quantity.

Thanks,
Sharon

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);