CyberStore Ecommerce 2023 Documentation
CatalogAccessorySelection Class
Members  Example 


Dovetail.Ecommerce.Controls Namespace : CatalogAccessorySelection Class

A catalog accessory selection control.

Remarks

The CatalogAccessorySelection control allows the shopper to select or unselect accessories for a base Item.

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

Accessory Selection Properties

In order to The AccessoryMode gets or sets the accessory mode. This was originally intended to allow the control to be in both the shopping cart and the AccessorySelection page. The AllowAccessoryQTYChange gets whether the user can change the quantity of accessorized items.

Photo Properties

Photo settings can be configured using several of the control's properties.

In order for photos to be displayed UsePhoto gets or sets which photo to display. By changing the value of the photoLocation you can change the photo location from the default value of see UsePhoto. The PhotoWidth property can be edited to set the width of a photo.

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 CatalogAccessorySelection control.

Sub Control Description
CatalogPricingControl Displays the pricing for an Item.
CatalogUnitPriceControl Formerly used to add unit pricing to an Add to Cart control.
CatalogItemImageControl Displays the featured image and Item detail images that have a zoom feature.
Example
See an example of how to configure this control in SitePages.config.
<Control src="CatalogAccessorySelection.ascx"
     TemplatePath=""
     AccessoryMode="standalone" />
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="CatalogAccessorySelection.ascx.cs"
    Inherits="Dovetail.Ecommerce.Controls.CatalogAccessorySelection" %>
<@ Register TagPrefix="uc1" TagName="CatalogPricingControl" Src="~/Control/CatalogPricingControl.ascx" >
<@ Register TagPrefix="uc1" TagName="CatalogUnitPriceControl" Src="~/Control/CatalogUnitPriceControl.ascx" >
<@ Register TagPrefix="uc1" TagName="CatalogItemImageControl" Src="~/Control/CatalogItemImageControl.ascx" >
<script type="text/javascript">
    function OnGetSelectedFieldValues(selectedValues) {
        if (selectedValues.length == 0) return;
        for (i = 0; i < selectedValues.length; i++) {
            s = "";
            for (j = 0; j < selectedValues[i].length; j++) {
                s = s + selectedValues[i][j] + "&nbsp;";
            }
        }
    }
</script>
<div id="catalog_accessory_container">
    <div id="catalog_accessory_header">
        <div id="catalog_accessory_header_image">
            <uc1:CatalogItemImageControl ID="ImageControl" PhotoCssClass="CatalogProductDetailPicture"
                PictureNotFoundCssClass="CatalogProductVerticalListPictureNotFound" PhotoAltText='<%# HeadLinestr%>'
                StockCode='<%# StockCodestr%>' PhotoLocation='<%# UsePhoto %>' PhotoWidth='<#PhotoWidth>'
                Align="right" runat="server" />
        </div>
        <div id="header_item_name">
            <span id="catalog_accessory_item_name">
                <%# HeadLinestr%></span><br /> 
            <span id="catalog_accessory_item_stock_code">Stock Code:
                <%# StockCodestr%></span>
        </div>
        <div id="divCatalogItemQuantiy" runat="server">
        QTY: <dx:ASPxTextBox ID="txtAccessoryQuantity" ClientInstanceName="txtAccessoryQuantity" Native="true"
                                CssClass="qtyFormField" runat="server" Width="45" MaxLength="6" ViewStateMode="Enabled" />
        </div>
        <div id="catalog_base_price">
            <h3>
                Base Price</h3>
            <h2>
                <uc1:CatalogUnitPriceControl ID="UnitPriceList" runat="server" Item_ID="<#Item_ID>"
                    ListPriceLabel="" YourPriceLabel="" PriceLabel="" />
            </h2>
        </div>
    </div>
    <table id="catalog_accessories_grid">
        <tr>
            <td>
                <h2>
                    Available Options & Accessories</h2>
            </td>
        </tr>
        <tr>
            <td>
                <dx:ASPxGridView ID="dxgrdAccessories" ClientIDMode="Static" ClientInstanceName="dxgrdAccessories"
                    runat="server" KeyFieldName="ID" OnCommandButtonInitialize="dxgridAccessories_OnCommandButtonInitialize"
                    OnHtmlDataCellPrepared="dxgrdAccessories_OnHtmlDataCellPrepared" OnSummaryDisplayText="dxgrdAccessories_SummaryDisplayText"
                    OnInit="dxgrdAccessories_OnInit" OnCustomSummaryCalculate="dxgrdAccessories_CustomSummaryCalculate"
                    OnSelectionChanged="dxgrdAccessories_SelectionChanged" OnDataBound="dxgrdAccessories_OnDataBound"
                    OnCustomUnboundColumnData="dxgridAccessories_CustomUnboundColumnData" SettingsText-EmptyDataRow="No Accessories for this Item are available">
                    <Columns>
                        <dx:GridViewCommandColumn CellStyle-CssClass="accessories_grid_checkbox" Name="SelectionColumn"
                            ShowSelectCheckbox="true" Caption=" ">
                        </dx:GridViewCommandColumn>
                        <dx:GridViewDataTextColumn CellStyle-CssClass="accessories_grid_option_name" FieldName="XPItem.Name"
                            Caption=" " ReadOnly="true">
                            <Settings AllowSort="False" AllowDragDrop="False" />
                        </dx:GridViewDataTextColumn>
                        <dx:GridViewDataTextColumn FieldName="XPItem.StockCode" Caption=" " ReadOnly="true"
                            Visible="true">
                            <Settings AllowSort="False" AllowDragDrop="False" />
                            <DataItemTemplate>
                                <dx:ASPxLabel runat="server" ID="StockCodeLabel" CssClass="accessories_grid_option_code"
                                    Visible="true" />
                                <dx:ASPxComboBox CssClass="option_stk" IncrementalFilteringMode="Contains" ID="ComboDescription" runat="server" Visible="false">
                                    <ClientSideEvents ButtonClick="function (s, e) { if (e.buttonIndex == 0) s.SetSelectedIndex(-1); }" />
                                </dx:ASPxComboBox>
                            </DataItemTemplate>
                        </dx:GridViewDataTextColumn>
                        <dx:GridViewDataTextColumn CellStyle-CssClass="accessories_grid_required" FieldName="RequiredColumn"
                            UnboundType="String">
                        </dx:GridViewDataTextColumn>
                        <dx:GridViewDataColumn Name="UnitPriceControl" FieldName="UnitPriceControl" UnboundType="Object"
                            Caption="UnitPriceControl1" ReadOnly="true" Width="100px">
                            <Settings AllowSort="False" AllowDragDrop="False" />
                            <DataItemTemplate>
                                <div class="accessories_grid_price_label">
                                    Price:
                                </div>
                                <div class="accessories_grid__price">
                                    <uc1:CatalogPricingControl runat="server" ID="AddtoCartControl2" HideQuantityInput="true"
                                        DisplayMode="multiaddaccessoryinput" Visible="true" Parent_ID="<%#Item_ID %>" />
                                </div>
                            </DataItemTemplate>
                        </dx:GridViewDataColumn>
                        <dx:GridViewDataColumn Name="Item_ID" FieldName="XPItem.Item_ID" Caption=" " ReadOnly="true"
                            Visible="false">
                            <Settings AllowSort="False" AllowDragDrop="False" />
                        </dx:GridViewDataColumn>
                        <dx:GridViewDataTextColumn FieldName="AccessoryType" Caption=" " ReadOnly="true"
                            Visible="false">
                            <Settings AllowSort="False" AllowDragDrop="False" />
                        </dx:GridViewDataTextColumn>
                    </Columns>
                    <TotalSummary>
                        <dx:ASPxSummaryItem FieldName="UnitPriceControl" SummaryType="Custom" Tag="CalculatingPrice" />
                    </TotalSummary>
                    <Templates>
                        <FooterRow>
                            <div id="accessories_footer">
                                <div id="catalog_accessories_total_label">
                                    Total Price with Selected Options & Accessories:</div>
                                <div id="catalog_accessories_total_price">
                                    <dx:ASPxLabel CssClass="catalog_accessories_total_price" name="AccessorizedTotal"
                                        ID="AccessorizedTotal" runat="server" OnLoad="AccessorizedTotal_Load" />
                                </div>
                            </div>
                        </FooterRow>
                    </Templates>
                    <Styles AlternatingRow-CssClass="catalog_accessories_grid_alt" Row-CssClass="catalog_accessories_grid"
                        Footer-CssClass="accessories_footer" />
                    <Settings ShowColumnHeaders="false" ShowFooter="true" />
                    <SettingsPager Mode="ShowAllRecords" />
                    <SettingsBehavior ProcessSelectionChangedOnServer="true" AllowFocusedRow="false" />
                </dx:ASPxGridView>
            </td>
        </tr>
    </table>
    <div style="float: right">
        <uc1:CatalogPricingControl runat="server" ID="AddtoCartControl1" Item_ID="<%#Item_ID %>"
            HideQuantityInput="true" DisplayMode="multiaddaccessorybutton" Visible="true" />
        <dx:ASPxButton ID="AccessoryCancelButton" runat="server" Visible="true" AutoPostBack="false"
            Text="Cancel" CssClass="CatalogAccessoryCancelButton" Native="true" ClientSideEvents-Click="function(s,e){history.go(-1);}" />
    </div>
</div>
Inheritance Hierarchy

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

See Also

Reference

CatalogAccessorySelection Members
Dovetail.Ecommerce.Controls Namespace