Style DiscountList

Posted by Community Admin on 04-Aug-2018 13:12

Style DiscountList

All Replies

Posted by Community Admin on 05-Aug-2013 00:00

Hallo all

We would like to  style the discountlistview that are included in the checkout template, but we are unable to find where that is stored?

 <orders:DiscountList runat="server" ID="discountRows"/>

Kind regards
Henrik Stensgaard

Posted by Community Admin on 05-Aug-2013 00:00

Hello Henrik,

 Thank you for using Sitefinity.

Here is the template for that control. You can find all the templates for controls (frontend or backend) including the non-standard ones in the toolbox in the SDK.

<%@ Control Language="C#" %>
<%@ Import Namespace="Telerik.Sitefinity.Ecommerce" %>
<%@ Import Namespace="Telerik.Sitefinity.Modules.Ecommerce" %>
<%@ Register TagPrefix="orders" Namespace="Telerik.Sitefinity.Modules.Ecommerce.Orders.Web.UI" Assembly="Telerik.Sitefinity.Ecommerce" %>
  
<asp:Repeater ID="discountsListView" runat="server">
    <ItemTemplate>
        <tr>
            <th>
                <div>
                    <%# HttpUtility.HtmlEncode(DataBinder.Eval(Container.DataItem, "Title")) %>:
                </div>
            </th>
            <td class="sfDiscount">
                <%# DataBinder.Eval(Container.DataItem, "SavingsAmountFormatted")%>
            </td>
        </tr>
        <orders:CouponCodeEntryListView visible="False" ID="changeCouponCodeEntryView" runat="server" IsChangeMode="True"/>
    </ItemTemplate>
</asp:Repeater>

You can add this to the control like so:

<orders:DiscountList runat="server" ID="discountRows" LayoutTemplatePath="~/YOURPATH/FileName.ascx"/>

Make sure you change the file path and name to reflect your own.

Regards,
Patrick Dunn
Telerik
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items

Posted by Community Admin on 06-Aug-2013 00:00

Hi Patrick
Many thanks for your reply. I think I get it, but I get the below error when i attach my own template. The template is the same as above also with the same names etc,, not changed yet?: 

NullReferenceException: Object reference not set to an instance of an object.] Telerik.Sitefinity.Modules.Ecommerce.Orders.Web.UI.DiscountList.DiscountRepeater_ItemDataBound(Object sender, RepeaterItemEventArgs e) +121 

How do I solve this with the ItemDatabound event?
Best regards
Henrik Stensgaard

Posted by Community Admin on 06-Aug-2013 00:00

Hallo again

Sorry I found the error. I had removed the CouponCodeEntryListView, that was causing the error.
Best regards
Henrik Stensgaard

This thread is closed