Webiant Logo Webiant Logo
  1. No results found.

    Try your search with a different keyword or use * as a wildcard.

NopDiscountDefaults.cs

using Nop.Core.Caching;
using Nop.Core.Domain.Discounts;

namespace Nop.Services.Discounts;

/// 
/// Represents default values related to discounts services
/// 
public static partial class NopDiscountDefaults
{
    /// 
    /// Gets the query parameter name to retrieve discount coupon code from URL
    /// 
    public static string DiscountCouponQueryParameter => "discountcoupon";

    #region Caching defaults

    /// 
    /// Key for discount requirement of a certain discount
    /// 
    /// 
    /// {0} : discount id
    /// 
    public static CacheKey DiscountRequirementsByDiscountCacheKey => new("Nop.discountrequirement.bydiscount.{0}");

    /// 
    /// Key for caching
    /// 
    /// 
    /// {0} : parent id
    /// 
    public static CacheKey DiscountRequirementsByParentCacheKey => new("Nop.discountrequirement.byparent.{0}");

    /// 
    /// Key for caching
    /// 
    /// 
    /// {0} : show hidden records?
    /// {1} : coupon code
    /// {2} : discount name
    /// {3} : is active
    /// 
    public static CacheKey DiscountAllCacheKey => new("Nop.discount.all.{0}-{1}-{2}-{3}", NopEntityCacheDefaults.AllPrefix);

    /// 
    /// Key for caching
    /// 
    /// 
    /// {0} - entity type
    /// {1} - entity id
    /// 
    public static CacheKey AppliedDiscountsCacheKey => new("Nop.discount.applied.{0}-{1}", AppliedDiscountsCachePrefix);

    /// 
    /// Gets a key pattern to clear cache
    /// 
    public static string AppliedDiscountsCachePrefix => "Nop.discount.applied.";

    /// 
    /// Key for category IDs of a discount
    /// 
    /// 
    /// {0} : discount id
    /// {1} : roles of the current user
    /// {2} : current store ID
    /// 
    public static CacheKey CategoryIdsByDiscountCacheKey => new("Nop.discount.categoryids.bydiscount.{0}-{1}-{2}", CategoryIdsByDiscountPrefix, CategoryIdsPrefix);

    /// 
    /// Gets a key pattern to clear cache
    /// 
    /// 
    /// {0} : discount id
    /// 
    public static string CategoryIdsByDiscountPrefix => "Nop.discount.categoryids.bydiscount.{0}";

    /// 
    /// Gets a key pattern to clear cache
    /// 
    public static string CategoryIdsPrefix => "Nop.discount.categoryids.bydiscount.";

    /// 
    /// Key for manufacturer IDs of a discount
    /// 
    /// 
    /// {0} : discount id
    /// {1} : roles of the current user
    /// {2} : current store ID
    /// 
    public static CacheKey ManufacturerIdsByDiscountCacheKey => new("Nop.discount.manufacturerids.bydiscount.{0}-{1}-{2}", ManufacturerIdsByDiscountPrefix, ManufacturerIdsPrefix);

    /// 
    /// Gets a key pattern to clear cache
    /// 
    /// 
    /// {0} : discount id
    /// 
    public static string ManufacturerIdsByDiscountPrefix => "Nop.discount.manufacturerids.bydiscount.{0}";

    /// 
    /// Gets a key pattern to clear cache
    /// 
    public static string ManufacturerIdsPrefix => "Nop.discount.manufacturerids.bydiscount.";

    #endregion
}