Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Liam 7 posts 77 karma points
    Sep 09, 2016 @ 10:15
    Liam
    0

    Editing Merchello Address

    Hi,

    I am building some functionality to have multiple addresses and an address manager.

    I am now trying to edit an existing address.

    I have been follow the same path as in FastTrack and used BillingAddressFactory.Create OR ShippingAddressFactory.Create to convert my model into a ICustomerAddress for saving.

    I then call

    ((ICustomer)CurrentCustomer).SaveCustomerAddress(caddress);            
    

    to save my address but in the method above I can't see where the properties are being updated e.g. FullName was changed and posted, it has the updated info the the parameter (caddress.FullName is correct) but it doesn't update and unless I am missing something I can't see where it's trying to update.

    For quick reference https://github.com/Merchello/Merchello/blob/2.1.0/src/Merchello.Core/Models/CustomerExtensions.cs#L351

    It works if I change this:

    if (!isUpdate) addresses.Add(address);
    

    to:

    if (!isUpdate)
            {
                addresses.Add(address);
            }
            else//update the exiting address
            {
                //find the address and update the properties??
                var addressToUpdate = addresses.Where(x => x.Key == address.Key).FirstOrDefault();
                addressToUpdate.FullName = address.FullName;
                //and so on
    
            }
    

    This would be modifying Merchello.Core though so I could be completely wrong - any pointers would be great.

    Thanks, Liam

  • Rusty Swayne 1655 posts 4993 karma points c-trib
    Sep 09, 2016 @ 17:06
    Rusty Swayne
    0

    Nope - I don't have any pointer rather would ask you for a pull request for the bug fix =)

Please Sign in or register to post replies

Write your reply to:

Draft