CyberStore Documentation
ShoppingCartDisplaySavedCartControl Class
Members  Example 


Dovetail.Ecommerce.Controls Namespace : ShoppingCartDisplaySavedCartControl Class
A Shopping Cart display saved Cart control.
Remarks

An example of the ShoppingCartDisplaySavedCartControl in use is below:

 

Property Usage

By changing the values of the control's properties in the SitePages.config file for your Site, you can enable or disable certain behaviors, set certain defaults, alter aspects of the display or otherwise cusomtize your site's implementaion of the control.

The following describes properties pertaining to key functional areas of the control that can be configured to suit your needs.

Headline Properties

The Headline property can be edited to display a specific control headline. Similarily the ListsHeadline property can be configured to set a specific lists headline.

Display properties

The ShowItemLists and the ShowSavedCarts properties can be edited to either display item lists or saved carts respectively.

Properties Inherited from the Base CyberStoreBaseControl

Properties specific to the CyberStoreBaseControl can be listed in the following categories:

Override Properties

When the IgnoreControl property is set to true, all processing of a control is skipped, and the control's Visible property is set to false ensuring that it is not rendered in the resulting CyberStore page.

Contextual Properties

Contextual properties define specific details about the current instance of the control based on context. Context can be set by any number of factors including the log in state of the Shopper, the Site being visited, or the properties that have been established for a control.

The AttributesBag property is used internal to control processing and is the collection of attributes, or properties, and their values based on how the control is configured. The attributes in this property are set by processing the SitePages.config file as well as any specific declared property values in any registered sub controls. It allows for the passing down of all properties to a control and any registered sub controls.

The ComConfigUserData and Site_ID properties are read-only values made available to all CyberStore controls to aid in processing and establishing context about the Site and Shopper.

Sub Controls

The table below lists and describes sub controls used by the default ShoppingCartDisplaySavedCartControl.

Sub Control Description
CatalogItemImageControl Displays the featured image and Item detail images that have a zoom feature.
CatalogContentDisplayControl Displays custom content on a page as an HTML snippet.
CatalogItemCreateListControl A catalog Item create list control.
Example
See an example of how to configure this control in SitePages.config.
<Control src="ShoppingCartDisplaySavedCartControl.ascx" />
Control Markup

The following is the markup for this control.

Developer's Note:

To create a custom version of the control, copy all of the code below into a file of the same name and place it into your Site's control folder (e.g., ../YourSiteFolder/Control). The CyberStore page engine will then override the default markup with your customized version.

 

<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="ShoppingCartDisplaySavedCartControl.ascx.cs" Inherits="Dovetail.Ecommerce.Controls.ShoppingCartDisplaySavedCartControl" %>

<!-- Referencing the release controls -->
<@ Register TagPrefix="uc1" TagName="CatalogItemImageControl" Src="~/Control/CatalogItemImageControl.ascx" >
<@ Register TagPrefix="uc1" TagName="CatalogContentDisplayControl" Src="~/Control/CatalogContentDisplayControl.ascx" >
<@ Register TagPrefix="uc1" TagName="CatalogItemListCreateListControl" Src="~/Control/CatalogItemListCreateListControl.ascx" >

<%@ Import Namespace="Dovetail.Ecommerce.Base.Module" %>

<script>
    var screenWidth = document.documentElement.clientWidth;
    var screenHeight = document.documentElement.clientHeight
    var listPopUpWidth = screenWidth * 0.5;
    var listPopUpHeight = screenHeight * 0.9;

    var scrollLeft = (window.pageXOffset !== undefined) ? window.pageXOffset : (document.documentElement || document.body.parentNode || document.body).scrollLeft;
    var scrollTop = (window.pageYOffset !== undefined) ? window.pageYOffset : (document.documentElement || document.body.parentNode || document.body).scrollTop;

    function VerifyRenameCart(DATA, id) {
        if (ValidAJAXResponse(DATA)) {
            var response = JSON.parse(DATA);
            var result = response.Result;
            ToastAlert(result.Message, result.Success, 5000);
            $('#txtCartName_' + id).css('display', 'none');
            $('#btnSaveName_' + id).css('display', 'none');
            $('#lblCartName_' + id).css('display', 'block');
            $('#btnEditCartName_' + id).css('display', 'block');
            grdSavedCarts.Refresh();
        }
    }

</script>
<style>
    td.dxgvCommandColumn.dxgv {
    text-align: left;
}
    .dxgvEditForm {
    background-color: transparent;
}
.savedCartEditLinks {
    float:right;
}
    span.savedCartEditLinks, span.savedCartName {
    display: flex;
    padding: 10px;
        font-weight: 500;
}
span.savedCartEditLinks a {
font-weight: 600;
    padding: 0 10px;
}
.dxeTextBoxSys {
    width: 405px;
    border-width: 0px 0px 1px 0px;
    border-radius: 0;
}
span.savedCartProduct {
    float: left;
    margin-right: 25px;
}
.dxgvDataRow td.dxgv {
    border-right: 0px Solid #CFCFCF;
}
.cartDetails td {
  /*  text-align: left;*/

}
.ShoppingCartSavedCartTable {
    width: 100 !important;
}
.ShoppingCartSavedCartTable td {
    text-align: left;
}

@media (max-width: 1199px) {
    .dxeTextBoxSys {
        width;
    }
}

@media (max-width: 916px) {

.dxgvDataRow td.dxgv {
    display: block;
    float: left;
    width: 100;
    text-align: left;
    padding-left: 15px;
}
td.dxgvCommandColumn.dxgv {
    width;
    padding-left: 10px;
}
span.savedCartEditLinks {
    width: 100;
    padding: 0 0 10px 0;
}
span.savedCartEditLinks a{

            padding-left: 0;
}
span.savedCartName {
    width;
    padding: 10px 0;
}
.dxeTextBoxSys {
    width: 315px;
}
/* cart detail table */
.cartDetails .dxgvDataRow td.dxgv {
    display: table-cell;
    float: none;
    width: auto;
    text-align: center;
    padding-left: 0;
}
span.savedCartProduct {
    float: none;
    margin-right: 0;
}
img.savedCartImage {
    margin: auto auto;
    display: block;
    float: none;
}
}
</style>
<div class="SavedCartWrapper">
    <h3 id="SavedCartHeadline" runat="server"><% = Headline %></h3>
    <dx:ASPxGridView ID="grdSavedCarts" runat="server" ClientInstanceName="grdSavedCarts" ClientIDMode="Static" KeyFieldName="SavedCart_ID" Width="100%"
         Styles-AlternatingRow-CssClass="HighlightTableRow" Border-BorderStyle="None"
         OnHtmlEditFormCreated="grdSavedCarts_HtmlEditFormCreated" OnRowDeleting="grdSavedCarts_RowDeleting" OnHtmlDataCellPrepared="grdSavedCarts_HtmlDataCellPrepared" >
        <Columns>
            <dx:GridViewCommandColumn ButtonType="Button" Caption=" " ShowEditButton="true" />
            <dx:GridViewDataColumn FieldName="SavedCart_ID" Visible="false" />
            <dx:GridViewDataColumn FieldName="Name" Caption="Cart Name" >
                <DataItemTemplate>
                    <span style="float:right">
                        <dx:ASPxButton ID="btnEditCartName" runat="server" AutoPostBack="false" RenderMode="Link" Text="Edit Name" Font-Size="Small" />
                        <dx:ASPxButton ID="btnSaveName" runat="server" AutoPostBack="false" RenderMode="Link" Text="Save" ClientVisible="false" Font-Size="Small" />
                        <dx:ASPxButton ID="btnCancelEdit" runat="server" AutoPostBack="false" RenderMode="Link" Text="Cancel" ClientVisible="false" Font-Size="Small" />
                    </span>

                    <dx:ASPxLabel ID="lblCartName" cssClass="savedCartName" runat="server" Text='<%# Container.Grid.GetRowValuesByKeyValue(Container.KeyValue,"Name") %>' />
                    <dx:ASPxTextBox ID="txtCartName" runat="server" Text='<%# Container.Grid.GetRowValuesByKeyValue(Container.KeyValue,"Name") %>' ClientVisible="false" MaxLength="50" Native="true" />
                </DataItemTemplate>
            </dx:GridViewDataColumn>
            <dx:GridViewDataColumn FieldName="CreateDate" />
            <dx:GridViewCommandColumn ButtonType="Button" Caption=" " ShowDeleteButton="true" />
        </Columns>
        <SettingsCommandButton EditButton-Text="View" DeleteButton-Text="Delete" />
        <SettingsEditing Mode="EditForm" />
        <Settings GridLines="None" ShowColumnHeaders="false" />
        <SettingsBehavior ConfirmDelete="true" />
        <SettingsText ConfirmDelete="Are you sure you want to permanently delete this saved cart?" />
        <Templates>
            <EditForm>
                <dx:ASPxGridView ID="grdCartDetails" cssClass="cartDetails" ClientIDMode="Static" runat="server" AutoGenerateColumns="false" Width="100%"
                    OnHtmlDataCellPrepared="grdCartDetails_HtmlDataCellPrepared" KeyFieldName="PrimaryKeyField">
                    <Columns>
                        <dx:GridViewDataColumn FieldName="PrimaryKeyField" Visible="false" />
                        <dx:GridViewDataColumn FieldName="ProductName" Settings-AllowSort="False" >
                            <DataItemTemplate>
                                <span style="float:left;margin-right:25px;">
                                    <img src="<%# Dovetail.Ecommerce.Process.Inventory.GetItemPhoto(Convert.ToString(Container.Grid.GetRowValuesByKeyValue(Container.KeyValue,"StockCode"))) %>" height="72" /> 
                                </span>
                                <%# Container.Grid.GetRowValuesByKeyValue(Container.KeyValue,"ProductName") %> <br />
                                <%# Container.Grid.GetRowValuesByKeyValue(Container.KeyValue,"StockCode") %> 
                            </DataItemTemplate>
                        </dx:GridViewDataColumn>
                        <dx:GridViewDataColumn FieldName="StockCode" Settings-AllowSort="False" Visible="false"/>
                        <dx:GridViewDataColumn FieldName="Quantity" Settings-AllowSort="False" />
                        <dx:GridViewDataColumn FieldName="UnitLabel" Settings-AllowSort="False" />
                    </Columns>
                </dx:ASPxGridView>
                <span style="float:right">
                    <dx:ASPxButton ID="btnCancel" runat="server"  Text="Cancel" AutoPostBack="false" CssClass="secondary-btn-theme"
                        ClientSideEvents-Click="function(s,e){grdSavedCarts.CancelEdit();}"/>
                </span>
                <dx:ASPxButton ID="btnRestoreCart" runat="server" OnClick="btnRestoreCart_Click" Text="Restore" CssClass="primary-btn-theme" />
                
            </EditForm>
        </Templates>
    </dx:ASPxGridView>

    <asp:DataGrid ID="CartItemsDataGrid" CssClass="ShoppingCartSavedCartTable" runat="server" Visible="false"
        GridLines="None" HeaderStyle-CssClass="ColumnLabel" AlternatingItemStyle-CssClass="HighlightTableRow"
        AutoGenerateColumns="false" OnSelectedIndexChanged="CartItemsDataGrid_SelectedIndexChanged" ShowHeader="false" CellPadding="4">
        <HeaderStyle Wrap="false" CssClass="ShoppingCartLabel"></HeaderStyle>
        <Columns>
            <asp:TemplateColumn HeaderText="Add To Cart" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="100px">
                <ItemTemplate>
                    <asp:Button CommandArgument='<%# DataBinder.Eval(Container, "DataItem.SavedCart_ID")%>'
                        CommandName="SavedCartID" Text="Restore" OnCommand="AddtoCart_Command" runat="server"
                        ID="AddtoCart" CssClass="primary-btn-theme" />
                </ItemTemplate>
            </asp:TemplateColumn>

            <asp:ButtonColumn HeaderText="Cart Name" DataTextField="Name" CommandName="Select"
                ItemStyle-CssClass="class"></asp:ButtonColumn>
            <asp:BoundColumn HeaderText="Date" DataField="CreateDate" DataFormatString="{0:d}" Visible="false"></asp:BoundColumn>
            <asp:TemplateColumn HeaderText="Delete" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="100px">
                <ItemTemplate>
                    <asp:Button CommandArgument='<%# DataBinder.Eval(Container, "DataItem.SavedCart_ID")%>'
                        CommandName="DeleteSavedCartID" Text="Delete" OnCommand="DeleteCart_Command"
                        runat="server" ID="Button1" CssClass="secondary-btn-theme" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="100px" />
                    <input type="hidden" runat="server" id="RowID" value='<%# DataBinder.Eval(Container, "DataItem.SavedCart_ID")%>'
                        name="RowID">
                </ItemTemplate>
            </asp:TemplateColumn>

        </Columns>
    </asp:DataGrid><br>
    <dx:ASPxGridView ID="CartDetailRpt" ClientIDMode="Static" runat="server" AutoGenerateColumns="false" Visible="false" Width="500">
        <Columns>
            <dx:GridViewDataColumn FieldName="ProductName" Settings-AllowSort="False" />
            <dx:GridViewDataColumn FieldName="StockCode" Settings-AllowSort="False" />
            <dx:GridViewDataColumn FieldName="Quantity" Settings-AllowSort="False" />
            <dx:GridViewDataColumn FieldName="UnitLabel" Settings-AllowSort="False" />
        </Columns>
    </dx:ASPxGridView>


    <h3 id="ItemListsHeadline" runat="server"><% = ListsHeadline %></h3>

    <asp:DataGrid ID="CustomerListsGrid" CssClass="ShoppingCartSavedCartTable" runat="server" 
        OnItemCreated="CustomerListsGrid_ItemCreated"
        GridLines="None" HeaderStyle-CssClass="ColumnLabel" AlternatingItemStyle-CssClass="HighlightTableRow"
        AutoGenerateColumns="false" OnSelectedIndexChanged="CartItemsDataGrid_SelectedIndexChanged" ShowHeader="false" CellPadding="4">
        <HeaderStyle Wrap="false" CssClass="ShoppingCartLabel"></HeaderStyle>
        <Columns>
            <asp:TemplateColumn HeaderText="Delete">
                <ItemTemplate>

                    <input type="hidden" runat="server" id="RowID" value='<%# DataBinder.Eval(Container, "DataItem.List_ID")%>'
                        name="RowID">
                </ItemTemplate>
            </asp:TemplateColumn>
            <asp:TemplateColumn HeaderText="Add To Cart" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="100px">
                <ItemTemplate>
                    <asp:Button CommandArgument='<%# DataBinder.Eval(Container, "DataItem.List_ID")%>'
                        CommandName="ListID" Text="Add" OnCommand="ListAddtoCart_Command" runat="server"
                        ID="AddtoCart" CssClass="AddSavedCartButton" Visible="false" />

                    <asp:Button CommandArgument='<%# DataBinder.Eval(Container, "DataItem.List_ID")%>'
                        CommandName="ListID" Text="Open" runat="server" CssClass="primary-btn-theme"
                        ID="btnCustomerListViewItems" OnClientClick='<# DataBinder.Eval(Container, "DataItem.List_ID","javascript>' />
                </ItemTemplate>
            </asp:TemplateColumn>
            <asp:TemplateColumn HeaderText="List Name">
                <ItemTemplate>
                    <%# DataBinder.Eval(Container, "DataItem.Name") %>
                </ItemTemplate>
            </asp:TemplateColumn>
            <asp:TemplateColumn HeaderText="Delete" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="100px">
                <ItemTemplate>
                    <asp:Button CommandArgument='<%# DataBinder.Eval(Container, "DataItem.List_ID")%>'
                        CommandName="ListID" Text="Delete" OnCommand="btnDeleteCustomerList_Command" runat="server"
                        ID="btnDeleteCustomerList" CssClass="secondary-btn-theme" OnClientClick="return confirm('Are you sure you want to delete this list');" />
                </ItemTemplate>
            </asp:TemplateColumn>
            <asp:BoundColumn HeaderText="Date" DataField="CreateDate" DataFormatString="{0:d}" Visible="false"></asp:BoundColumn>
        </Columns>
    </asp:DataGrid>
    <uc1:CatalogItemListCreateListControl ID="lnkCreateListCustomer" runat="server" CreateListLinkText="Create a new Company list" CreateListType="Customer" />

    <asp:DataGrid ID="AccountListsGrid" CssClass="ShoppingCartSavedCartTable" runat="server" Width="600"
        GridLines="None" HeaderStyle-CssClass="ColumnLabel" AlternatingItemStyle-CssClass="HighlightTableRow" CellPadding="4"
        AutoGenerateColumns="false" OnSelectedIndexChanged="CartItemsDataGrid_SelectedIndexChanged" ShowHeader="false">
        <HeaderStyle Wrap="false" CssClass="ShoppingCartLabel"></HeaderStyle>
        <Columns>
            <asp:TemplateColumn HeaderText="Delete">
                <ItemTemplate>

                    <input type="hidden" runat="server" id="RowID" value='<%# DataBinder.Eval(Container, "DataItem.List_ID")%>'
                        name="RowID">
                </ItemTemplate>
            </asp:TemplateColumn>
            <asp:TemplateColumn HeaderText="Add To Cart" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="100px">
                <ItemTemplate>
                    <asp:Button CommandArgument='<%# DataBinder.Eval(Container, "DataItem.List_ID")%>'
                        CommandName="ListID" Text="Add All Items" OnCommand="ListAddtoCart_Command" runat="server"
                        ID="AddtoCart" CssClass="AddSavedCartButton" Visible="false" />

                    <asp:Button CommandArgument='<%# DataBinder.Eval(Container, "DataItem.List_ID")%>'
                        CommandName="ListID" Text="Open" runat="server" CssClass="primary-btn-theme"
                        ID="btnUserListViewItems" OnClientClick='<# DataBinder.Eval(Container, "DataItem.List_ID","javascript>' />

                </ItemTemplate>
            </asp:TemplateColumn>
            <asp:TemplateColumn HeaderText="List Name">
                <ItemTemplate>
                    <%# DataBinder.Eval(Container, "DataItem.Name") %>
                </ItemTemplate>
            </asp:TemplateColumn>
            <asp:TemplateColumn HeaderText="Delete" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="100px">
                <ItemTemplate>
                    <asp:Button CommandArgument='<%# DataBinder.Eval(Container, "DataItem.List_ID")%>'
                        CommandName="ListID" Text="Delete" OnCommand="btnDeleteUserList_Command" runat="server"
                        ID="btnDeleteUserList" CssClass="secondary-btn-theme" OnClientClick="return confirm('Are you sure you want to delete this list');" />
                </ItemTemplate>
            </asp:TemplateColumn>

            <asp:BoundColumn HeaderText="Date" DataField="CreateDate" DataFormatString="{0:d}" Visible="false"></asp:BoundColumn>
        </Columns>
    </asp:DataGrid>


    <uc1:CatalogItemListCreateListControl ID="lnkCreateListAccount" runat="server" CreateListLinkText="Create a new Account list" CreateListType="Account" />
    <dx:ASPxCallbackPanel ID="clbkItemListDetails" runat="server" ClientIDMode="Static" ClientInstanceName="clbkItemListDetails"
        OnCallback="clbkItemListDetails_Callback" ClientSideEvents-EndCallback="function(s,e){popItemListDetails.Show();}">
        <PanelCollection>
            <dx:PanelContent>
                <dx:ASPxPopupControl ID="popItemListDetails" runat="server" ClientIDMode="Static" Modal="true" PopupHorizontalAlign="WindowCenter" Height="520" Width="750"
                    PopupVerticalAlign="WindowCenter" ScrollBars="None" ShowPageScrollbarWhenModal="true" AllowDragging="true" AllowResize="true" CloseAction="CloseButton" ShowSizeGrip="true"
                    ClientSideEvents-Shown="function(s,e){s.ShowAtPos((screenWidth - listPopUpWidth)/2, $(window).scrollTop() + (screenHeight - listPopUpHeight)/2);}" 
                    ClientSideEvents-Init="function(s,e){s.SetSize(listPopUpWidth, listPopUpHeight);grdItemListDetails.SetHeight(s.GetHeight() - 125)}">
                    <ContentCollection>
                        <dx:PopupControlContentControl>
                            <span style="float:right;">
<asp:Button ID="btnListItemsAddToCart" runat="server" OnClick="btnListItemsAddToCart_Click" CssClass="btn btn-primary" Text="Add Selected Items to Cart" />
</span>

                            <uc1:CatalogContentDisplayControl ID="popupContent" runat="server" FileLocation="HotListsPopupInstructions.htm" />

                            <dx:ASPxGridView ID="grdItemListDetails" ClientIDMode="Static" runat="server" AutoGenerateColumns="false" KeyFieldName="Item_ID" Width="720"
                                Settings-GridLines="None" OnDataBinding="grdItemListDetails_DataBinding" OnRowDeleting="grdItemListDetails_RowDeleting" Theme="MetropolisBlue" Styles-AlternatingRow-Enabled="True"
                                OnCommandButtonInitialize="grdItemListDetails_CommandButtonInitialize" SettingsBehavior-ConfirmDelete="true" SettingsText-ConfirmDelete="Are you sure you want to remove the item from the list?">
                                <Columns>
                                    <dx:GridViewCommandColumn ShowSelectCheckbox="true" Caption="Add" AllowDragDrop="False" SelectAllCheckboxMode="AllPages" Width="40" />
                                    <dx:GridViewDataColumn UnboundType="Object" FieldName="Photo" Settings-ShowInFilterControl="false" Width="70">
                                        <DataItemTemplate>
                                            <uc1:CatalogItemImageControl ID="ImageControl" PhotoCssClass="ShoppingCartProductImage" EnableZoom="false" PhotoWidth="60"
                                                PictureNotFoundCssClass="ShoppingCartProductPictureNotFound" Align="center" runat="server" StockCode='<%# Bind("StockCode") %>' />
                                        </DataItemTemplate>
                                    </dx:GridViewDataColumn>
                                    <dx:GridViewDataColumn  FieldName="StockCode" Settings-ShowInFilterControl="true" Caption="Search by Product Number" >
                                        <DataItemTemplate>
                                            <a href="<%# Dovetail.Ecommerce.BusinessLogic.Catalog.FriendlyUrl.ItemDetailPage((string)Eval("StockCode"),(string)Eval("Name")) %>"><%# Eval("Name") %></a><br />
                                            Product No: <%# Eval("StockCode") %>
                                        </DataItemTemplate>
                                    </dx:GridViewDataColumn>           
                                    <dx:GridViewDataHyperLinkColumn FieldName="Name" Settings-AllowSort="true" Visible="false">
                                    </dx:GridViewDataHyperLinkColumn>
                                    
                                    <dx:GridViewCommandColumn ButtonType="Button" Caption=" " ShowDeleteButton="true" Width="150" />
                                </Columns>
                                <SettingsPager /> 
                                <Settings VerticalScrollBarMode="Auto"  ShowFilterRow="true" ShowFilterRowMenu="true" />
                                <SettingsCommandButton >
                                    <DeleteButton text="Remove from List" Image-IconID="edit_delete_16x16" />
                                </SettingsCommandButton>
                            </dx:ASPxGridView>
                            <asp:HiddenField ID="hfList_ID" runat="server" />
                            <br />
                        </dx:PopupControlContentControl>
                    </ContentCollection>
                </dx:ASPxPopupControl>
            </dx:PanelContent>
        </PanelCollection>
    </dx:ASPxCallbackPanel>
</div>
Inheritance Hierarchy

System.Object
   System.Web.UI.Control
      System.Web.UI.TemplateControl
         System.Web.UI.UserControl
            Dovetail.Ecommerce.ControlBases.CyberStoreBaseControl
               Dovetail.Ecommerce.Controls.ShoppingCartDisplaySavedCartControl

See Also

Reference

ShoppingCartDisplaySavedCartControl Members
Dovetail.Ecommerce.Controls Namespace