Using Umbraco 7.3.4 and Merchello 1.13.2 and want to add a note to the Invoice for commentary.
First i tried this, but that seemed not working at al, when requesting the invoice the Notes are null:
if (invoice.Notes == null) {
invoice.Notes = new List<Note>();
}
invoice.Notes.Add(note);
invoiceService.Save(invoice);
Tried this, but then i don't know how to connect it to the Invoice:
//Adding notes to the Invoice
var noteService = MerchelloContext.Current.Services.NoteService;
Note note = new Note();
note.Message = message;
noteService.Save(note);
Found this, but don't know how to connect it with the invoice:
var merchelloServices = MerchelloContext.Current.Services;
var currentCustomer = new CustomerContext(Umbraco.UmbracoContext).CurrentCustomer;
var merchelloHelper = new MerchelloHelper();
var invoiceService = merchelloServices.InvoiceService;
var noteService = merchelloServices.NoteService;
var customerBasket = currentCustomer.Basket();
var countryCode = "US";
var address = new Address { AddressType = AddressType.Billing, CountryCode = countryCode };
var checkoutManager = customerBasket.GetCheckoutManager();
checkoutManager.Customer.SaveBillToAddress(address);
var invoice = checkoutManager.Payment.PrepareInvoice();
invoice.VersionKey = Guid.NewGuid();
invoice.Items.Add(customerBasket.Items);
invoiceService.Save(invoice);
//save invoice note
var note = noteService.CreateNoteWithKey(invoice.Key, EntityType.Invoice, model.AdditionalInformation);
noteService.Save(note);
//clear basket
customerBasket.Empty();
How to implementate note(s) to Invoices
Hi,
Using Umbraco 7.3.4 and Merchello 1.13.2 and want to add a note to the Invoice for commentary.
First i tried this, but that seemed not working at al, when requesting the invoice the Notes are null:
Tried this, but then i don't know how to connect it to the Invoice:
Found this, but don't know how to connect it with the invoice:
Can someone give me a basic example how to implemtate this?
Kind regards, Wesley
I'm now using this:
And when i request the Invoice:
invoice.Notes is still null.
Using the NoteService i can get the notes with:
So is this the way it supposed to be working?
Did you ever get this to work? It is causing me headaches too
Best Kristian
It seems that you need to ensure that the invoice is saved first.
Because the Invoice object is not in commited state and you cannot made a relation.
Hi Kristian... it is not working for me....
It is staying empty :/
Any help would be much appreciated
Have you look this solution?
It works for me.
https://our.umbraco.org/projects/collaboration/merchello/merchello/78529-notes-do-not-save#comment-250880
is working on a reply...