Country code and country name

For general questions and discussions specific to the AbleCommerce GOLD ASP.Net shopping cart software.
Post Reply
Ken
Ensign (ENS)
Ensign (ENS)
Posts: 9
Joined: Mon Sep 03, 2012 1:17 am

Country code and country name

Post by Ken » Tue Mar 26, 2013 11:03 pm

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?

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Country code and country name

Post by mazhar » Wed Mar 27, 2013 4:59 am

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

Code: Select all

<%= GetWarehouseAddress() %>
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.

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Country code and country name

Post by mazhar » Wed Mar 27, 2013 5:21 am

BTW just for reference I have reported this issue as bug.

Post Reply