Copied to clipboard

Flag this post as spam?

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


  • Eidos 44 posts 66 karma points
    Dec 10, 2014 @ 15:39
    Eidos
    0

    Shipping address for anonymous customer

    The anonymous customer shipping address is stored in extendedData column on merchInvoiceItem.

    Should I view this information in the invoice template in backend? (I can't see this information)

    How can I use the shipping address in the email template? (ex. {{ShipToName}} return nothing)

  • Eidos 44 posts 66 karma points
    Dec 11, 2014 @ 15:45
    Eidos
    0

    I analyzed the angularJS code and I understand that I can see the shipping address (in the back-end in the invoice details) only when I set the invoice as payed so an order is created (I pull in github a new check for Know if the shipping address exists or not).

    I Understood:

    • I can see only the billing address information when the order is not payed.
    • I can see only the shipping and billing address when the order is Payed.
    • In the order confirmation message I can use only billing tag (Ex. {{ShipToName}}) and invoice tag (Ex. {{Item.Name}}).
    • In the order shipped message I can use only shipping tag (Ex. {{BillToName}}).

    is it correct?

     

  • Rusty Swayne 1655 posts 4993 karma points c-trib
    Dec 11, 2014 @ 17:54
    Rusty Swayne
    0

    Hi Eidos,

    This is one of the areas on my to do list to simplify as I admit it is setup pretty strange and pretty confusing. The merchello.config entries you are setting for the pattern matches are loaded into a "formatter" and then "if" a model has a parameter, it is replaced otherwise it is string.empty.

    I am guessing you are identifying omissions in the extension methods used to populate the formatter with data from the models being passed to them.

    For the order confirmation the method is Merchello.Core.Models.InvoiceExtensions ->

     internal static IEnumerable<IReplaceablePattern> ReplaceablePatterns(this IInvoice invoice)
        {
            // TODO localization needed on pricing and datetime
            var patterns = new List<IReplaceablePattern>
            {
                ReplaceablePattern.GetConfigurationReplaceablePattern("InvoiceNumber", invoice.PrefixedInvoiceNumber()),
                ReplaceablePattern.GetConfigurationReplaceablePattern("InvoiceDate", invoice.InvoiceDate.ToShortDateString()),
                ReplaceablePattern.GetConfigurationReplaceablePattern("BillToName", invoice.BillToName),
                ReplaceablePattern.GetConfigurationReplaceablePattern("BillToAddress1", invoice.BillToAddress1),
                ReplaceablePattern.GetConfigurationReplaceablePattern("BillToAddress2", invoice.BillToAddress2),
                ReplaceablePattern.GetConfigurationReplaceablePattern("BillToLocality", invoice.BillToLocality),
                ReplaceablePattern.GetConfigurationReplaceablePattern("BillToRegion", invoice.BillToRegion),
                ReplaceablePattern.GetConfigurationReplaceablePattern("BillToPostalCode", invoice.BillToPostalCode),
                ReplaceablePattern.GetConfigurationReplaceablePattern("BillToCountryCode", invoice.BillToCountryCode),
                ReplaceablePattern.GetConfigurationReplaceablePattern("BillToEmail", invoice.BillToEmail),
                ReplaceablePattern.GetConfigurationReplaceablePattern("BillToPhone", invoice.BillToPhone),
                ReplaceablePattern.GetConfigurationReplaceablePattern("BillToCompany", invoice.BillToCompany),
                ReplaceablePattern.GetConfigurationReplaceablePattern("TotalPrice", invoice.Total.ToString("C")),
                ReplaceablePattern.GetConfigurationReplaceablePattern("InvoiceStatus", invoice.InvoiceStatus.Name)                
            };
    
            patterns.AddRange(invoice.LineItemReplaceablePatterns());
    
            return patterns;
        }
    

    I will add a task to review the execution of:

    patterns.AddRange(invoice.LineItemReplaceablePatterns());
    

    http://issues.merchello.com/youtrack/issue/M-532

    We are working on documentation to provide instruction so that people can write their own "Monitors and Triggers" for notification providers. These allow you to create your own models to build out custom messages. Shooting for later in December (2014) to have the docs published.

  • Eidos 44 posts 66 karma points
    Dec 15, 2014 @ 17:26
    Eidos
    0

    Hi Rusty,

    thanks for your reply. Now the issue is more clear!

  • David Peck 687 posts 1863 karma points c-trib
    Sep 15, 2015 @ 15:11
    David Peck
    2

    In case anyone else comes across this thread and want to get the shipping address from an invoice this should do the trick:

    var shippingItem = invoice.ShippingLineItems().FirstOrDefault();
    if (shippingItem != null)
          shipAddress = shippingItem.ExtendedData.GetAddress(AddressType.Shipping);
    
  • Tom Madden 252 posts 454 karma points MVP 4x c-trib
    Jun 12, 2017 @ 16:16
    Tom Madden
    0

    Just came across this last post and found that didn't work for me, however this does: posting here in case anyone else has a similar issue

    var shippingItem = invoice.Items.FirstOrDefault(x=>x.LineItemType==LineItemType.Shipping);
                if (shippingItem != null)
    
Please Sign in or register to post replies

Write your reply to:

Draft