Clear fields/variables when clicking on "Add to Cart"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-14-2010 03:40 AM
Users may want to order the same catalog item multiple times. Currently they need to fill out the information and click "add to cart" , then they have to go back to the service catalog to reorder the item. This simple modification will clear out the fields (reload the window) after they click "add to cart" so that they can put in multiple requests.
Out of the box, the car is contained in a UI Macro called 'catalog_cart_default'. When you press the 'Add to Cart' button, it triggers a function called 'addToCart' that is contained in the macro. All you need to do is add a single line (reloadWindow(window)); right before the closing bracket for that function.
Thanks Mark!
Sean

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-14-2010 06:54 AM
Wow, that's a great idea! I think that will be pretty useful for us, thanks for sharing.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-24-2012 11:28 AM
I'm wondering if anyone has a suggestion on how to clear the variables on Add to Cart but only for particular catalog items. Sometimes I want my users to be able to fill out a form and leave most of the fields filled in but maybe only change one or two, so I might not want this to be global. But there are a couple of my catalog items where I really do need to use this. How can it be utilized for some items and not others?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-30-2015 01:28 PM
You can try this in an onLoad client script:
function onLoad() {
}
document.getElementById('add_to_cart_button').addEventListener("click", function(){
reloadWindow(window)
});
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-04-2015 07:48 AM
Is this a Catalog Client Script on each item or is there a regular client script on one table that can be created?
I'm trying to see if I can add [at the least] an InfoMessage when the "Add to Cart" button is clicked. I've received a customization requirement to make it more "visible" that the user clicked on the "Add to Cart" button. Ideally I'd do some flashy animation but at least will start with some onClick infoMessage somehow.