Shipping Address

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
15 years ago
Hi can you tell me how to get the shipping address to show up on customer confirmation email.
Billing address shows ok.
This is what I am getting.

Shipping Address
%Order.ShippingFirstName% %Order.ShippingLastName%
%Order.ShippingAddress1%
%Order.ShippingCity% %Order.ShippingZipPostalCode%
%Order.ShippingStateProvince% %Order.ShippingCountry%

Thanks
15 years ago
That's a bug that will be fixed in the next release.

Find and open MessageManager.cs file

Replace this method
public static string ReplaceMessageTemplateTokens(Order order, string Template)
with new one:

/// <summary>
        /// Replaces a message template tokens
        /// </summary>
        /// <param name="order">Order instance</param>
        /// <param name="Template">Template</param>
        /// <returns>New template</returns>
        public static string ReplaceMessageTemplateTokens(Order order, string Template)
        {
            NameValueCollection tokens = new NameValueCollection();
            tokens.Add("Store.Name", SettingManager.GetSettingValue("Common.StoreName"));
            tokens.Add("Store.URL", SettingManager.GetSettingValue("Common.StoreURL"));
            tokens.Add("Store.Email", AdminEmailAddress);
            
            tokens.Add("Order.OrderNumber", order.OrderID.ToString());
            tokens.Add("Order.PaymentMethod", order.PaymentMethodName);

            tokens.Add("Order.BillingFirstName", order.BillingFirstName);
            tokens.Add("Order.BillingLastName", order.BillingLastName);
            tokens.Add("Order.BillingPhoneNumber", order.BillingPhoneNumber);
            tokens.Add("Order.BillingEmail", order.BillingEmail.ToString());
            tokens.Add("Order.BillingFaxNumber", order.BillingFaxNumber);
            tokens.Add("Order.BillingCompany", order.BillingCompany);
            tokens.Add("Order.BillingAddress1", order.BillingAddress1);
            tokens.Add("Order.BillingAddress2", order.BillingAddress2);
            tokens.Add("Order.BillingCity", order.BillingCity);
            tokens.Add("Order.BillingStateProvince", order.BillingStateProvince);
            tokens.Add("Order.BillingZipPostalCode", order.BillingZipPostalCode);
            tokens.Add("Order.BillingCountry", order.BillingCountry);

            tokens.Add("Order.ShippingMethod", order.ShippingMethod);

            tokens.Add("Order.ShippingFirstName", order.ShippingFirstName);
            tokens.Add("Order.ShippingLastName", order.ShippingLastName);
            tokens.Add("Order.ShippingPhoneNumber", order.ShippingPhoneNumber);
            tokens.Add("Order.ShippingEmail", order.ShippingEmail.ToString());
            tokens.Add("Order.ShippingFaxNumber", order.ShippingFaxNumber);
            tokens.Add("Order.ShippingCompany", order.ShippingCompany);
            tokens.Add("Order.ShippingAddress1", order.ShippingAddress1);
            tokens.Add("Order.ShippingAddress2", order.ShippingAddress2);
            tokens.Add("Order.ShippingCity", order.ShippingCity);
            tokens.Add("Order.ShippingStateProvince", order.ShippingStateProvince);
            tokens.Add("Order.ShippingZipPostalCode", order.ShippingZipPostalCode);
            tokens.Add("Order.ShippingCountry", order.ShippingCountry);

            tokens.Add("Order.CreatedOn", order.CreatedOn.ToString("D"));
            tokens.Add("Order.OrderTotal", String.Format("{0} ({1})", order.OrderTotalInCustomerCurrency.ToString("N"), order.CustomerCurrencyCode));
            tokens.Add("Order.OrderURLForCustomer", string.Format("{0}/OrderDetails.aspx?OrderID={1}", SettingManager.GetSettingValue("Common.StoreURL"), order.OrderID));

            foreach (string token in tokens.Keys)
                Template = Template.Replace(string.Format(@"%{0}%", token), tokens[token]);

            return Template;
        }
15 years ago
Thanks, that worked.
There was one more little error, the last name comes up twice no first name, I found the error for you.
It is in OrderManager.cs,

shippingFirstName = shippingInfo.ShippingAddress.LastName;
                    shippingLastName = shippingInfo.ShippingAddress.LastName;

You just had the Last name in twice.
Best Regards
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.