Shopping cart - Requested for

kmanning
Giga Contributor

When a user adds an item to the cart and changes the Requested for field, the Contact information (address) does not update.

Also, the Requested for defaults to the last person the user selected. As you can see Chris Overpeck is logged in and had previously changed the Requested for to Brenda Hoyt and the Contact information (address) did not update. I had him go back in and Brenda Hoyt is still selected as the Requested for. Ideally Requested for would default to the person who is logged in AND if it were changed the Contact information would update to reflect the address of the user that has been selected.

cart - req for.jpg

20 REPLIES 20

randrews
Tera Guru

the cart requested for always turns back to gs.user... to prevent this in the items put in an onchange client script   keyed to the requested for...



we call ours set requested for...



function onChange(control, oldValue, newValue, isLoading) {


   


    if (newValue){


          var gr = new GlideRecord('sc_cart');


          gr.addQuery('user', g_user.userID);


          gr.query();


          gr.next();


          gr.requested_for = newValue;


          gr.update();


    }


}


Doug, this worked to change the Requested for back to the user who is logged in (instead of defaulting to the last user who was selected). However, the Contact information (location) for the selected Requested for is not updating.


hmm that isn't good.. it is working fine on mine i just checked again.. i don't believe we have modified that part of the cart page either.. i will keep looking for that part.


I did find this in table sc_cart, wonder if I need to add something for delivery_address so it grabs the requested_for's address


sc_cart.jpg