Add shipping method to order manager list page

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
User avatar
Jaz
Captain (CAPT)
Captain (CAPT)
Posts: 245
Joined: Wed Nov 05, 2008 4:04 am
Location: Torrance, CA
Contact:

Add shipping method to order manager list page

Post by Jaz » Thu Jun 11, 2009 2:41 am

Each day I print out the order manager page to know what orders need to go out. Is there a way to add a column to show shipping method so I know what my rush orders are?

~Jaz
David Jasiewicz
President
Trick Concepts - Metal Fab. Engineering and Product Design
http://www.trickconcepts.com-- If you are an ASP or PHP programmer or CSS web specialist I will gladly trade for graphic design, mechanical engineering or metal fabrication service! --

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

Re: Add shipping method to order manager list page

Post by mazhar » Thu Jun 11, 2009 4:54 am

Edit your Admin/Orders/Default.aspx file and locate following code

Code: Select all

<asp:TemplateField HeaderText="Shipment">
                                <ItemStyle HorizontalAlign="Left" />
                                <HeaderStyle HorizontalAlign="Center" />
                                <ItemTemplate>
                                    <asp:PlaceHolder ID="phShipmentStatus" runat="server"></asp:PlaceHolder>
                                    <asp:Label ID="ShipmentStatus" runat="server" Text='<%# Eval("ShipmentStatus") %>'></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
and change it to

Code: Select all

<asp:TemplateField HeaderText="Shipment">
                                <ItemStyle HorizontalAlign="Left" />
                                <HeaderStyle HorizontalAlign="Center" />
                                <ItemTemplate>
                                    <asp:PlaceHolder ID="phShipmentStatus" runat="server"></asp:PlaceHolder>
                                    <asp:Label ID="ShipmentStatus" runat="server" Text='<%# Eval("ShipmentStatus") %>'></asp:Label>
                                </ItemTemplate>
                            </asp:TemplateField>
                            
                            <asp:TemplateField HeaderText="Shipment Methods">
                                <ItemStyle HorizontalAlign="Left" />
                                <HeaderStyle HorizontalAlign="Center" />
                                <ItemTemplate>
                                    <%# GetShippingMethods(Container.DataItem) %>
                                </ItemTemplate>
                            </asp:TemplateField>
Now edit Admin/Orders/Default.aspx.cs file and add following method to it

Code: Select all

protected string GetShippingMethods(Object dataItem) 
    {
        string shippmentMethods = string.Empty;
        Order order = (Order)dataItem;
        List<int> shippmentMethodIds = new List<int>();
        foreach (OrderShipment orderShipment in order.Shipments)
        {
            if (orderShipment.ShipMethodName != null && !shippmentMethodIds.Contains(orderShipment.ShipMethodId))
            {
                shippmentMethodIds.Add(orderShipment.ShipMethodId);
                shippmentMethods += orderShipment.ShipMethodName + ",";
            }
        }
        if (!string.IsNullOrEmpty(shippmentMethods))
            shippmentMethods = shippmentMethods.Remove((shippmentMethods.Length - 1), 1);
        return shippmentMethods;
    }

William M
Commander (CMDR)
Commander (CMDR)
Posts: 150
Joined: Sat Feb 14, 2009 9:40 am
Contact:

Re: Add shipping method to order manager list page

Post by William M » Thu Jun 11, 2009 6:39 am

This mod should be ootb. Maybe in the next upgrade?

User avatar
Jaz
Captain (CAPT)
Captain (CAPT)
Posts: 245
Joined: Wed Nov 05, 2008 4:04 am
Location: Torrance, CA
Contact:

Re: Add shipping method to order manager list page

Post by Jaz » Thu Jun 11, 2009 1:42 pm

Thank You very much. You have just made my wife very happy.

~Jaz
David Jasiewicz
President
Trick Concepts - Metal Fab. Engineering and Product Design
http://www.trickconcepts.com-- If you are an ASP or PHP programmer or CSS web specialist I will gladly trade for graphic design, mechanical engineering or metal fabrication service! --

speedythinker
Commander (CMDR)
Commander (CMDR)
Posts: 121
Joined: Sat Sep 23, 2006 1:00 pm

Re: Add shipping method to order manager list page

Post by speedythinker » Wed Jan 06, 2010 11:33 pm

The code works great, thank you! Is it possible to high light UPS Next Day, UPS 2nd Air , and USPS Express say in red color or bold

Thanks
Speedy

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

Re: Add shipping method to order manager list page

Post by mazhar » Thu Jan 07, 2010 4:13 am

speedythinker wrote:The code works great, thank you! Is it possible to high light UPS Next Day, UPS 2nd Air , and USPS Express say in red color or bold

Thanks
Speedy

Code: Select all

protected string GetShippingMethods(Object dataItem)
    {
        string shippmentMethods = string.Empty;
        Order order = (Order)dataItem;
        List<int> shippmentMethodIds = new List<int>();
        foreach (OrderShipment orderShipment in order.Shipments)
        {
            if (orderShipment.ShipMethodName != null && !shippmentMethodIds.Contains(orderShipment.ShipMethodId))
            {
                shippmentMethodIds.Add(orderShipment.ShipMethodId);
                shippmentMethods += orderShipment.ShipMethodName + ",";
            }
        }
        if (!string.IsNullOrEmpty(shippmentMethods))
        {
            shippmentMethods = shippmentMethods.Remove((shippmentMethods.Length - 1), 1);
            if (shippmentMethods.Contains("UPS Next Day") || shippmentMethods.Contains("UPS 2nd Air") || shippmentMethods.Contains("USPS Express"))
                shippmentMethods = string.Format("<div style='background-color:red;color:#FFFFFF;'>{0}</div>",shippmentMethods);
        }
        return shippmentMethods;
    }
This version of function code should be used if you want to highlight UPS Next Day, UPS 2nd Air , and USPS Express methods by putting a red background.

speedythinker
Commander (CMDR)
Commander (CMDR)
Posts: 121
Joined: Sat Sep 23, 2006 1:00 pm

Re: Add shipping method to order manager list page

Post by speedythinker » Thu Jan 07, 2010 8:59 am

Works Great! FYI, the 'UPS 2nd Air" missing the "Day" and it works perfect after I added it in!
Many thanks!

Speedy :)

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

Re: Add shipping method to order manager list page

Post by mazhar » Thu Jan 07, 2010 9:28 am

Sounds good that you made it work :)

speedythinker
Commander (CMDR)
Commander (CMDR)
Posts: 121
Joined: Sat Sep 23, 2006 1:00 pm

Re: Add shipping method to order manager list page

Post by speedythinker » Sun Jan 10, 2010 3:21 pm

Just got one more little thought about the Order screen , how could I highlight the 'Problem' status? I found that eventhough I changed an order status to 'problem' that need some care before shipping. But my shipper could easily oversight it had the item shipped out without the problem being fixed yet.

Thanks again
Speedy

SamsSteins
Lieutenant Commander (LCDR)
Lieutenant Commander (LCDR)
Posts: 92
Joined: Thu Jul 10, 2008 11:43 am
Location: Lancaster PA
Contact:

Re: Add shipping method to order manager list page

Post by SamsSteins » Wed May 25, 2011 12:25 pm

Will this work with AbleCommerce 7.0.7?

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

Re: Add shipping method to order manager list page

Post by mazhar » Thu May 26, 2011 3:57 am

I am quite sure that It will work.

Post Reply