CyberStore Documentation
ShoppingCartDisplayControl Class
Members  Example 


Dovetail.Ecommerce.Controls Namespace : ShoppingCartDisplayControl Class

A Shopping Cart display control.

Remarks

The ShoppingCartDisplayControl determines what a shopper sees inside of the Cart. It displays a list of Items in the Cart, which shoppers can adjust by removing Items or changing the quantities. If on hand quantity is exceeded, it prompts them to change the quantity to the appropriate number. If an Item costs zero dollars, it instructs them to remove the Item before proceeding. 

An example of the ShoppingCartDisplayControl 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.

The ShoppingCartDisplayControl allows you to customize the buttons and columns that the shopper sees in the Cart.

Buttons

Use these properties to designate the individual buttons you want to appear in the Cart:

Note:

The Checkout button and Punch Out button are enabled by your CyberStore configuration and do not have corresponding "show" properties.

Once you have chosen the buttons to appear, use these properties to modify the default text within the buttons:

Use the ShoppingCartDisplayControl to choose where the shopper is led when they click the Continue Shopping button. By default, the Site redirects them to the last known e-commerce page they visited. Otherwise, they are redirected to the Site's homepage. To override this setting and to designate a specific e-commerce page, set the value of the ContinueButtonUrl property to any valid CyberStore URL.

Columns

The Personalization column in the Cart only displays when the CyberStore Personalization Module has been licensed. If you desire to hide the column even after the module is licensed, set the ShowPersonalization property to "false."

Enable an Order Minimum

With the ShoppingCartDisplayControl, you can also enable the Order Minimum feature. This feature requires the total amount of all lines in the Shopping Cart to meet or exceed a specified value. Enable this using the MinimumOrderValue property. For information about customizing the Order Minimum feature through the Console, review the Site Manager topic. 

Customer Invoice Discounts

When a Customer is setup in SYSPRO with a Customer Invoice Discount, the prices displayed in the cart do not always represent the final amount that will appear on the order. This is because the discount is applied at the invoice level and so the order must be placed in order to know the full extent of the discount. However, when this is true, the CyberStore is able to identify that this is the case and the Shopping Cart is configured by default to display a message in the control advising the user of this situation.

 

The text of the message displayed can be modified with the DiscountMessageText property, and if it is desired to show no message at all, set the DiscountMessageVisible property to false.

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 ShoppingCartDisplayControl.

Sub Control Description
CatalogAccessorySelectionGrid Allows the shopper to modify an already accessorized Item in the Shopping Cart.
CatalogItemImageControl Displays the featured image and Item detail images that have a zoom feature.
PersonalizationControl A personalization control.
Example
See an example of how to configure this control in SitePages.config.
<Control src="shoppingcartDisplayControl.ascx" Name="ShoppingCart"
     ContinueButtonUrl="/ecommerce/category/performance-bicycles/"
 />
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="ShoppingCartDisplayControl.ascx.cs"
    Inherits="Dovetail.Ecommerce.Controls.ShoppingCartDisplayControl" %>
<@ Register TagPrefix="uc1" TagName="CatalogAccessorySelectionGrid" Src="~/Control/CatalogAccessorySelectionGrid.ascx" >
<@ Register TagPrefix="uc1" TagName="CatalogItemImageControl" Src="~/Control/CatalogItemImageControl.ascx" >
<@ Register TagPrefix="uc1" TagName="PersonalizationControl" Src="~/Control/PersonalizationControl.ascx" >
<%@ Import Namespace="Dovetail.Ecommerce.Base.Module" %>

<script>

    $(function () {
        $('#hfSavedCartName').val('something named here');
    });

</script>
<asp:ValidationSummary CssClass="ValidationMessage" ID="valSum" runat="server" HeaderText="The Following Errors have occurred"
    ShowSummary="false" ShowMessageBox="true" DisplayMode="BulletList" ValidationGroup="validationSummary">
</asp:ValidationSummary>
<dx:ASPxCallbackPanel ID="clbkShoppingCart" ClientIDMode="Static" ClientInstanceName="clbkShoppingCart" DefaultButton="Recalculatebtn"
    runat="server" OnCallback="CartItemsDataGrid_CustomCallback" SettingsLoadingPanel-Text="Recalculating">
    <PanelCollection>
        <dx:PanelContent>
            <asp:Label ID="ErrMsg" Visible="false" EnableViewState="true" CssClass="ValidationMessage" runat="server" />
            <dx:ASPxGridView ID="CartItemsDataGrid" CssClass="ShoppingCartTable" runat="server"
                KeyFieldName="ID" OnCustomColumnDisplayText="CartItemsDataGrid_OnCustomColumnDisplayText"
                OnHtmlDataCellPrepared="CartItemsDataGrid_OnHtmlDataCellPrepared" OnCustomErrorText="OnCustomErrorText"
                EnableRowsCache="false" OnHtmlRowPrepared="CartItemsDataGrid_OnHtmlRowPrepared" Styles-AlternatingRow-Enabled="True">
                <Columns>
                    <dx:GridViewCommandColumn ShowSelectCheckbox="true" Caption="Delete" AllowDragDrop="False" />
                    <dx:GridViewDataColumn UnboundType="Object" FieldName="Photo" Caption=" ">
                        <DataItemTemplate>
                            <uc1:CatalogItemImageControl ID="ImageControl" PhotoCssClass="ShoppingCartProductImage" EnableZoom="false"
                                PictureNotFoundCssClass="ShoppingCartProductPictureNotFound" Align="center" runat="server" />
                        </DataItemTemplate>
                    </dx:GridViewDataColumn>
                    <dx:GridViewDataColumn FieldName="ParentItem.Item_ID" Visible="false" />
                    <dx:GridViewDataHyperLinkColumn FieldName="ParentItem.Name" ReadOnly="true" Caption="Product Name">
                        <Settings AllowSort="False" AllowDragDrop="False" />
                        <DataItemTemplate>
                            <a href="<%# Dovetail.Ecommerce.BusinessLogic.Catalog.FriendlyUrl.ItemDetailPage((string)Container.Grid.GetRowValuesByKeyValue(Container.KeyValue,"StockCode"),(string)Container.Grid.GetRowValuesByKeyValue(Container.KeyValue, "ParentItem.Name")) %>"><%# Container.Grid.GetRowValuesByKeyValue(Container.KeyValue, "ParentItem.Name") %></a>
                        </DataItemTemplate>
                    </dx:GridViewDataHyperLinkColumn>
                    <dx:GridViewDataTextColumn FieldName="UnitType" Width="0px" Visible="false">
                        <Settings AllowSort="False" AllowDragDrop="False" />
                    </dx:GridViewDataTextColumn>
                    <dx:GridViewDataColumn UnboundType="Object" Caption="" Name="Personalization" FieldName="Personalization">
                        <DataItemTemplate>
                            <dx:ASPxButton ID="btnEditPersonalization" runat="server" AutoPostBack="false" />
                        </DataItemTemplate>    
                    </dx:GridViewDataColumn>
                    <dx:GridViewDataColumn FieldName="StockCode" Caption="Stock Code" CellStyle-CssClass="ShoppingCartItem"
                        ReadOnly="true">
                        <Settings AllowSort="False" AllowDragDrop="False" />
                    </dx:GridViewDataColumn>
                    <dx:GridViewDataColumn FieldName="DefaultPrice" Caption="Default Price"
                        CellStyle-CssClass="ShoppingCartUnitPrice">
                        <Settings AllowSort="False" AllowDragDrop="False" />
                    </dx:GridViewDataColumn>
                    <dx:GridViewDataColumn FieldName="CustomerPrice" Caption="Customer Price"
                        CellStyle-CssClass="ShoppingCartUnitPrice">
                        <Settings AllowSort="False" AllowDragDrop="False" />
                    </dx:GridViewDataColumn>
                    <dx:GridViewDataColumn FieldName="DiscountPrice" Caption="Discount Price"
                        CellStyle-CssClass="ShoppingCartUnitPrice">
                        <Settings AllowSort="False" AllowDragDrop="False" />
                    </dx:GridViewDataColumn>
                    <dx:GridViewDataTextColumn FieldName="UserQuantity" Caption="Quantity" ReadOnly="false"
                        Width="70">
                        <DataItemTemplate>
                            <dx:ASPxTextBox ID="QtyBox" runat="server" Width="45" MaxLength="6" Text='<%# Eval("Quantity") %>'
                                CssClass="qtyFormField" HeaderStyle-HorizontalAlign="Center" Native="true"  CaptionSettings-VerticalAlign="Bottom"/>
                        </DataItemTemplate>
                        <Settings AllowSort="False" AllowDragDrop="False" />
                    </dx:GridViewDataTextColumn>
                    <dx:GridViewDataColumn FieldName="UnitPrice" Caption="Unit Price"
                        CellStyle-CssClass="ShoppingCartUnitPrice">
                        <Settings AllowSort="False" AllowDragDrop="False" />
                    </dx:GridViewDataColumn>
                    <dx:GridViewDataTextColumn FieldName="UnitLabel" Caption="Unit">
                        <Settings AllowSort="False" AllowDragDrop="False" />
                    </dx:GridViewDataTextColumn>
                    <dx:GridViewDataColumn FieldName="Price" Caption="Item Total">
                        <Settings AllowSort="False" AllowDragDrop="False" />
                    </dx:GridViewDataColumn>
                    <dx:GridViewDataTextColumn FieldName="ShipDays" Caption="Ship Date" CellStyle-CssClass="ShoppingCartShipDate">
                        <Settings AllowSort="False" AllowDragDrop="False" />
                    </dx:GridViewDataTextColumn>
                    <dx:GridViewDataTextColumn FieldName="ItemType" Caption="Accessory Type" ReadOnly="false"
                        Width="40" Visible="false">
                        <Settings AllowSort="False" AllowDragDrop="False" />
                    </dx:GridViewDataTextColumn>
                </Columns>
                <Templates>
                    <DetailRow>
                        <uc1:CatalogAccessorySelectionGrid ID="detailgrid" runat="server" />
                    </DetailRow>
                </Templates>
                <SettingsText EmptyDataRow="The shopping cart is empty" />
                <SettingsPager Mode="ShowAllRecords" />
                <SettingsBehavior ColumnResizeMode="Disabled" />
                <SettingsDetail ShowDetailButtons="false" ShowDetailRow="true" />
            </dx:ASPxGridView>
            <div id="SubtotalDiv">
                <div id="SubtotalText">Subtotal:</div><dx:ASPxLabel ID="lblSubtotal" runat="server" ClientIDMode="Static" ClientInstanceName="lblSubtotal" />
            </div>
        </dx:PanelContent>
    </PanelCollection>
</dx:ASPxCallbackPanel>
<div class="shcDiscountMessaging">
    <dx:ASPxLabel ID="lblDiscountMessaging" runat="server" ClientIDMode="Static" ClientInstanceName="lblDiscountMessaging" />
</div>
<br />
<div id="ShoppingCartButtons" runat="server">
        <div>
            <dx:ASPxButton ID="SaveCartbtn" runat="server"
                CssClass="ShoppingCartSaveCartButton" Text="Save Cart" CausesValidation="true"
                AutoPostBack="false">
            </dx:ASPxButton>
        </div>
        <div>
            <dx:ASPxButton ID="Recalculatebtn" runat="server"
                CssClass="ShoppingCartRecalcButton" Text="Recalculate" CausesValidation="true"
                AutoPostBack="false">
            </dx:ASPxButton>
        </div>
        <div>
            <dx:ASPxButton ID="ClearCart" runat="server"
                CssClass="ShoppingCartEmptyCartButton" Text="Clear Cart" CausesValidation="true"
                AutoPostBack="false">
            </dx:ASPxButton>
        </div>
        <div>
            <dx:ASPxButton ID="ContinueShopping" runat="server" 
                CssClass="ShoppingCartShopMoreButton" Text="Continue Shopping" OnClick="ContinueShopping_Click"
                CausesValidation="true" />
        </div>
        <div>
            <dx:ASPxButton ID="PunchOut" runat="server" AutoPostBack="false" Visible="false"
                CssClass="ShoppingCartPunchoutButton" Text="Punch Out" CausesValidation="false">
            </dx:ASPxButton>
        </div>
        <div>
            <dx:ASPxButton ID="Checkout" runat="server"
                CssClass="ShoppingCartCheckoutButton" Text="Checkout" CausesValidation="true"
                AutoPostBack="false">
            </dx:ASPxButton>
        </div>
        <div>
            <dx:ASPxButton ID="CancelCheckout" runat="server" Text="Cancel In Progress Order" CssClass="secondary-btn-theme checkoutBtn"  Visible="false"
                AutoPostBack="false">
            </dx:ASPxButton>

        </div>
</div>

<uc1:PersonalizationControl ID="przPersonalization1" runat="server" />
Inheritance Hierarchy

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

See Also

Reference

ShoppingCartDisplayControl Members
Dovetail.Ecommerce.Controls Namespace