Class UniqueProduct
- Namespace
- Dynamicweb.Ecommerce.Orders
- Assembly
- Dynamicweb.Ecommerce.dll
Class to represent an unique product of customer order collection
- Inheritance
-
Unique
Product
- Implements
- Inherited Members
Examples
using System;
using System.Collections.Generic;
using Dynamicweb.Ecommerce.Orders;
using Dynamicweb.Rendering;
namespace Dynamicweb.Ecommerce.Examples.Orders;
public static class CustomerOrdersProductsRendererSample
{
public static void RenderProductList(Template t, CustomerOrderCollection orders, int paragraphId)
{
ArgumentNullException.ThrowIfNull(t, nameof(t));
ArgumentNullException.ThrowIfNull(orders, nameof(orders));
ArgumentNullException.ThrowIfNull(paragraphId, nameof(paragraphId));
// Fill list with unique products
IEnumerable<UniqueProduct> uniqueProducts = orders.GetUniqueProducts;
string productsHtml = "";
foreach (UniqueProduct up in uniqueProducts)
{
productsHtml += "<option";
if (Context.Current?.Request["CCFilterProductID" + paragraphId] == up.ProductId)
productsHtml += " selected";
productsHtml += " value='" + up.ProductId + "'>" + up.ProductName + "</option>";
}
t.SetTag("CustomerOrderUniqueProducts", productsHtml);
}
}
Constructors
UniqueProduct(string, string)
Initializes a new instance of the Unique
Parameters
Fields
ProductId
Gets or sets the product ID.
Field Value
Examples
Look at example for UniqueProduct
class
ProductName
Gets or sets the product ID.
Field Value
Examples
Look at example for UniqueProduct
class
Methods
CompareTo(object)
Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.
Parameters
obj
objectAn object to compare with this instance.
Returns
- int
A 32-bit signed integer that indicates the relative order of the objects being compared. The return value has these meanings: Value Meaning Less than zero This instance is less than
obj
. Zero This instance is equal toobj
. Greater than zero This instance is greater thanobj
.
Exceptions
- Argument
Exception obj
is not the same type as this instance.