- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-18-2017 02:41 AM
Hi All,
I am trying to get the value of shopping cart Quantity on a catalog client script. Once submitting the request, if quantity selected in more than 1, there should be a pop-up message.
I tried couple of scripts but not getting quantity selected by the user.
var userID = g_user.userID;
var cart = new GlideRecord('sc_cart');
cart.addQuery('user',userID);
cart.query();
if (cart.next()) {
var cartItem = new GlideRecord('sc_cart_item');
cartItem.addQuery('cart',cart.sys_id); cartItem.query();
if (cartItem.next()) {
alert('Order quantity is limited to 1 ');
}
}
Thanks
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-18-2017 04:05 AM
Hi All,
I am able to fix the issue with the help of below thread
How to get Shopping Cart Quantity in Catalog client script ?
var count = $('quantity').value;
if(count > 1){
var conMsg = confirm('');
if(conMsg == true){
//Your code;
}
else{
return false;
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-18-2017 02:54 AM
Can you move this script to a script include and access it with GlideAjax?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-18-2017 04:05 AM
Hi All,
I am able to fix the issue with the help of below thread
How to get Shopping Cart Quantity in Catalog client script ?
var count = $('quantity').value;
if(count > 1){
var conMsg = confirm('');
if(conMsg == true){
//Your code;
}
else{
return false;
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-19-2019 12:57 PM
is this a catalog client script or a script include? also can you tell if we can the cart price also in a similar way ? or is there some other way to get the catalog price onload of the form?