Page 1 of 1

Adding description text to confirmation and my account pages

Posted: Mon Dec 29, 2008 6:58 pm
by caveman
Does anyone know how to add the more "details text" to the order confirmation pages as well as the my account page?

Image

Image

Thanks.

Re: Adding description text to confirmation and my account pages

Posted: Tue Dec 30, 2008 5:28 am
by mazhar
Locate the following code in ConLib/MyAccountPage.ascx

Code: Select all

<asp:TemplateField>
                    <ItemStyle VerticalAlign="top" />
                    <ItemTemplate>
                        <asp:Label ID="ItemsCaption" runat="server" Text="Items" SkinID="FieldHeader"></asp:Label>
                        <asp:Repeater ID="ItemsRepeater" runat="server" DataSource='<%#GetProducts(Container.DataItem)%>'>
                            <HeaderTemplate><ul class="orderItemsList"></HeaderTemplate>
                            <ItemTemplate><li><%#Eval("Quantity")%> of: <%#GetOrderItemName(Container.DataItem)%></li></ItemTemplate>
                            <FooterTemplate></ul></FooterTemplate>
                        </asp:Repeater>
                    </ItemTemplate>
                </asp:TemplateField>
and make it look like

Code: Select all

<asp:TemplateField>
                    <ItemStyle VerticalAlign="top" />
                    <ItemTemplate>
                        <asp:Label ID="ItemsCaption" runat="server" Text="Items" SkinID="FieldHeader"></asp:Label>
                        <asp:Repeater ID="ItemsRepeater" runat="server" DataSource='<%#GetProducts(Container.DataItem)%>'>
                            <HeaderTemplate><ul class="orderItemsList"></HeaderTemplate>
                            <ItemTemplate><li><%#Eval("Quantity")%> of: <%#GetOrderItemName(Container.DataItem)%><br />More info text here</li></ItemTemplate>
                            <FooterTemplate></ul></FooterTemplate>
                        </asp:Repeater>
                    </ItemTemplate>
                </asp:TemplateField>

Re: Adding description text to confirmation and my account pages

Posted: Tue Dec 30, 2008 8:15 am
by caveman
Thanks Mazah, but that's not what I meant. I want to display the Products.ExtendedText field from the database which is the "More text" information for the product.

Re: Adding description text to confirmation and my account pages

Posted: Tue Dec 30, 2008 8:37 am
by mazhar
Use this code

Code: Select all

<ItemTemplate><li><%#Eval("Quantity")%> of: <%#GetOrderItemName(Container.DataItem)%><br /><%#Eval("Product.ExtendedDescription") %></li></ItemTemplate>

Re: Adding description text to confirmation and my account pages

Posted: Tue Dec 30, 2008 8:54 am
by caveman
Perfect! Thanks.

Re: Adding description text to confirmation and my account pages

Posted: Tue Dec 30, 2008 10:10 am
by caveman
Can anyone help me build a simple if statement to display on MyAccountPage.ascx?

if (Product.ExtendedDescription =! "Payment Authorized") {
#Eval("Product.ExtendedDescription") // write this from database
}
else
{
"This transaction failed";
}

Re: Adding description text to confirmation and my account pages

Posted: Tue Dec 30, 2008 10:19 am
by mazhar
If you want to put this logic in place of above code then first you can create a function as below in code file of control

Code: Select all

public string GetMessage(Object dataItem)
    {
        CommerceBuilder.Products.Product product = (CommerceBuilder.Products.Product)dataItem;
        if (product.ExtendedDescription != "Payment Authorized")
            return product.ExtendedDescription;
        return "This transaction failed";
    }
and then you can call this function from the ascx file for appropriate message as below

Code: Select all

<ItemTemplate><li><%#Eval("Quantity")%> of: <%#GetOrderItemName(Container.DataItem)%><br /><%# GetMessage(Eval("Product")) %></li></ItemTemplate>

Re: Adding description text to confirmation and my account pages

Posted: Tue Dec 30, 2008 11:07 am
by caveman
I'm an idiot... I meant the if statement to look at orders.Status field:

Code: Select all

public string GetMessage(Object dataItem)
    {
        CommerceBuilder.Products.Product product = (CommerceBuilder.Products.Product)dataItem;
        if (ORDERS.STATUS FIELD != "Payment Authorized")
            return product.ExtendedDescription;
        return "This transaction failed";
    }

Re: Adding description text to confirmation and my account pages

Posted: Thu Jan 01, 2009 7:51 am
by mazhar
Check the following function in code file

Code: Select all

 protected string GetOrderStatus(object dataItem)
    {
        Order order = (Order)dataItem;
        OrderStatus status = order.OrderStatus;
        if (status == null) return string.Empty;
        return StringHelper.SpaceName(status.DisplayName);
    }
and following statement in ascx file of MyAccountPage control

Code: Select all

<asp:Label ID="Status" runat="server" Text='<%#GetOrderStatus(Container.DataItem)%>'></asp:Label>