November Happy Hour will be moved to Thursday December 5th.
November Happy Hour will be moved to Thursday December 5th.
Hi,
I looks like you need to call
ch.Cart.AcceptChanges() after that code to make sure it got saved to database. Otherwise it'll be lost when GC kicks in.
Regards.
/Q
Yes, I do this too and nothing happens - the AddNew() method works but not Add(on).
AddNew() leaves blank entries into the Notes section and does not save the updates - ch.Cart.AcceptChanges() doesnt update the Notes - any ideas?
Have you tried AddNew first and finally AcceptChanges:
OrderNote on = ch.Cart.OrderNotes.AddNew();
on.Detail = AnswerRef;
on.OrderNoteId = Convert.ToInt32(QuestionRef);
on.Title = AnswerRef;
on.Type = "Custom";
on.Created = DateTime.Now;
ch.Cart.AcceptChanges();
This is great but it still doesnt save the OrderNote. Is there any other way that this can be done?
Just to be clear, do you want to update an existing OrderNote or create a new one?
I ask because you are trying to set OrderNoteId:
on.OrderNoteId = Convert.ToInt32(QuestionRef);
If you want to update an existing note I think you need to find it by iterating ch.Cart.OrderNotes and change the wanted note and AcceptChanges. If you want to create a new note then don't set the OrderNoteId.
Hi,
How do you add notes dynamically to a Cart?
I have used the following code yet the Notes are never added
ch being a new CartHelper - the code comes afer an entry is added to the cart (ch)
eg:
Jon