Page 1 of 1
Country code and country name
Posted: Tue Mar 26, 2013 11:03 pm
by Ken
There are three address in printable tax invoice page. They are warehouse address, ship to address and sold to address. My problem is AU for warehouse country ,AUSTRALIA for sold to country and AU for Ship to address. This looks not good. We want they are consistent. If it's country code then all display AU. If it's country name then all display AUSTRALIA.
Is this can be done in some way?
Re: Country code and country name
Posted: Wed Mar 27, 2013 4:59 am
by mazhar
Give a try to this fix. Edit your
Website/Admin/Orders/Print/Invoices.aspx.cs file and locate following code
Code: Select all
string shipTo = shipment.FormatToAddress();
and replace it with
Code: Select all
IAddressFormatter formatter = AbleContext.Container.Resolve<IAddressFormatter>();
string shipTo = formatter.Format(shipment.ShipToFullName, shipment.ShipToCompany, shipment.ShipToAddress1, shipment.ShipToAddress2, shipment.ShipToCity, shipment.ShipToProvince, shipment.ShipToPostalCode, shipment.ShipToCountryCode, shipment.ShipToPhone, shipment.ShipToFax, shipment.ShipToEmail, true);
Then you need to add following code just above the last two curly brances
Code: Select all
protected string GetWarehouseAddress()
{
CommerceBuilder.Shipping.Warehouse warehouse = AbleContext.Current.Store.DefaultWarehouse;
IAddressFormatter formatter = AbleContext.Container.Resolve<IAddressFormatter>();
return formatter.Format(string.Empty, string.Empty, warehouse.Address1, warehouse.Address2, warehouse.City, warehouse.Province, warehouse.PostalCode, warehouse.Country.Id, warehouse.Phone, warehouse.Fax, warehouse.Email, true);
}
Save the file.
Now edit
Website/Admin/Orders/Print/Invoices.aspx file and locate following code
Code: Select all
<%# AbleContext.Current.Store.DefaultWarehouse.FormatAddress(true) %>
and replace it with
Save the file and now if every thing went smooth it should be showing country name for both warehouse and shipping address. I am attaching the modified version of my Invoices.aspx page so you can use it for reference if you have any trouble applying above changes.
Re: Country code and country name
Posted: Wed Mar 27, 2013 5:21 am
by mazhar
BTW just for reference I have reported this issue as bug.