Configuration of the Shopping Cart on Portal

Joshua Cassity
Kilo Guru

I am interested in a couple of things dealing with the cart:

1. How would we remove the Requested For, Deliver to and Special Instructions from the cart view? Many of our options are service based and we don't really deliver an AD account to an address.. lol. I'd imagine this is something where we'd clone the widget and do some modifications but I'm no widget guru.

find_real_file.png

2. How would I push a quantity value stored in a catalog item's variable (u_quantity) into the shopping cart when it's added and then prevent the user from changing it in the cart view?

Ex. Someone orders a door stop with a quantity of 35, I want the quantity to be 35 in the cart on the portal but not let them alter it without altering the quantity on the original request.

How would a fella go about doing that?

Thanks.

1 ACCEPTED SOLUTION

Joshua Cassity
Kilo Guru

Through much trial and error I have had a breakthrough in updating the quantity on the portal shopping cart using a business rule. Sharing that wealth in case anyone else needs this.



1. I created a variable set that will be used with only the Quantity field on it. This is imperative as we will use this variable's system id as a condition on the business rule to prevent it from running other than for quantity updates.



2. I created a Before Insert/Update BR on the sc_item_option table with a condition that the Question be the variable that was setup in Step 1. I initially tried to do this on the cart item; however, it appears the item option isn't created before the cart item so I would never get any results when I attempted to query the related table.



find_real_file.png



3. I wrote a pretty simple glide query to get the values of the Cart Item and Value from the current Item Option form, search the Cart Items table until it found a match on the related cart and then updated it's quantity with the value of the variable.




// 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 it's quantity value with the variable's value.


var gr = new GlideRecord('sc_cart_item');


gr.addQuery('sys_id', cartItem);


gr.query();



while(gr.next()){


      gr.quantity = qty;


      gr.update();


}


s);




And that was it.



Catalog Item - Add to Cart


find_real_file.png




Shopping Cart Display


find_real_file.png



I hope this helps anyone else who is struggling with dealing with this. It was a two day nightmare for me but we finally have somewhat of a solution.


View solution in original post

7 REPLIES 7

Joshua Cassity
Kilo Guru

Unfortunately I already tried that one and it remains even after removing those options. That impacts the INTERNAL shopping cart but apparently does not the Service Portal User Interface / Widget.



find_real_file.png


Joshua Cassity
Kilo Guru

Through much trial and error I have had a breakthrough in updating the quantity on the portal shopping cart using a business rule. Sharing that wealth in case anyone else needs this.



1. I created a variable set that will be used with only the Quantity field on it. This is imperative as we will use this variable's system id as a condition on the business rule to prevent it from running other than for quantity updates.



2. I created a Before Insert/Update BR on the sc_item_option table with a condition that the Question be the variable that was setup in Step 1. I initially tried to do this on the cart item; however, it appears the item option isn't created before the cart item so I would never get any results when I attempted to query the related table.



find_real_file.png



3. I wrote a pretty simple glide query to get the values of the Cart Item and Value from the current Item Option form, search the Cart Items table until it found a match on the related cart and then updated it's quantity with the value of the variable.




// 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 it's quantity value with the variable's value.


var gr = new GlideRecord('sc_cart_item');


gr.addQuery('sys_id', cartItem);


gr.query();



while(gr.next()){


      gr.quantity = qty;


      gr.update();


}


s);




And that was it.



Catalog Item - Add to Cart


find_real_file.png




Shopping Cart Display


find_real_file.png



I hope this helps anyone else who is struggling with dealing with this. It was a two day nightmare for me but we finally have somewhat of a solution.


When someone edits their product in the cart, they can't go back and throw in an attachment. Have you already addressed this limitation?

 

Thanks