Webiant Logo Webiant Logo
  1. No results found.

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

NopCatalogDefaults.cs

using Nop.Core.Caching;
using Nop.Core.Domain.Catalog;

namespace Nop.Services.Catalog;

/// 
/// Represents default values related to catalog services
/// 
public static partial class NopCatalogDefaults
{
    #region Common

    /// 
    /// Gets a default price range 'from'
    /// 
    public static decimal DefaultPriceRangeFrom => 0;

    /// 
    /// Gets a default price range 'to'
    /// 
    public static decimal DefaultPriceRangeTo => 10000;

    #endregion

    #region Products

    /// 
    /// Gets a template of product name on copying
    /// 
    /// 
    /// {0} : product name
    /// 
    public static string ProductCopyNameTemplate => "Copy of {0}";

    /// 
    /// Gets default prefix for product
    /// 
    public static string ProductAttributePrefix => "product_attribute_";

    #endregion

    #region Caching defaults

    #region Categories

    /// 
    /// Gets a key for caching
    /// 
    /// 
    /// {0} : parent category ID
    /// {1} : show hidden records?
    /// {2} : roles of the current user
    /// {3} : store ID
    /// 
    public static CacheKey CategoriesByParentCategoryCacheKey => new("Nop.category.byparent.{0}-{1}-{2}-{3}", CategoriesByParentCategoryPrefix);

    /// 
    /// Gets a key pattern to clear cache
    /// 
    /// 
    /// {0} : parent category ID
    /// 
    public static string CategoriesByParentCategoryPrefix => "Nop.category.byparent.{0}";

    /// 
    /// Gets a key for caching
    /// 
    /// 
    /// {0} : parent category id
    /// {1} : roles of the current user
    /// {2} : current store ID
    /// {3} : show hidden records?
    /// 
    public static CacheKey CategoriesChildIdsCacheKey => new("Nop.category.childids.{0}-{1}-{2}-{3}", CategoriesChildIdsPrefix);

    /// 
    /// Gets a key pattern to clear cache
    /// 
    /// 
    /// {0} : parent category ID
    /// 
    public static string CategoriesChildIdsPrefix => "Nop.category.childids.{0}";

    /// 
    /// Gets a key for caching
    /// 
    /// 
    /// {0} : current store ID
    /// {1} : show hidden records?
    /// 
    public static CacheKey ChildCategoryIdLookupCacheKey => new("Nop.childcategoryidlookup.bystore.{0}-{1}", ChildCategoryIdLookupPrefix, ChildCategoryIdLookupByStorePrefix);

    /// 
    /// Gets a key pattern to clear cache
    /// 
    public static string ChildCategoryIdLookupPrefix => "Nop.childcategoryidlookup.";

    /// 
    /// Gets a key pattern to clear cache
    /// 
    public static string ChildCategoryIdLookupByStorePrefix => "Nop.childcategoryidlookup.bystore.{0}";

    /// 
    /// Gets a key for caching
    /// 
    public static CacheKey CategoriesHomepageCacheKey => new("Nop.category.homepage.", CategoriesHomepagePrefix);

    /// 
    /// Gets a key for caching
    /// 
    /// 
    /// {0} : current store ID
    /// {1} : roles of the current user
    /// 
    public static CacheKey CategoriesHomepageWithoutHiddenCacheKey => new("Nop.category.homepage.withouthidden-{0}-{1}", CategoriesHomepagePrefix);

    /// 
    /// Gets a key pattern to clear cache
    /// 
    public static string CategoriesHomepagePrefix => "Nop.category.homepage.";

    /// 
    /// Key for caching of category breadcrumb
    /// 
    /// 
    /// {0} : category id
    /// {1} : roles of the current user
    /// {2} : current store ID
    /// {3} : language ID
    /// {4} : show hidden records?
    /// 
    public static CacheKey CategoryBreadcrumbCacheKey => new("Nop.category.breadcrumb.{0}-{1}-{2}-{3}-{4}", CategoryBreadcrumbPrefix);

    /// 
    /// Gets a key pattern to clear cache
    /// 
    public static string CategoryBreadcrumbPrefix => "Nop.category.breadcrumb.";

    /// 
    /// Gets a key for caching
    /// 
    /// 
    /// {0} : current store ID
    /// {1} : roles of the current user
    /// {2} : show hidden records?
    /// 
    public static CacheKey CategoriesAllCacheKey => new("Nop.category.all.{0}-{1}-{2}", NopEntityCacheDefaults.AllPrefix);

    /// 
    /// Gets a key for caching
    /// 
    /// 
    /// {0} : product ID
    /// {1} : show hidden records?
    /// {2} : roles of the current user
    /// {3} : store ID
    /// 
    public static CacheKey ProductCategoriesByProductCacheKey => new("Nop.productcategory.byproduct.{0}-{1}-{2}-{3}", ProductCategoriesByProductPrefix, ProductCategoriesByProductWithoutIdPrefix);

    /// 
    /// Gets a key pattern to clear cache
    /// 
    public static string ProductCategoriesByProductPrefix => "Nop.productcategory.byproduct.{0}";

    /// 
    /// Gets a key pattern to clear cache
    /// 
    public static string ProductCategoriesByProductWithoutIdPrefix => "Nop.productcategory.byproduct.";
    
    /// 
    /// Key for caching
    /// 
    /// 
    /// {0} : customer roles ID hash
    /// {1} : current store ID
    /// {2} : categories ID hash
    /// 
    public static CacheKey CategoryProductsNumberCacheKey => new("Nop.productcategory.products.number.{0}-{1}-{2}", CategoryProductsNumberPrefix);

    /// 
    /// Gets a key pattern to clear cache
    /// 
    public static string CategoryProductsNumberPrefix => "Nop.productcategory.products.number.";

    #endregion

    #region Manufacturers

    /// 
    /// Gets a key for caching
    /// 
    /// 
    /// {0} : product ID
    /// {1} : show hidden records?
    /// {2} : roles of the current user
    /// {3} : store ID
    /// 
    public static CacheKey ProductManufacturersByProductCacheKey => new("Nop.productmanufacturer.byproduct.{0}-{1}-{2}-{3}", ProductManufacturersPrefix, ProductManufacturersByProductPrefix);

    /// 
    /// Gets a key pattern to clear cache
    /// 
    public static string ProductManufacturersPrefix => "Nop.productmanufacturer.";

    /// 
    /// Gets a key pattern to clear cache
    /// 
    /// 
    /// {0} : product ID
    /// 
    public static string ProductManufacturersByProductPrefix => "Nop.productmanufacturer.byproduct.{0}";

    /// 
    /// Gets a key for caching
    /// 
    /// 
    /// {0} : category ID
    /// {1} : store ID
    /// {2} : customer role Ids
    /// 
    public static CacheKey ManufacturersByCategoryCacheKey => new("Nop.manufacturer.bycategory.{0}.{1}.{2}", ManufacturersByCategoryWithIdPrefix, ManufacturersByCategoryPrefix);

    /// 
    /// Gets a key pattern to clear cache
    /// 
    public static string ManufacturersByCategoryPrefix => "Nop.manufacturer.bycategory.";

    /// 
    /// Gets a key pattern to clear cache
    /// 
    public static string ManufacturersByCategoryWithIdPrefix => "Nop.manufacturer.bycategory.{0}.";

    #endregion

    #region Products

    /// 
    /// Key for "related" product displayed on the product details page
    /// 
    /// 
    /// {0} : current product id
    /// {1} : show hidden records?
    /// 
    public static CacheKey RelatedProductsCacheKey => new("Nop.relatedproduct.byproduct.{0}-{1}", RelatedProductsPrefix);

    /// 
    /// Gets a key pattern to clear cache
    /// 
    /// 
    /// {0} : product ID
    /// 
    public static string RelatedProductsPrefix => "Nop.relatedproduct.byproduct.{0}";

    /// 
    /// Key for "related" product identifiers displayed on the product details page
    /// 
    /// 
    /// {0} : current product id
    /// 
    public static CacheKey TierPricesByProductCacheKey => new("Nop.tierprice.byproduct.{0}");

    /// 
    /// Gets a key for caching
    /// 
    public static CacheKey ProductsHomepageCacheKey => new("Nop.product.homepage.");

    /// 
    /// Key for caching identifiers of category featured products
    /// 
    /// 
    /// {0} : category id
    /// {1} : customer role Ids
    /// {2} : current store ID
    /// 
    public static CacheKey CategoryFeaturedProductsIdsKey => new("Nop.product.featured.bycategory.{0}-{1}-{2}", CategoryFeaturedProductsIdsPrefix, FeaturedProductIdsPrefix);
    public static string CategoryFeaturedProductsIdsPrefix => "Nop.product.featured.bycategory.{0}";

    /// 
    /// Key for caching of a value indicating whether a manufacturer has featured products
    /// 
    /// 
    /// {0} : manufacturer id
    /// {1} : customer role Ids
    /// {2} : current store ID
    /// 
    public static CacheKey ManufacturerFeaturedProductIdsKey => new("Nop.product.featured.bymanufacturer.{0}-{1}-{2}", ManufacturerFeaturedProductIdsPrefix, FeaturedProductIdsPrefix);
    public static string ManufacturerFeaturedProductIdsPrefix => "Nop.product.featured.bymanufacturer.{0}";

    public static string FeaturedProductIdsPrefix => "Nop.product.featured.";

    /// 
    /// Gets a key for product prices
    /// 
    /// 
    /// {0} : product id
    /// {1} : overridden product price
    /// {2} : additional charge
    /// {3} : include discounts (true, false)
    /// {4} : quantity
    /// {5} : roles of the current user
    /// {6} : current store ID
    /// 
    public static CacheKey ProductPriceCacheKey => new("Nop.totals.productprice.{0}-{1}-{2}-{3}-{4}-{5}-{6}", ProductPricePrefix);

    /// 
    /// Gets a key pattern to clear cache
    /// 
    /// 
    /// {0} : product id
    /// 
    public static string ProductPricePrefix => "Nop.totals.productprice.{0}";

    /// 
    /// Gets a key for product multiple prices
    /// 
    /// 
    /// {0} : product id
    /// {1} : customer role ids
    /// {2} : store id
    /// 
    public static CacheKey ProductMultiplePriceCacheKey => new("Nop.totals.productprice.multiple.{0}-{1}-{2}", ProductMultiplePricePrefix);

    /// 
    /// Gets a key pattern to clear cache
    /// 
    /// 
    /// {0} : product id
    /// 
    public static string ProductMultiplePricePrefix => "Nop.totals.productprice.multiple.{0}";

    #endregion

    #region Product attributes

    /// 
    /// Gets a key for caching
    /// 
    /// 
    /// {0} : product ID
    /// 
    public static CacheKey ProductAttributeMappingsByProductCacheKey => new("Nop.productattributemapping.byproduct.{0}", ProductAttributeMappingsByProductPrefix);

    /// 
    /// Gets a key pattern to clear cache
    /// 
    /// 
    /// 
    public static string ProductAttributeMappingsByProductPrefix => new("Nop.productattributemapping.byproduct.");

    /// 
    /// Gets a key for caching
    /// 
    /// 
    /// {0} : product attribute mapping ID
    /// 
    public static CacheKey ProductAttributeValuesByAttributeCacheKey => new("Nop.productattributevalue.byattribute.{0}");

    /// 
    /// Gets a key for caching
    /// 
    /// 
    /// {0} : product ID
    /// 
    public static CacheKey ProductAttributeCombinationsByProductCacheKey => new("Nop.productattributecombination.byproduct.{0}");

    /// 
    /// Gets a key for caching
    /// 
    /// 
    /// {0} : Product attribute ID
    /// 
    public static CacheKey PredefinedProductAttributeValuesByAttributeCacheKey => new("Nop.predefinedproductattributevalue.byattribute.{0}");

    /// 
    /// Gets a key for caching
    /// 
    /// 
    /// {0} : combination ID
    /// 
    public static CacheKey ProductAttributeCombinationPicturesByCombinationCacheKey => new("Nop.productattributecombinationpicture.bycombination.{0}");

    /// 
    /// Gets a key for caching
    /// 
    /// 
    /// {0} : value ID
    /// 
    public static CacheKey ProductAttributeValuePicturesByValueCacheKey => new("Nop.productattributevaluepicture.byvalue.{0}");

    #endregion

    #region Product tags

    /// 
    /// Gets a key for caching
    /// 
    /// 
    /// {0} : store ID
    /// {1} : hash of list of customer roles IDs
    /// {2} : show hidden records?
    /// 
    public static CacheKey ProductTagCountCacheKey => new("Nop.producttag.count.{0}-{1}-{2}", NopEntityCacheDefaults.Prefix);

    /// 
    /// Gets a key for caching
    /// 
    /// 
    /// {0} : product ID
    /// 
    public static CacheKey ProductTagsByProductCacheKey => new("Nop.producttag.byproduct.{0}", NopEntityCacheDefaults.Prefix);

    #endregion

    #region Review type

    /// 
    /// Key for caching product review and review type mapping
    /// 
    /// 
    /// {0} : product review ID
    /// 
    public static CacheKey ProductReviewTypeMappingByReviewTypeCacheKey => new("Nop.productreviewreviewtypemapping.byreviewtype.{0}");

    #endregion

    #region Specification attributes

    /// 
    /// Gets a key for caching
    /// 
    /// 
    /// {0} : product ID
    /// {1} : specification attribute option ID
    /// {2} : allow filtering
    /// {3} : show on product page
    /// {4} : specification attribute group ID
    /// 
    public static CacheKey ProductSpecificationAttributeByProductCacheKey => new("Nop.productspecificationattribute.byproduct.{0}-{1}-{2}-{3}-{4}", ProductSpecificationAttributeByProductPrefix, ProductSpecificationAttributeAllByProductPrefix);

    /// 
    /// Gets a key pattern to clear cache
    /// 
    /// 
    /// {0} : product ID
    /// 
    public static string ProductSpecificationAttributeByProductPrefix => "Nop.productspecificationattribute.byproduct.{0}";

    /// 
    /// Gets a key pattern to clear cache
    /// 
    /// 
    /// {1} (not 0, see the ProductSpecificationAttributeAllByProductIdCacheKey) :specification attribute option ID
    /// 
    public static string ProductSpecificationAttributeAllByProductPrefix => "Nop.productspecificationattribute.byproduct.";

    /// 
    /// Key for specification attributes caching (product details page)
    /// 
    public static CacheKey SpecificationAttributesWithOptionsCacheKey => new("Nop.specificationattribute.withoptions.");

    /// 
    /// Key for specification attributes caching
    /// 
    /// 
    /// {0} : specification attribute ID
    /// 
    public static CacheKey SpecificationAttributeOptionsCacheKey => new("Nop.specificationattributeoption.byattribute.{0}");

    /// 
    /// Key for specification attribute options by category ID caching
    /// 
    /// 
    /// {0} : category ID
    /// 
    public static CacheKey SpecificationAttributeOptionsByCategoryCacheKey => new("Nop.specificationattributeoption.bycategory.{0}", FilterableSpecificationAttributeOptionsPrefix);

    /// 
    /// Key for specification attribute options by manufacturer ID caching
    /// 
    /// 
    /// {0} : manufacturer ID
    /// 
    public static CacheKey SpecificationAttributeOptionsByManufacturerCacheKey => new("Nop.specificationattributeoption.bymanufacturer.{0}", FilterableSpecificationAttributeOptionsPrefix);

    /// 
    /// Gets a key pattern to clear cache
    /// 
    public static string FilterableSpecificationAttributeOptionsPrefix => "Nop.specificationattributeoption";

    /// 
    /// Gets a key for specification attribute groups caching by product id
    /// 
    /// 
    /// {0} : product ID
    /// 
    public static CacheKey SpecificationAttributeGroupByProductCacheKey => new("Nop.specificationattributegroup.byproduct.{0}", SpecificationAttributeGroupByProductPrefix);

    /// 
    /// Gets a key pattern to clear cache
    /// 
    public static string SpecificationAttributeGroupByProductPrefix => "Nop.specificationattributegroup.byproduct.";

    #endregion

    #endregion
}