Using Product associations (or relations), there are a number of ways you can promote products:
- Up-selling: presents newer or better versions of the same product for the customer's consideration. For example, when displaying a television, display newer models in the same product line.
- Cross-selling: shows related products to the customer. For example, when displaying a shirt, cross selling can display other shirts by the same designer.
- Accessories: encourages the customer to add related or required accessories to their shopping cart when purchasing an item. Examples include spare batteries, memory cards, or cables for electronics.
- Warranties: allow dependent items such as product warranties to be sold with a product.
Merchandising items can be displayed on category, product, shopping cart, checkout, or receipt pages.
Implementation examples
In the following we will provide some examples of how to implement product associations.
Product recommendations
You can give site visitors product recommendations based on the purchasing history of other customers. Shoppers can also view items that other customers have bought in a personalized storefront. Recommendations are dynamically displayed based on defined business logic.
Example: utilizing an entry association to expose a predefined set of product recommendations for an entry
C#
private void SampleGetRecomendedEntries(Entry entry)
{
Association[] assocs = entry.Associations;
string key = "CrossSell";
bool matchFound = false;
if (assocs == null) return;
foreach (Association assoc in assocs)
{
if (assoc.EntryAssociations == null) continue;
if (assoc.Name == key && assoc.EntryAssociations.Association.Length > 0)
{
matchFound = true;
YourRepeaterControl.DataSource = assoc.EntryAssociations.Association;
YourRepeaterControl.DataBind();
break;
}
}
}
Recently viewed products
You can remind customers of recent products of interest by displaying a list of the last products viewed in the store. This is traditionally used in the shopping cart and product pages for easier navigation.
Example: binding a collection of recently viewed entry objects
C#
private void SampleGetRecentlyViewedEntryCollection()
{
NameValueCollection history = StoreHelper.GetBrowseHistory();
List<Entry> recentlyViewedEntries = new List<Entry>();
string[] keys = history.GetValues("Entries");
if (keys != null)
{
bool isFirst = true;
foreach (string key in keys)
{
if (isFirst)
{
isFirst = false;
continue;
}
if (!String.IsNullOrEmpty(key))
{
Entry entry = CatalogContext.Current.GetCatalogEntry(key);
if (entry != null)
recentlyViewedEntries.Add(entry);
}
}
}
if (recentlyViewedEntries.Count == 0)
{
return;
}
YourRepeaterControl.DataSource = recentlyViewedEntries.ToArray();
YourRepeaterControl.DataBind();
}