Class ProductCategoryService
- Namespace
- Dynamicweb.Ecommerce.Products.Categories
- Assembly
- Dynamicweb.Ecommerce.dll
public class ProductCategoryService : ICacheStorage<string, Category>, ICacheStorage<string>, ICacheStorage
- Inheritance
-
ProductCategoryService
- Implements
- Inherited Members
Methods
AddFieldToCategory(Category, Field)
Adds a Field to the category. Also adds a language version of the Field to each language version of the category.
public void AddFieldToCategory(Category theCategory, Field field)
Parameters
AddFieldToCategory(Category, string, string, string, string, string, FieldListPresentationType)
Adds a Field to the category. Also adds a language version of the Field to each language version of the category.
public void AddFieldToCategory(Category theCategory, string systemName, string label, string templateTag, string type, string defaultValue, FieldListPresentationType presentation)
Parameters
theCategoryCategorysystemNamestringThe SystemName of the field.
labelstringThe Label of the field.
templateTagstringtypestringThe type of the field.
defaultValuestringpresentationFieldListPresentationType
AddFieldToCategory(Category, string, string, string, string, string, FieldListPresentationType, int)
Adds a Field to the category. Also adds a language version of the Field to each language version of the category.
public void AddFieldToCategory(Category theCategory, string systemName, string label, string templateTag, string type, string defaultValue, FieldListPresentationType presentation, int sortOrder)
Parameters
theCategoryCategorysystemNamestringThe SystemName of the field.
labelstringThe Label of the field.
templateTagstringtypestringThe type of the field.
defaultValuestringpresentationFieldListPresentationTypesortOrderint
AddFieldToCategory(Category, string, string, string, string, string, FieldListPresentationType, int, string)
Adds a Field to the category. Also adds a language version of the Field to each language version of the category.
public void AddFieldToCategory(Category theCategory, string systemName, string label, string templateTag, string type, string defaultValue, FieldListPresentationType presentation, int sortOrder, string description)
Parameters
theCategoryCategorysystemNamestringThe SystemName of the field.
labelstringThe Label of the field.
templateTagstringtypestringThe type of the field.
defaultValuestringpresentationFieldListPresentationTypesortOrderintdescriptionstring
ClearCache()
Resets all keys to the default value for objects stored in the object cache
public void ClearCache()
ClearCache(IEnumerable<string>)
Resets the specified keys to the default value for objects stored in the object cache
public void ClearCache(IEnumerable<string> keys)
Parameters
keysIEnumerable<string>Keys to reset
ClearCache(string)
Resets the specified key to the default value for objects stored in the object cache
public void ClearCache(string key)
Parameters
keystringKey to reset
ClearCategoryCache()
Clears category cache.
public void ClearCategoryCache()
ClearFieldCache()
Clears fields cache.
public void ClearFieldCache()
CreateCategory(string)
Creates a new Category object with the given parameters and saves it to the database. In addition a Category object is creates for all current eCommerce Languages. The ID of the object is auto-generated. The Dynamicweb.Ecommerce.International.Language of the object is set to Context.Language.
public Category CreateCategory(string name)
Parameters
namestringThe Name of the object.
Returns
CreateCategory(string, string)
Creates a new Category object with the given parameters and saves it to the database.
public Category CreateCategory(string systemName, string name)
Parameters
Returns
CreateCategory(string, string, CategoryType)
Creates a new Category object with the given parameters and saves it to the database.
public Category CreateCategory(string systemName, string name, CategoryType categoryType)
Parameters
systemNamestringThe SystemName of the object.
namestringThe Name of the object.
categoryTypeCategoryTypeThe category type.
Returns
CreateField(string, Category, string, string, string)
Creates a new Field object.
public Field CreateField(string id, Category category, string templateTag, string label, string type)
Parameters
Returns
CreateField(string, Category, string, string, string, string, FieldListPresentationType, string)
Creates a new Field object.
public Field CreateField(string id, Category category, string templateTag, string label, string type, string defaultValue, FieldListPresentationType presentation, string description)
Parameters
idstringcategoryCategorytemplateTagstringlabelstringtypestringdefaultValuestringpresentationFieldListPresentationTypedescriptionstring
Returns
DeleteCategory(Category)
Deletes the Category and all fields associated, and all language versions.
public void DeleteCategory(Category theCategory)
Parameters
theCategoryCategory
DeleteCategoryTranslation(Category, string)
public void DeleteCategoryTranslation(Category theCategory, string languageId)
Parameters
DeleteField(Field)
Deletes the field.
public void DeleteField(Field theField)
Parameters
theFieldFieldThe field to remove.
GetCategories()
Returns all categories from database.
public IEnumerable<Category> GetCategories()
Returns
- IEnumerable<Category>
A collection of categories containing 0 or more items.
GetCategories(Product)
public IEnumerable<Category> GetCategories(Product product)
Parameters
productProductThe product.
Returns
- IEnumerable<Category>
A collection of categories containing 0 or more items.
GetCategories(Product, bool)
public IEnumerable<Category> GetCategories(Product product, bool includeProductProperties)
Parameters
productProductThe product.
includeProductPropertiesboolDetermines whether product properties should be included in result.
Returns
- IEnumerable<Category>
A collection of categories containing 0 or more items.
GetCategoriesUsages()
public Dictionary<string, int> GetCategoriesUsages()
Returns
GetCategoryById(string)
Returns the Category with the given ID. The default Language is used.
public Category GetCategoryById(string categoryId)
Parameters
Returns
GetCategoryUsageCount(string, bool)
public int GetCategoryUsageCount(string categoryId, bool productUsages)
Parameters
Returns
GetCategoryUsageReferences(string, bool, int, int, string, string)
public IEnumerable<CategoryUsage> GetCategoryUsageReferences(string categoryId, bool productUsages, int pageNumber = 1, int pageSize = 100, string orderBy = null, string orderByDirection = null)
Parameters
categoryIdstringproductUsagesboolpageNumberintpageSizeintorderBystringorderByDirectionstring
Returns
GetFields()
public Dictionary<string, FieldCollection> GetFields()
Returns
GetFields(string)
public Dictionary<string, FieldCollection> GetFields(string languageId)
Parameters
languageIdstring
Returns
GetFieldsByCategoryId(string)
public FieldCollection GetFieldsByCategoryId(string categoryId)
Parameters
categoryIdstring
Returns
GetGroupCategoryFieldValue(Group, Field, bool)
Gets the category field value.
public FieldValueAndInheritanceInformation GetGroupCategoryFieldValue(Group group, Field field, bool allowFallback)
Parameters
groupGroupThe group information.
fieldFieldThe field.
allowFallbackboolSpecifies if fallback values should be used, when the group does not yield a value.
Returns
- FieldValueAndInheritanceInformation
category field value
GetProductCategoryFieldValue(Product, Field)
Gets the category field value.
public FieldValueAndInheritanceInformation GetProductCategoryFieldValue(Product product, Field field)
Parameters
Returns
- FieldValueAndInheritanceInformation
category field value
GetUsageCount(Category)
public int GetUsageCount(Category category)
Parameters
categoryCategory
Returns
GetUsageGroupsAsCollection(Category)
public List<string> GetUsageGroupsAsCollection(Category category)
Parameters
categoryCategory
Returns
ParseFieldValue(Field, object)
public object ParseFieldValue(Field theField, object value)
Parameters
Returns
- object
The parsed value.
ParseFieldValue(object, int)
public object ParseFieldValue(object value, int type)
Parameters
Returns
- object
The parsed value.
SaveCategory(Category)
Saves the Category.
public void SaveCategory(Category theCategory)
Parameters
theCategoryCategory
SaveField(Field)
Saves this instance.
public void SaveField(Field theField)
Parameters
theFieldField
ShowField(Field, Product)
Return a boolean, which indicates whether or not the field should be shown. This is calculated based on the 'HideIfFieldHasNoValue' and the value of the field.
public bool ShowField(Field field, Product product)