Page 1 of 1

Add phone number to packing slip

Posted: Sun Nov 16, 2008 7:10 pm
by gio50000
I would like to add the customers phone number to the packing slip. After I edit the Website\Admin\Orders\Print\PackSlips.aspx page what snippet of code do I have to add?

Thanks,
Gio

Re: Add phone number to packing slip

Posted: Mon Nov 17, 2008 3:02 am
by mazhar
Edit the Admin/Orders/Print/PackSlips.aspx file and locate the following code

Code: Select all

<asp:Label ID="ShipTo" runat="server" Text='<%#((OrderShipment)Container.DataItem).FormatToAddress()%>'></asp:Label>
and make it look like

Code: Select all

<asp:Label ID="ShipTo" runat="server" Text='<%#((OrderShipment)Container.DataItem).FormatToAddress() + GetPhoneNumber(Container.DataItem)%>'></asp:Label>
Now add the following method in the script section

Code: Select all

protected string GetPhoneNumber(Object dataItem) 
    {
        OrderShipment orderShipment = (OrderShipment)dataItem;
        if (String.IsNullOrEmpty(orderShipment.ShipToPhone))
            return string.Empty;
        return "<br /> Phone# " + orderShipment.ShipToPhone;
    }
These changes will append the customer phone number in the ShipTo address section.

Re: Add phone number to packing slip

Posted: Mon Nov 17, 2008 8:54 am
by gio50000
Mazhar - it worked like a charm.

I would like to add the email address to the packing slip. I could use the same example but I don't know the email dataitem.

Gio

Re: Add phone number to packing slip

Posted: Mon Nov 17, 2008 8:57 am
by mazhar
You can use the ShipToEmail property like

Code: Select all

return "Email: "+orderShipment.ShipToEmail;

Re: Add phone number to packing slip

Posted: Mon Nov 17, 2008 9:00 am
by mazhar
Very helpful post about putting Email address on the PackSlip have a look at it.
viewtopic.php?f=44&t=7913&p=33547