Trouble with Packing Slip Mod

For general questions and discussions specific to the AbleCommerce 7.0 Asp.Net product.
Post Reply
krittleb
Commander (CMDR)
Commander (CMDR)
Posts: 111
Joined: Tue Jan 06, 2009 11:27 pm

Trouble with Packing Slip Mod

Post by krittleb » Mon Jul 13, 2009 10:40 pm

I am going out on a limb and venturing into the world of code.

Bad start as this venture has totally not worked out.

I am trying to do what seems to be a really simple task: add the "payment method" under the "shipment method" on the packing slip.

So, I found the display I wanted on the order "payments" page, went to orders/payments/default.aspx and copied the code for the payment method display. I then pasted it accordingly into the orders/print/packingslip.aspx and ended up with a big old error message that states:

DataBinding: 'CommerceBuilder.Orders.OrderShipment' does not contain a property with the name 'PaymentMethodName'.

You can view my packing slip code below. Any ideas or suggestions would be appreciated!

Code: Select all

 <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="ShipmentRepeater" runat="server" OnItemDataBound="ShipmentRepeater_ItemDataBound">
        <ItemTemplate>
            <table align="center" class="form<%# (Container.ItemIndex < (ShipmentCount - 1)) ? " breakAfter" : string.Empty %>" cellpadding="0" cellspacing="0" border="1">
                <tr>
                    <th colspan="3" class="header">
                        <asp:Label ID="ShipmentLabel" runat="server" Text="Packing List: Order #{0}" CssClass="caption"></asp:Label>
                        <asp:Label ID="ShipmentCountLabel" runat="server" Text=" (Shipment {0} of {1})" CssClass="caption"></asp:Label>
                    </th>
                </tr>
                <tr>
                    <td valign="top">
                        <asp:Label ID="OrderDateLabel" runat="server" Text="Order Date:" SkinID="fieldheader"></asp:Label>
                        <asp:Label ID="OrderDate" runat="server" Text='<%#Eval("Order.OrderDate", "{0:g}") %>'></asp:Label><br />
                        <asp:Label ID="ShippingMethodLabel" runat="server" Text="Shipping Method:" SkinID="fieldheader"></asp:Label>
                        <asp:Label ID="ShippingMethod" runat="server" Text='<%#Eval("ShipMethodName") %>'></asp:Label><br />
                        <asp:Label ID="PaymentMethodLabel" runat="server" Text="Method: " SkinID="FieldHeader"></asp:Label>
                            <asp:Label ID="PaymentMethod" runat="server" Text='<%#Eval("PaymentMethodName") %>'></asp:Label>


                        </td>
                    <td valign="top">
                        <asp:Label ID="ShipFromCaption" runat="server" Text="Ship From:" SkinID="FieldHeader"></asp:Label><br />
                        <asp:Label ID="ShipFrom" runat="server" Text='<%#((OrderShipment)Container.DataItem).FormatFromAddress()%>'></asp:Label>

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

Re: Trouble with Packing Slip Mod

Post by mazhar » Tue Jul 14, 2009 4:49 am

Edit Admin/Orders/Print/PackSlips.aspx.cs and add following method to it

Code: Select all

protected string GetPaymentMethods(Object dataItem) 
    {
        string paymentMethods = string.Empty;
        Order order = (Order)dataItem;
        foreach (Payment payment in order.Payments)
            paymentMethods += payment.PaymentMethodName+",";
        if (paymentMethods.Length > 0)
            paymentMethods = paymentMethods.Remove(paymentMethods.Length - 1, 1);
        return paymentMethods;
    }
then edit Admin/Orders/Print/PackSlips.aspx and locate following code

Code: Select all

<asp:Label ID="ShippingMethod" runat="server" Text='<%#Eval("ShipMethodName") %>'></asp:Label>
and make it look like

Code: Select all

<asp:Label ID="ShippingMethod" runat="server" Text='<%#Eval("ShipMethodName") %>'></asp:Label>
                        <br />
                        <asp:Label ID="Label2" runat="server" Text="Payment Method:" SkinID="fieldheader"></asp:Label>
                        <asp:Label ID="Label1" runat="server" Text='<%# GetPaymentMethods(Eval("Order")) %>'></asp:Label>

User avatar
sciencesight
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 33
Joined: Sat Aug 28, 2004 1:42 pm
Location: Denver, CO
Contact:

Re: Trouble with Packing Slip Mod

Post by sciencesight » Wed Aug 26, 2009 2:09 pm

Edit Admin/Orders/Print/PackSlips.aspx.cs and add following method to it
In following this instruction, this file does not exist for me.


PLATFORM: ASP.NET
VERSION: 7.0.2
BUILD: 11659

Dave

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

Re: Trouble with Packing Slip Mod

Post by mazhar » Wed Aug 26, 2009 7:07 pm

In 7.0.2 there is no code behind so you will find required info in PackSlips.aspx it self.

Post Reply