CyberStore Ecommerce 2023 Documentation
CatalogRelatedItemsControl Class
Members  Example 


Dovetail.Ecommerce.Controls Namespace : CatalogRelatedItemsControl Class
A catalog Related Items control.
Remarks

The CatalogRelatedItemsControl displays another Item that may be related to the current Item being viewed.

An example of the CatalogRelatedItemsControl 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 UsePhoto property indicates which photo to display. Supported values: Photo1 or Photo2. In terms of the photo location the photoLocation property can be edited to change the location of the photo. Similarily, the PhotoWidth sets the width of the images displayed with each item. The RelatedItemLabel gets the related item label. In order to set the column repeat count you can edit the RepeatColumn property.

Properties Inherited from the Base ListingControl

The properties contained in the ListingControl base class are available to either include or exclude certain data from the scope of Items being listed in the control.

To expand the scope of Items to be inclusive of all Items in the current Category and all of its child hierarchy, set the IncludeItemsFromAllChildCategories property to true, or conversely to limit scope just to the current Category, set its value to false.

Scope can also be limited, or expanded, based on the type of Item in the listing. Use the IncludeModelsIncludeSKUs, and IncludeStockCodes properties to do this. Set them to true to include, and false to exclude.

The ShowOnStockCodeDetailPageShowOnModelDetailPage and ShowonSKUDetailPage properties can each be used to selectively hide or show the control when on it is found on an item page based on the type of item.

The OverrideCategoryList property allows for the ListingControl to ignore the current Category in context and use a specified list of Categories as specified by a comma-separated list of Category_ID values. For example "1,5,7,124,678".

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

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="CatalogRelatedItemsControl.ascx"
UsePhoto="Photo2"
PhotoWidth="100"
RepeatColumn="3"
RelatedItemLabel="Related Items"
ShowCategoryResults="true"
HideQuantityInput="NO_VALUE_SPECIFIED"
AddtoCartText="Add to Cart"
ListPriceLabel="List Price:"
YourPriceLabel="Your Price:"
PriceLabel="Price Label:" />
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 AutoEventWireup="true" CodeBehind="CatalogRelatedItemsControl.ascx.cs"
    Inherits="Dovetail.Ecommerce.Controls.CatalogRelatedItemsControl" Language="C#" %>
<@ Register TagPrefix="uc1" TagName="CatalogSimplePricingControl" Src="~/control/CatalogSimplePricingControl.ascx" >
<@ Register TagPrefix="uc1" TagName="CatalogUnitPriceControl" Src="~/Control/CatalogUnitPriceControl.ascx" >
<@ Register TagPrefix="uc1" TagName="CatalogItemImageControl" Src="~/Control/CatalogItemImageControl.ascx" >
<%@ Import Namespace="Dovetail.Ecommerce.Base.Module" %>

<span id="relatedItemHeadlineHighlight">
    <asp:Label runat="server" ID="relatedLabel" CssClass="relatedItemHeadline"></asp:Label>
</span>
<asp:DataList ID="relatedItemsList" EnableViewState="false" runat="server">
    <ItemTemplate>
        <table border="0" id="relatedItemTable">
            <tr>
                <td>
                    <uc1:CatalogItemImageControl ID="RelatedItemsImage" runat="server" PhotoWidth='<%# PhotoWidth %>'
                        PhotoLocation='<%# UsePhoto %>' StockCode='<%# DataBinder.Eval(Container.DataItem, "StockCode")%>'
                        Item_ID='<%# DataBinder.Eval(Container.DataItem, "Item_ID")%>' PhotoAltText='<%# DataBinder.Eval(Container.DataItem, "StockCode")%>'
                        PhotoCssClass="CatalogProductVerticalListPicture" PictureNotFoundCssClass="CatalogProductVerticalListPictureNotFound" />
                </td>
            </tr>
            <tr>
                <td class="ListCategoryName">
                    <%# String.Format("<a class=\"CatalogListNavTrail\" href=\"{0}\">{1}</a>", Dovetail.Ecommerce.BusinessLogic.Catalog.FriendlyUrl.ItemDetailPage(DataBinder.Eval(Container.DataItem, "StockCode").ToString(),DataBinder.Eval(Container.DataItem, "Name").ToString()), DataBinder.Eval(Container.DataItem, "Headline")) %>
                </td>
            </tr>
            <tr>
                <td>
                    <uc1:CatalogSimplePricingControl ID="addToCartBtn" runat="server" Item_ID='<%# DataBinder.Eval(Container.DataItem, "Item_ID")%>' />
                </td>
            </tr>
        </table>
    </ItemTemplate>
</asp:DataList>
<br>
<br>
Inheritance Hierarchy

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

See Also

Reference

CatalogRelatedItemsControl Members
Dovetail.Ecommerce.Controls Namespace