Customer Comments

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

Customer Comments

Post by Jaz » Thu Dec 04, 2008 3:46 am

Most of what we sell has a somewhat costom nature to it. This means a lot of customers add comments in checkout. We need a way to get the customer comments to print out on the invoies, so we can make sure that we fill the customers needs. Is there a way to do this that dose not require checking every order by hand to see if there are comments on it?

Thanks,
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: Customer Comments

Post by mazhar » Thu Dec 04, 2008 5:43 am

It will be something very similar
viewtopic.php?f=44&t=9019

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

Re: Customer Comments

Post by Jaz » Tue Dec 09, 2008 7:12 pm

I made several changes to my invoice so it shows more information. I have added, coupons, quantity discount and customer notes. (nonprivate notes) No promises that the code is correct, but it is working for me. I would also like to add the shipping method. Any sugestions?

Here is my current code if anyone wants it:

Code: Select all

<%@ Page Language="C#" MasterPageFile="~/Admin/Admin.master" Title="Invoices" Inherits="CommerceBuilder.Web.UI.AbleCommerceAdminPage" %>
<%@ Register Src="../../UserControls/OrderItemDetail.ascx" TagName="OrderItemDetail" TagPrefix="uc" %>

<script runat="server">
    private List<string> orderNumbers;
    protected int OrderCount = 0;
    
    private List<int> GetSelectedOrders()
    {
        //CHECK FOR QUERYSTRING PARAMETERS
        List<int> selectedOrders = new List<int>();
        string orderIdList = Request.QueryString["orders"];
        if (!string.IsNullOrEmpty(orderIdList))
        {
            string[] numberTokens = orderIdList.Split(",".ToCharArray());
            foreach (string numberToken in numberTokens)
            {
                int temp = AlwaysConvert.ToInt(numberToken);
                if (temp > 0) selectedOrders.Add(temp);
            }
        }
        return selectedOrders;
    }

    private string GetOrderNumbers(List<int> orders)
    {
        if (orderNumbers == null)
        {
            orderNumbers = new List<string>();
            foreach (int orderId in orders)
            {
                orderNumbers.Add(orderId.ToString());
            }
        }
        if (orderNumbers.Count == 0) return string.Empty;
        return string.Join(", ", orderNumbers.ToArray());
    }

    /// <summary>
    /// Gets a collection of orders from a list of order ids.
    /// </summary>
    /// <param name="orderIds">The orderIds to load.</param>
    /// <returns>A collection of orders from the list of ids.</returns>
    protected OrderCollection GetOrders(params int[] orderIds)
    {
        OrderCollection orders = new OrderCollection();
        orderNumbers = new List<string>();
        foreach (int orderId in orderIds)
        {
            Order order = OrderDataSource.Load(orderId);
            if (order != null)
            {
                orderNumbers.Add(order.OrderId.ToString());
                orders.Add(order);
            }
        }
        OrderCount = orders.Count;
        return orders;
    }
    
	
	protected OrderNoteCollection GetOrderNotes(params int[] orders) 
    {
        OrderNoteCollection orderNotes = new OrderNoteCollection();
        foreach (int orderId in orders)
        {
            Order order = OrderDataSource.Load(orderId);
            if (order != null)
            {
                if (order.Notes != null && order.Notes.Count > 0)
                {
                    foreach (OrderNote on in order.Notes)
                        if(!on.IsPrivate)
                        orderNotes.Add(on);
                }
            }
        }
        return orderNotes;
    }
	
	
    protected void Page_Load(object sender, EventArgs e)
    {
        List<int> selectedOrders = GetSelectedOrders();
        if ((selectedOrders == null) || (selectedOrders.Count == 0)) Response.Redirect("~/Admin/Orders/Default.aspx");
        OrderRepeater.DataSource = GetOrders(selectedOrders.ToArray());
        OrderRepeater.DataBind();
		OrderNotesRepeater.DataSource = GetOrderNotes(selectedOrders.ToArray());
		OrderNotesRepeater.DataBind();
        OrderList.Text = GetOrderNumbers(selectedOrders);
    }

    protected OrderItemCollection GetProducts(object dataItem)
    {
        Order order = (Order)dataItem;
        OrderItemCollection products = new OrderItemCollection();
        foreach (OrderItem item in order.Items)
        {
            if (item.OrderItemType == OrderItemType.Product || item.OrderItemType == OrderItemType.Coupon || item.OrderItemType == OrderItemType.Discount)
            {
                products.Add(item);
            }
        }
        products.Sort(new OrderItemComparer());
        return products;
    }

    protected string GetBillToAddress(object dataItem)
    {
        return ((Order)dataItem).FormatAddress(true);
    }

    protected string GetShipToAddress(object dataItem)
    {
        Order order = (Order)dataItem;
        List<string> addressList = new List<string>();
        foreach (OrderShipment shipment in order.Shipments)
        {
            string shipTo = shipment.FormatToAddress();
            if (!addressList.Contains(shipTo)) addressList.Add(shipTo);
        }
        if (addressList.Count == 0) return "n/a";
        return string.Join("<hr />", addressList.ToArray());
    }

    protected LSDecimal GetTotal(object dataItem, params OrderItemType[] orderItems)
    {
        return ((Order)dataItem).Items.TotalPrice(orderItems);
    }

    protected LSDecimal GetTotalPayments(object dataItem)
    {
        return ((Order)dataItem).Payments.Total(true);
    }
    
    protected LSDecimal GetBalance(object dataItem)
    {
        return GetTotal(dataItem) - GetTotalPayments(dataItem);
    }
    
</script>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" Runat="Server">
    <div class="pageHeader noPrint">
        <div class="caption">
            <h1><asp:Localize ID="Caption" runat="server" Text="Invoices"></asp:Localize></h1>
        </div>
        <div class="content">
            <h2><asp:Localize ID="OrderListLabel" runat="server" Text="Includes Order Numbers:"></asp:Localize></h2>
            <asp:Label ID="OrderList" runat="server" Text=""></asp:Label><br />
            <p><asp:Localize ID="PrintInstructions" runat="server" Text="This document includes a printable stylesheet.  If you are using a modern browser (such as IE7, FF2, or Opera 7) this page will print with appropriate styles and page breaks if needed.  Website headers, footers, and this message will not be printed."></asp:Localize></p>
        </div>
    </div>
    <div class="noPrint">
        <asp:Button ID="Print" runat="server" Text="Print" OnClientClick="window.print();return false;" />
        <asp:Button ID="Back" runat="server" Text="Back" OnClientClick="window.history.go(-1);return false;" />
    </div>
    <asp:Repeater ID="OrderRepeater" runat="server">
        <ItemTemplate>
            <table align="center" class="form<%# (Container.ItemIndex < (OrderCount - 1)) ? " breakAfter" : string.Empty %>" cellpadding="0" cellspacing="0" border="1">
                <tr>
                    <td colspan="4" valign="middle">
                        <div style="float:left">
                            <br />
							<span class="inlineCaption" style="font-size:150%;"><%#Token.Instance.Store.Name%></span>
							<br />
                            <%# Token.Instance.Store.DefaultWarehouse.FormatAddress(true) %>
                        </div>
                        <div style="float:right">
                            <h1 class="invoice">INVOICE</h1>
                            <asp:Label ID="OrderNumberLabel" runat="server" Text="Order Number:" SkinID="FieldHeader"></asp:Label>
                            <asp:Label ID="OrderNumber" runat="server" Text='<%# Eval("OrderId") %>'></asp:Label><br />
                            <asp:Label ID="OrderDateLabel" runat="server" Text="Order Date:" SkinID="FieldHeader"></asp:Label>
                            <asp:Label ID="OrderDate" runat="server" Text='<%# Eval("OrderDate", "{0:g}") %>'></asp:Label><br />
                        </div>
                    </td>
                </tr>
                <tr>
                    <td style="width:10px;text-align:center;font-weight:bold" valign="top">
                        S O L D &nbsp; T O
                    </td>
                    <td valign="middle" width="50%">
                        <%# GetBillToAddress(Container.DataItem) %>
                    </td>
                    <td style="width:10px;text-align:center;font-weight:bold" valign="top">
                        S H I P &nbsp; T O
                    </td>
                    <td valign="middle" width="50%">
                        <%# GetShipToAddress(Container.DataItem) %>
                    </td>
                </tr>
                <tr>
                    <td colspan="4" class="dataSheet">
                        <asp:GridView ID="OrderItems" runat="server" ShowHeader="true"
                            AutoGenerateColumns="false" CellPadding=0 CellSpacing=0 GridLines="none" 
                            Width="100%" DataSource='<%#GetProducts(Container.DataItem)%>' CssClass="dataSheet">
                            <Columns>
                                <asp:BoundField DataField="Quantity" HeaderText="Quantity" ItemStyle-HorizontalAlign="Center" />
                                <asp:BoundField DataField="Sku" HeaderText="Sku" ItemStyle-HorizontalAlign="Center" />
                                <asp:TemplateField HeaderText="Item">
                                    <ItemTemplate>
                                        <uc:OrderItemDetail ID="OrderItemDetail1" runat="server" OrderItem='<%#(OrderItem)Container.DataItem%>' ShowAssets="False" LinkProducts="False" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Price">
                                    <ItemStyle HorizontalAlign="right" width="80px" />
                                    <ItemTemplate>
                                        <asp:Label ID="Price" runat="server" Text='<%#Eval("ExtendedPrice", "{0:lc}")%>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                            </Columns>
                        </asp:GridView>
                        <table width="100%" cellpadding="0" cellspacing="0" class="dataSheet">
                            <tr>
                                <th align="right">
                                    <asp:Label ID="SubtotalLabel" runat="server" Text="Subtotal:" />
                                </th>
                                <td align="right" width="80px">
                                    <%# string.Format("{0:lc}", GetTotal(Container.DataItem, OrderItemType.Product)) %>
                                </td>
                            </tr>
                            <tr>
                                <th align="right">
                                    <asp:Label ID="ShippingTotalLabel" runat="server" Text="Shipping:" />
                                </th>
                                <td align="right" width="80px">
                                    <%# string.Format("{0:lc}", GetTotal(Container.DataItem, OrderItemType.Shipping, OrderItemType.Handling)) %>
                                </td>
                            </tr>
                            <tr>
                                <th align="right">
                                    <asp:Label ID="TaxTotalLabel" runat="server" Text="Tax:" />
                                </th>
                                <td align="right" width="80px">
                                    <%# string.Format("{0:lc}", GetTotal(Container.DataItem, OrderItemType.Tax)) %>
                                </td>
                            </tr>
                            <tr id="trOther" runat="server" visible='<%# GetTotal(Container.DataItem, OrderItemType.Charge, OrderItemType.Coupon, OrderItemType.Credit, OrderItemType.Discount, OrderItemType.GiftCertificate, OrderItemType.GiftWrap) > 0 %>'>
                                <th align="right">
                                    <asp:Label ID="OtherTotalLabel" runat="server" Text="Other:" />
                                </th>
                                <td align="right" width="80px">
                                    <%# string.Format("{0:lc}", GetTotal(Container.DataItem, OrderItemType.Charge, OrderItemType.Coupon, OrderItemType.Credit, OrderItemType.Discount, OrderItemType.GiftCertificate, OrderItemType.GiftWrap)) %>
                                </td>
                            </tr>
                            <tr class="totalRow">
                                <th align="right">
                                    <asp:Label ID="TotalLabel" runat="server" Text="Total:" />
                                </th>
                                <td align="right" width="80px">
                                    <%# string.Format("{0:lc}", GetTotal(Container.DataItem)) %>
                                </td>
                            </tr>
                            <%--
                            <tr>
                                <th align="right">
                                    <asp:Label ID="PaymentsLabel" runat="server" Text="Payments:" />
                                </th>
                                <td align="right" width="80px">
                                    <%# string.Format("{0:lc}", GetTotalPayments(Container.DataItem)) %>
                                </td>
                            </tr>
                            <tr>
                                <th align="right">
                                    <asp:Label ID="BalanceLabel" runat="server" Text="Balance:" />
                                </th>
                                <td align="right" width="80px">
                                    <%# string.Format("{0:lc}", GetBalance(Container.DataItem)) %>
                                </td>
                            </tr>
                            --%>
                        </table>
                    </td>
                </tr>
            </table>
        </ItemTemplate>
    </asp:Repeater>
    <div class="content">
    <table align="center">
    <tr>
                    <td colspan="3" class="dataSheet">
                        <asp:GridView ID="OrderNotesRepeater" runat="server" ShowHeader="false" 
                            AutoGenerateColumns="false" CellPadding=0 CellSpacing=0 GridLines="none" 
                            Width="100%" CssClass="dataSheet">
                            <Columns>
                                <asp:TemplateField HeaderText="Notes">
                                    <ItemTemplate>
                                        <%#Eval("Comment") %>
                                    </ItemTemplate>
                                </asp:TemplateField>
                            </Columns>
                        </asp:GridView>
                    </td>
                </tr>
    </table>
    </div>
</asp:Content>
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
Jaz
Captain (CAPT)
Captain (CAPT)
Posts: 245
Joined: Wed Nov 05, 2008 4:04 am
Location: Torrance, CA
Contact:

Re: Customer Comments

Post by Jaz » Tue Dec 09, 2008 7:13 pm

Forgot to mention. This is the Invoices.aspx file, located in Admin/orders/print
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: Customer Comments

Post by mazhar » Thu Dec 11, 2008 5:15 am

I would also like to add the shipping method. Any sugestions?
One way to accomplish this may be as below

Code: Select all

<%@ Page Language="C#" MasterPageFile="~/Admin/Admin.master" Title="Invoices" Inherits="CommerceBuilder.Web.UI.AbleCommerceAdminPage" %>
<%@ Register Src="../../UserControls/OrderItemDetail.ascx" TagName="OrderItemDetail" TagPrefix="uc" %>

<script runat="server">
    private List<string> orderNumbers;
    protected int OrderCount = 0;
   
    private List<int> GetSelectedOrders()
    {
        //CHECK FOR QUERYSTRING PARAMETERS
        List<int> selectedOrders = new List<int>();
        string orderIdList = Request.QueryString["orders"];
        if (!string.IsNullOrEmpty(orderIdList))
        {
            string[] numberTokens = orderIdList.Split(",".ToCharArray());
            foreach (string numberToken in numberTokens)
            {
                int temp = AlwaysConvert.ToInt(numberToken);
                if (temp > 0) selectedOrders.Add(temp);
            }
        }
        return selectedOrders;
    }

    private string GetOrderNumbers(List<int> orders)
    {
        if (orderNumbers == null)
        {
            orderNumbers = new List<string>();
            foreach (int orderId in orders)
            {
                orderNumbers.Add(orderId.ToString());
            }
        }
        if (orderNumbers.Count == 0) return string.Empty;
        return string.Join(", ", orderNumbers.ToArray());
    }

    /// <summary>
    /// Gets a collection of orders from a list of order ids.
    /// </summary>
    /// <param name="orderIds">The orderIds to load.</param>
    /// <returns>A collection of orders from the list of ids.</returns>
    protected OrderCollection GetOrders(params int[] orderIds)
    {
        OrderCollection orders = new OrderCollection();
        orderNumbers = new List<string>();
        foreach (int orderId in orderIds)
        {
            Order order = OrderDataSource.Load(orderId);
            if (order != null)
            {
                orderNumbers.Add(order.OrderId.ToString());
                orders.Add(order);
            }
        }
        OrderCount = orders.Count;
        return orders;
    }
   
   
   protected OrderNoteCollection GetOrderNotes(params int[] orders)
    {
        OrderNoteCollection orderNotes = new OrderNoteCollection();
        foreach (int orderId in orders)
        {
            Order order = OrderDataSource.Load(orderId);
            if (order != null)
            {
                if (order.Notes != null && order.Notes.Count > 0)
                {
                    foreach (OrderNote on in order.Notes)
                        if(!on.IsPrivate)
                        orderNotes.Add(on);
                }
            }
        }
        return orderNotes;
    }
   
   
    protected void Page_Load(object sender, EventArgs e)
    {
        List<int> selectedOrders = GetSelectedOrders();
        if ((selectedOrders == null) || (selectedOrders.Count == 0)) Response.Redirect("~/Admin/Orders/Default.aspx");
        OrderRepeater.DataSource = GetOrders(selectedOrders.ToArray());
        OrderRepeater.DataBind();
      OrderNotesRepeater.DataSource = GetOrderNotes(selectedOrders.ToArray());
      OrderNotesRepeater.DataBind();
        OrderList.Text = GetOrderNumbers(selectedOrders);
    }

    protected string GetShipMethods(Object dataItem)
    {
        Order order = (Order)dataItem;
        string shippingMethods = string.Empty;
        foreach (OrderShipment orderShipment in order.Shipments)
        {
            shippingMethods += orderShipment.ShipMethod.Name;
            shippingMethods += ",";
        }
        if (!String.IsNullOrEmpty(shippingMethods))
            shippingMethods = shippingMethods.Remove((shippingMethods.Length - 1), 1);
        return shippingMethods;
    }

    protected OrderItemCollection GetProducts(object dataItem)
    {
        Order order = (Order)dataItem;
        
        OrderItemCollection products = new OrderItemCollection();
        foreach (OrderItem item in order.Items)
        {
            if (item.OrderItemType == OrderItemType.Product || item.OrderItemType == OrderItemType.Coupon || item.OrderItemType == OrderItemType.Discount)
            {
                products.Add(item);
            }
        }
        products.Sort(new OrderItemComparer());
        return products;
    }

    protected string GetBillToAddress(object dataItem)
    {
        return ((Order)dataItem).FormatAddress(true);
    }

    protected string GetShipToAddress(object dataItem)
    {
        Order order = (Order)dataItem;
        List<string> addressList = new List<string>();
        foreach (OrderShipment shipment in order.Shipments)
        {
            string shipTo = shipment.FormatToAddress();
            if (!addressList.Contains(shipTo)) addressList.Add(shipTo);
        }
        if (addressList.Count == 0) return "n/a";
        return string.Join("<hr />", addressList.ToArray());
    }

    protected LSDecimal GetTotal(object dataItem, params OrderItemType[] orderItems)
    {
        return ((Order)dataItem).Items.TotalPrice(orderItems);
    }

    protected LSDecimal GetTotalPayments(object dataItem)
    {
        return ((Order)dataItem).Payments.Total(true);
    }
   
    protected LSDecimal GetBalance(object dataItem)
    {
        return GetTotal(dataItem) - GetTotalPayments(dataItem);
    }
   
</script>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" Runat="Server">
    <div class="pageHeader noPrint">
        <div class="caption">
            <h1><asp:Localize ID="Caption" runat="server" Text="Invoices"></asp:Localize></h1>
        </div>
        <div class="content">
            <h2><asp:Localize ID="OrderListLabel" runat="server" Text="Includes Order Numbers:"></asp:Localize></h2>
            <asp:Label ID="OrderList" runat="server" Text=""></asp:Label><br />
            <p><asp:Localize ID="PrintInstructions" runat="server" Text="This document includes a printable stylesheet.  If you are using a modern browser (such as IE7, FF2, or Opera 7) this page will print with appropriate styles and page breaks if needed.  Website headers, footers, and this message will not be printed."></asp:Localize></p>
        </div>
    </div>
    <div class="noPrint">
        <asp:Button ID="Print" runat="server" Text="Print" OnClientClick="window.print();return false;" />
        <asp:Button ID="Back" runat="server" Text="Back" OnClientClick="window.history.go(-1);return false;" />
    </div>
    <asp:Repeater ID="OrderRepeater" runat="server">
        <ItemTemplate>
            <table align="center" class="form<%# (Container.ItemIndex < (OrderCount - 1)) ? " breakAfter" : string.Empty %>" cellpadding="0" cellspacing="0" border="1">
                <tr>
                    <td colspan="4" valign="middle">
                        <div style="float:left">
                            <br />
                     <span class="inlineCaption" style="font-size:150%;"><%#Token.Instance.Store.Name%></span>
                     <br />
                            <%# Token.Instance.Store.DefaultWarehouse.FormatAddress(true) %>
                        </div>
                        <div style="float:right">
                            <h1 class="invoice">INVOICE</h1>
                            <asp:Label ID="OrderNumberLabel" runat="server" Text="Order Number:" SkinID="FieldHeader"></asp:Label>
                            <asp:Label ID="OrderNumber" runat="server" Text='<%# Eval("OrderId") %>'></asp:Label><br />
                            <asp:Label ID="OrderDateLabel" runat="server" Text="Order Date:" SkinID="FieldHeader"></asp:Label>
                            <asp:Label ID="OrderDate" runat="server" Text='<%# Eval("OrderDate", "{0:g}") %>'></asp:Label><br />
                            <asp:Label ID="ShippingMethodsLabel" runat="server" SkinID="FieldHeader" Text="Shipping Medhods: "></asp:Label>
                            <asp:Label ID="ShippingMethods" runat="server" Text='<%# GetShipMethods(Container.DataItem) %>'></asp:Label>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td style="width:10px;text-align:center;font-weight:bold" valign="top">
                        S O L D &nbsp; T O
                    </td>
                    <td valign="middle" width="50%">
                        <%# GetBillToAddress(Container.DataItem) %>
                    </td>
                    <td style="width:10px;text-align:center;font-weight:bold" valign="top">
                        S H I P &nbsp; T O
                    </td>
                    <td valign="middle" width="50%">
                        <%# GetShipToAddress(Container.DataItem) %>
                    </td>
                </tr>
                <tr>
                    <td colspan="4" class="dataSheet">
                        <asp:GridView ID="OrderItems" runat="server" ShowHeader="true"
                            AutoGenerateColumns="false" CellPadding=0 CellSpacing=0 GridLines="none"
                            Width="100%" DataSource='<%#GetProducts(Container.DataItem)%>' CssClass="dataSheet">
                            <Columns>
                                <asp:BoundField DataField="Quantity" HeaderText="Quantity" ItemStyle-HorizontalAlign="Center" />
                                <asp:BoundField DataField="Sku" HeaderText="Sku" ItemStyle-HorizontalAlign="Center" />
                                <asp:TemplateField HeaderText="Item">
                                    <ItemTemplate>
                                        <uc:OrderItemDetail ID="OrderItemDetail1" runat="server" OrderItem='<%#(OrderItem)Container.DataItem%>' ShowAssets="False" LinkProducts="False" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Price">
                                    <ItemStyle HorizontalAlign="right" width="80px" />
                                    <ItemTemplate>
                                        <asp:Label ID="Price" runat="server" Text='<%#Eval("ExtendedPrice", "{0:lc}")%>'></asp:Label>
                                    </ItemTemplate>
                                </asp:TemplateField>
                            </Columns>
                        </asp:GridView>
                        <table width="100%" cellpadding="0" cellspacing="0" class="dataSheet">
                            <tr>
                                <th align="right">
                                    <asp:Label ID="SubtotalLabel" runat="server" Text="Subtotal:" />
                                </th>
                                <td align="right" width="80px">
                                    <%# string.Format("{0:lc}", GetTotal(Container.DataItem, OrderItemType.Product)) %>
                                </td>
                            </tr>
                            <tr>
                                <th align="right">
                                    <asp:Label ID="ShippingTotalLabel" runat="server" Text="Shipping:" />
                                </th>
                                <td align="right" width="80px">
                                    <%# string.Format("{0:lc}", GetTotal(Container.DataItem, OrderItemType.Shipping, OrderItemType.Handling)) %>
                                </td>
                            </tr>
                            <tr>
                                <th align="right">
                                    <asp:Label ID="TaxTotalLabel" runat="server" Text="Tax:" />
                                </th>
                                <td align="right" width="80px">
                                    <%# string.Format("{0:lc}", GetTotal(Container.DataItem, OrderItemType.Tax)) %>
                                </td>
                            </tr>
                            <tr id="trOther" runat="server" visible='<%# GetTotal(Container.DataItem, OrderItemType.Charge, OrderItemType.Coupon, OrderItemType.Credit, OrderItemType.Discount, OrderItemType.GiftCertificate, OrderItemType.GiftWrap) > 0 %>'>
                                <th align="right">
                                    <asp:Label ID="OtherTotalLabel" runat="server" Text="Other:" />
                                </th>
                                <td align="right" width="80px">
                                    <%# string.Format("{0:lc}", GetTotal(Container.DataItem, OrderItemType.Charge, OrderItemType.Coupon, OrderItemType.Credit, OrderItemType.Discount, OrderItemType.GiftCertificate, OrderItemType.GiftWrap)) %>
                                </td>
                            </tr>
                            <tr class="totalRow">
                                <th align="right">
                                    <asp:Label ID="TotalLabel" runat="server" Text="Total:" />
                                </th>
                                <td align="right" width="80px">
                                    <%# string.Format("{0:lc}", GetTotal(Container.DataItem)) %>
                                </td>
                            </tr>
                            <%--
                            <tr>
                                <th align="right">
                                    <asp:Label ID="PaymentsLabel" runat="server" Text="Payments:" />
                                </th>
                                <td align="right" width="80px">
                                    <%# string.Format("{0:lc}", GetTotalPayments(Container.DataItem)) %>
                                </td>
                            </tr>
                            <tr>
                                <th align="right">
                                    <asp:Label ID="BalanceLabel" runat="server" Text="Balance:" />
                                </th>
                                <td align="right" width="80px">
                                    <%# string.Format("{0:lc}", GetBalance(Container.DataItem)) %>
                                </td>
                            </tr>
                            --%>
                        </table>
                    </td>
                </tr>
            </table>
        </ItemTemplate>
    </asp:Repeater>
    <div class="content">
    <table align="center">
    <tr>
                    <td colspan="3" class="dataSheet">
                        <asp:GridView ID="OrderNotesRepeater" runat="server" ShowHeader="false"
                            AutoGenerateColumns="false" CellPadding=0 CellSpacing=0 GridLines="none"
                            Width="100%" CssClass="dataSheet">
                            <Columns>
                                <asp:TemplateField HeaderText="Notes">
                                    <ItemTemplate>
                                        <%#Eval("Comment") %>
                                    </ItemTemplate>
                                </asp:TemplateField>
                            </Columns>
                        </asp:GridView>
                    </td>
                </tr>
    </table>
    </div>
</asp:Content>

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

Re: Customer Comments

Post by Jaz » Thu Dec 11, 2008 8:29 pm

Once again, just what I was looking for.

thanks,
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! --

upstat3
Ensign (ENS)
Ensign (ENS)
Posts: 11
Joined: Wed Oct 29, 2008 4:47 pm

Re: Customer Comments

Post by upstat3 » Fri Dec 12, 2008 12:47 pm

I'd really like to use this invoice template but I'm wondering if there is a way to include the phone number and email address of the customer as well as a "pulled" box to the left of the quantity?

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

Re: Customer Comments

Post by Jaz » Fri Dec 12, 2008 1:23 pm

Ultimately, it sounds like a configurable invoice would be a great feature.
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: Customer Comments

Post by mazhar » Mon Dec 15, 2008 4:15 am

I'd really like to use this invoice template but I'm wondering if there is a way to include the phone number and email address of the customer as well as a "pulled" box to the left of the quantity?
Have a look at the following post.
viewtopic.php?f=44&t=7913

Brewhaus
Vice Admiral (VADM)
Vice Admiral (VADM)
Posts: 878
Joined: Sat Jan 19, 2008 4:30 pm

Re: Customer Comments

Post by Brewhaus » Thu Jan 01, 2009 10:47 am

I have found a problem with the code in that it will only print correctly when printing each invoice individually. If you try to print multiple invoices at one time from the Orders menu, all notes are printed on the last invoice in the list (since the invoices are printed in reverse for some reason, this means that the notes are all added to the first order in the series).

Also, as we have somehow ended up with a couple of orders coming through with a blank shipping method we found that trying to print these orders will create a Runtime error.
Rick Morris
Brewhaus (America) Inc.
Hot Sauce Depot

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

Re: Customer Comments

Post by mazhar » Thu Jan 01, 2009 11:13 am

I have found a problem with the code in that it will only print correctly when printing each invoice individually. If you try to print multiple invoices at one time from the Orders menu, all notes are printed on the last invoice in the list (since the invoices are printed in reverse for some reason, this means that the notes are all added to the first order in the series).
The problem is fixed. Here is the updated file.

Brewhaus
Vice Admiral (VADM)
Vice Admiral (VADM)
Posts: 878
Joined: Sat Jan 19, 2008 4:30 pm

Re: Customer Comments

Post by Brewhaus » Thu Jan 01, 2009 11:59 am

I have managed to add the payment method and billing phone number, but cannot get the Ship To phone number to pull. If I change BillToPhone to ShipToPhone we get a Runtime error. Can anyone help with this?

If anyone wants, once we get the shipping phone added we can post the file. It seems to have everything needed on the invoice now.
Rick Morris
Brewhaus (America) Inc.
Hot Sauce Depot

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

Re: Customer Comments

Post by mazhar » Thu Jan 01, 2009 12:32 pm

Locate the GetShipToAddress method and make it look like

Code: Select all

 protected string GetShipToAddress(object dataItem)
    {
        Order order = (Order)dataItem;
        List<string> addressList = new List<string>();
        foreach (OrderShipment shipment in order.Shipments)
        {
            string shipTo = shipment.FormatToAddress();
            string shipToPhone = string.Empty;
            if (!String.IsNullOrEmpty(shipment.ShipToPhone))
                shipTo += "<br />" + shipment.ShipToPhone;
            if (!addressList.Contains(shipTo)) addressList.Add(shipTo);
        }
        if (addressList.Count == 0) return "n/a";
        return string.Join("<hr />", addressList.ToArray());
    }
It will print the ShipToPhone information with the shipping address

User avatar
Tomgard
Lieutenant Commander (LCDR)
Lieutenant Commander (LCDR)
Posts: 108
Joined: Sun Jul 20, 2008 1:00 pm

Re: Customer Comments

Post by Tomgard » Sat Jan 03, 2009 2:34 pm

Jaz - you actually have been able to post coupons on the invoice? Does this include the emailed invoice/shipping notification?

Is it a graphical coupon or just text?

Brilliant Idea! Thanks
Bryan Bundgaard
AC7 User http://www.SchoolSupplyStore.com

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

Re: Customer Comments

Post by Jaz » Sat Jan 03, 2009 3:35 pm

The coupon used shows up on the printed invoice as text. I am assuming the emailed notifications are unchanged. I have not checked them. I guess that would be another project.
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
Tomgard
Lieutenant Commander (LCDR)
Lieutenant Commander (LCDR)
Posts: 108
Joined: Sun Jul 20, 2008 1:00 pm

Re: Customer Comments

Post by Tomgard » Sun Jan 04, 2009 11:03 am

Just an FYI - The code that Mazhar posted for Invoices.aspx contains a spelling error. Replace the text 'Shipping Medhods' with 'Methods'.

Thanks for the code!
Bryan Bundgaard
AC7 User http://www.SchoolSupplyStore.com

User avatar
Mizmo67
Commander (CMDR)
Commander (CMDR)
Posts: 155
Joined: Wed Mar 16, 2005 5:35 pm
Location: NJ
Contact:

Re: Customer Comments - Adding a little more detail

Post by Mizmo67 » Wed Jan 07, 2009 11:06 am

Hi all,

We like the feature of having the order notes print - we want to use it on our packing sheet.

I'd like to have the date/author also display.

Original order notes code:

Code: Select all

    <asp:GridView ID="OrderNotesRepeater" runat="server" ShowHeader="false"
                            AutoGenerateColumns="false" CellPadding=0 CellSpacing=0 GridLines="none"
                            Width="100%" CssClass="dataSheet">
                            <Columns>
							   <asp:TemplateField HeaderText="Notes">
                                    <ItemTemplate>
                                        <%#Eval("Comment") %>
                                    </ItemTemplate>
                                </asp:TemplateField>
                            </Columns>
                        </asp:GridView>
I modified the code after looking up the field names in the source code:

Code: Select all

 <asp:GridView ID="OrderNotesRepeater" runat="server" ShowHeader="false"
                            AutoGenerateColumns="false" CellPadding=0 CellSpacing=0 GridLines="none"
                            Width="100%" CssClass="dataSheet">
                            <Columns>
							<asp:TemplateField HeaderText="Notes">
                                    <ItemTemplate>
                                        <%#Eval("CreatedDate") %>
                                    </ItemTemplate>
                                </asp:TemplateField>
							<asp:TemplateField HeaderText="Notes">
                                    <ItemTemplate>
                                        <%#Eval("Author") %>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Notes">
                                    <ItemTemplate>
                                        <%#Eval("Comment") %>
                                    </ItemTemplate>
                                </asp:TemplateField>
                            </Columns>
                        </asp:GridView>
But I get an error message:
Server Error in '/' Application.
DataBinding: 'CommerceBuilder.Orders.OrderNote' does not contain a property with the name 'Author'.

Any thoughts as to why it can't pull the data?

Thanks! ~Mo
~Mo

Maureen Albertson
Scott's Bait & Tackle / Mystic Reel Parts LLC
Contact Me Via Store Website
Image
Ablecommerce Gold R11 Catalog LIVE

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

Re: Customer Comments

Post by mazhar » Wed Jan 07, 2009 11:31 am

There is no datamember name Author in the order note object. You can use the User information available with the order note. Here is the updated code

Code: Select all

<asp:GridView ID="OrderNotesRepeater" runat="server" ShowHeader="false"
                            AutoGenerateColumns="false" CellPadding=0 CellSpacing=0 GridLines="none"
                            Width="100%" CssClass="dataSheet" DataSource='<%# GetOrderNotes(Container.DataItem) %>'>
                            <Columns>
                            <asp:TemplateField HeaderText="Created Date">
                                    <ItemTemplate>
                                        <%#Eval("CreatedDate") %>
                                    </ItemTemplate>
                                </asp:TemplateField>
                            <asp:TemplateField HeaderText="First Name">
                                    <ItemTemplate>
                                        <%#Eval("User.PrimaryAddress.FirstName") %>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="Last Name">
                                    <ItemTemplate>
                                        <%#Eval("User.PrimaryAddress.LastName") %>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                <asp:TemplateField HeaderText="User Name">
                                    <ItemTemplate>
                                        <%#Eval("User.UserName") %>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                
                                <asp:TemplateField HeaderText="Notes">
                                    <ItemTemplate>
                                        <%#Eval("Comment") %>
                                    </ItemTemplate>
                                </asp:TemplateField>
                                
                            </Columns>
                        </asp:GridView>

User avatar
Mizmo67
Commander (CMDR)
Commander (CMDR)
Posts: 155
Joined: Wed Mar 16, 2005 5:35 pm
Location: NJ
Contact:

Re: Customer Comments

Post by Mizmo67 » Wed Jan 07, 2009 11:43 am

Thank you Mazhar!

Now I get a compilation error?

Compiler Error Message: CS0117: 'System.Web.UI.Control' does not contain a definition for 'DataItem'

Source Error:

Line 339: <tr>
Line 340: <td colspan="3" class="dataSheet"><h1>ORDER NOTES:</h1>
Line 341: <asp:GridView ID="OrderNotesRepeater" runat="server" ShowHeader="false"
Line 342: AutoGenerateColumns="false" CellPadding=0 CellSpacing=0 GridLines="none"
Line 343: Width="100%" CssClass="dataSheet" DataSource='<%# GetOrderNotes(Container.DataItem) %>'>


Source File: e:\hshome\scottsbt\ac7.scottsbt.com\Admin\Orders\Print\PullSheet.aspx Line: 341


Aaarrrgggh! This can get so frustrating :P
~Mo
~Mo

Maureen Albertson
Scott's Bait & Tackle / Mystic Reel Parts LLC
Contact Me Via Store Website
Image
Ablecommerce Gold R11 Catalog LIVE

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

Re: Customer Comments

Post by Jaz » Wed Jan 07, 2009 2:01 pm

I installed the changest to put the comments on the individual pages, but they are printing on the top of the following invoice, not on the invoice that the comment is part of.
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! --

Brewhaus
Vice Admiral (VADM)
Vice Admiral (VADM)
Posts: 878
Joined: Sat Jan 19, 2008 4:30 pm

Re: Customer Comments

Post by Brewhaus » Sat Jan 17, 2009 11:23 am

We just found that we are hitting the same issue. Everything else is working perfectly, and we have laid out the invoice to work perfectly for order completion, as well, by getting pertinent information listed together (shipping and payment information together, shipping telephone showing, etc.). I assume that the end of page simply needs to be adjusted- can anyone help with this?
Rick Morris
Brewhaus (America) Inc.
Hot Sauce Depot

User avatar
jmestep
AbleCommerce Angel
Posts: 8164
Joined: Sun Feb 29, 2004 8:04 pm
Location: Dayton, OH
Contact:

Re: Customer Comments

Post by jmestep » Sat Jan 17, 2009 1:18 pm

I haven't re-read this whole post, but in the original invoices.aspx, there is this code:
<table align="center" class="form<%# (Container.ItemIndex < (OrderCount - 1)) ? " breakAfter" : string.Empty %>" cellpadding="0" cellspacing="0" border="1">

I think that controls the break for orders, so I'm guessing anything added to the code would have to go within that table.
Judy Estep
Web Developer
jestep@web2market.com
http://www.web2market.com
708-653-3100 x209
New search report plugin for business intelligence:
http://www.web2market.com/Search-Report ... -P154.aspx

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

Re: Customer Comments

Post by mazhar » Mon Jan 19, 2009 11:01 am

Please check the following update and have a look at the screen shot.

Brewhaus
Vice Admiral (VADM)
Vice Admiral (VADM)
Posts: 878
Joined: Sat Jan 19, 2008 4:30 pm

Re: Customer Comments

Post by Brewhaus » Mon Jan 19, 2009 8:48 pm

The Shipping Methods would not display when using this file, but I found that by copying only the portion of the file after the 'Sold To' section and overwriting the same block in our current Invoices.aspx file, everything worked plus I was able to retain all of our invoice layout modifications.
Rick Morris
Brewhaus (America) Inc.
Hot Sauce Depot

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

Re: Customer Comments

Post by mazhar » Tue Jan 20, 2009 4:52 am

Brewhaus wrote:The Shipping Methods would not display when using this file, but I found that by copying only the portion of the file after the 'Sold To' section and overwriting the same block in our current Invoices.aspx file, everything worked plus I was able to retain all of our invoice layout modifications.
Thanks, I commented that code during customization and then forgot to revert those changes. I have updated the above attachment with fixed version of file.

Post Reply