Table of Contents

Class ProductRelated

Namespace
Dynamicweb.Ecommerce.Products
Assembly
Dynamicweb.Ecommerce.dll

Represents information about related products.

[Serializable]
public class ProductRelated
Inheritance
ProductRelated
Inherited Members

Examples

using System;
using Dynamicweb.Ecommerce.Products;

namespace Dynamicweb.Ecommerce.Examples.Products;

/// <summary>
/// Provides functionality to save product group relations using a specified <see cref="GroupService"/> injected as dependency in the constructor.
/// </summary>
/// <example>
/// Add this component to the service collection in your IPipeline implementation:
/// <code>
/// services.AddTransient&lt;ProductGroupRelationSaveHandlerSample&gt;();
/// </code>
/// </example>
public class ProductGroupRelationSaveHandlerSample
{
    private readonly GroupService _groupService;

    /// <summary>
    /// Initializes a new instance of <see cref="ProductGroupRelationSaveHandlerSample"/> with the required dependencies.
    /// </summary>
    /// <param name="groupService">The group service used to save product group relations.</param>
    public ProductGroupRelationSaveHandlerSample(
        GroupService groupService)
    {
        ArgumentNullException.ThrowIfNull(groupService);

        _groupService = groupService;
    }

    /// <summary>
    /// Creates and saves a product group relation associating the specified product with the specified group.
    /// </summary>
    /// <param name="prodId">The product ID to associate with the group.</param>
    /// <param name="groupId">The group ID to associate with the product.</param>
    public void SaveProductGroupRelation(string prodId, string groupId)
    {
        var productGroupRelation = new ProductGroupRelation
        {
            ProductId = prodId,
            GroupId = groupId
        };

        _groupService.Save(productGroupRelation);
    }
}

Constructors

ProductRelated()

Initializes a new instance of the ProductRelated class.

public ProductRelated()

Properties

Countries

Gets or sets the countries collection.

public List<string> Countries { get; set; }

Property Value

List<string>

Languages

Gets or sets the languages collection.

public List<string> Languages { get; set; }

Property Value

List<string>

Product

Gets the related product.

public Product? Product { get; }

Property Value

Product

The product.

ProductId

Gets or sets the product ID.

public required string ProductId { get; set; }

Property Value

string

The product ID.

RelatedGroupId

Gets or sets the related group ID.

public required string RelatedGroupId { get; set; }

Property Value

string

The related group ID.

RelatedProductId

Gets or sets the related product ID.

public required string RelatedProductId { get; set; }

Property Value

string

The related product ID.

RelatedProductVariantId

Gets or sets the related product variant ID.

public string RelatedProductVariantId { get; set; }

Property Value

string

The related product variant ID.

Shops

Gets or sets the shops collection.

public List<string> Shops { get; set; }

Property Value

List<string>

SortOrder

Gets or sets the sort order.

public int SortOrder { get; set; }

Property Value

int

The sort order.

VariantOptions

Gets or sets the variant options collection.

public List<string> VariantOptions { get; set; }

Property Value

List<string>
To top