projects/congarevenuecloud/ecommerce/src/lib/modules/catalog/services/product-option.service.ts
The service provides methods for interacting with the products and returns option components configured for the bundle product.
import { ProductOptionService, AObjectService } from '@congarevenuecloud/ecommerce';
constructor(private productOptionService: ProductOptionService) {}
// or
export class MyService extends AObjectService {
private productOptionService: ProductOptionService = this.injector.get(ProductOptionService);
}
Properties |
|
Methods |
|
getProductOptions | ||||||||
getProductOptions(product: Product)
|
||||||||
Decorators :
@MemoizeAll()
|
||||||||
This method returns a list of product options components configured for the bundle product. Uses '@MemoizeAll()' decorator imported from 'lodash-decorators', only caches items that you actually use -- but holds on to all the cached items forever. Example:Example :
Parameters :
Returns :
Array<ProductOptionComponent>
an Array of ProductOptionComponent. |
getProductOptionsForGroup | ||||||||||||
getProductOptionsForGroup(product: Product, group: ProductOptionGroup)
|
||||||||||||
This method returns list of ProductOptionComponent filters out ProductOptionComponent which is not associated with the group parameter. Example:Example :
Parameters :
Returns :
Array<ProductOptionComponent>
an array of ProductOptionComponent. |
getProductOptionTree | |||||||||||||||||||||||||
getProductOptionTree(product: string | Product, relatedTo?: CartItem | QuoteLineItem | OrderLineItem | AssetLineItem, applyFilter: "none" | "items" | "changes", changes?: Array
|
|||||||||||||||||||||||||
Method takes a bundle product record and organizes the attributes and options into it's tree structure. Will filter out any attributes or option groups that are empty and associate related cart items with each option Example:Example :
options are selected. If the applyFilter is 'changes' it returns the attributes/options that are changed, required for helper method 'groupOptionGroups'
Parameters :
Returns :
Observable<Product>
returns an observable of Product. |
getRequiredUncheckedOptions | ||||||||
getRequiredUncheckedOptions(allOptions: Array
|
||||||||
This method is a work in progress. Function that returns all the options that are Required but selected from UI. Example:Example :
Parameters :
Returns :
Array<ProductOptionComponent>
an Array of Product option Component. |
groupOptionGroups | |||||||||||||||||||||||||||||||||||
groupOptionGroups(p: Product, attributeValue: AttributeValue | OrderAttributeValue, relatedItems: Array
|
|||||||||||||||||||||||||||||||||||
This method is responsible for creating the tree structure by looping through attribute groups and option groups in recursive fashion and generate tree structure keeping the primary bundle product as the root. Example:Example :
options are selected. If the applyFilter is 'changes' it returns the attributes/options that are changed.
Parameters :
Returns :
Product
product object. |
fetch | |||||||||||||||||||||||||
fetch(id: string, memoizeOptions: MemoizeOptions, relatedRecords: string, additionalQueryParams: QueryParams)
|
|||||||||||||||||||||||||
Decorators :
@MemoizeWithHash()
|
|||||||||||||||||||||||||
This method can be used to get the fetch the product details for a given product identifier. It will return all the configurations of a bundle including option and attribute groups. For bundle products it will return upto 6 level option group configurations. Example:Example :
Parameters :
Returns :
Observable<AObject>
Observable |
getFieldPickList | ||||||||||
getFieldPickList(fieldName: string)
|
||||||||||
This method returns the picklist values for a given field from product object. Example:Example :
Parameters :
Returns :
Observable<Array<string>>
observable containing list of string picklist values. |
getProductAggregate | ||||||||||||||||||||
getProductAggregate(aggregateFields?: Array<AggregateFields>, queryFields: Array
|
||||||||||||||||||||
Parameters :
Returns :
Observable<AggregateResultSet>
|
getProducts | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
getProducts(categories: Array
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Decorators :
@MemoizeWithHash()
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
This method can be used to get the fetch the list of ProductResults including total product count, for a given price list and category. Example:Example :
Parameters :
Returns :
Observable<ProductResult>
Observable<Array |
getProductsByCode | ||||||||
getProductsByCode(productCodeList: Array
|
||||||||
This method can be used to fetch the list of products by product code. Example:Example :
Parameters :
Returns :
Observable<Array<Product>>
observable list of product records macthing the product codes. |
getProductsById | ||||||||
getProductsById(productIds: Array
|
||||||||
This method can be used to fetch the list of products by product Ids. Example:Example :
Parameters :
Returns :
Observable<Array<Product>>
returns an observable list of product records matching the product identifiers. |
getProductsWithFeatureValues | |||||||||||||||
getProductsWithFeatureValues(productList: Array<Product> | Array<string>, memoizeOptions: MemoizeOptions)
|
|||||||||||||||
Decorators :
@MemoizeWithHash()
|
|||||||||||||||
This method is responsible for fetching the product details with feature values for a given set of products. Example:Example :
Parameters :
Returns :
Observable<Array<Product>>
Observable<Array |
getState |
getState()
|
This method returns the previous state of the catalog page containing sortfield and page number. Example:Example :
Returns :
PreviousState
PreviousState objcet containing the sort order and page number values |
Static getValue | ||||
getValue(key)
|
||||
The Static method fetches the values from the local storage. Example:Example :
Parameters :
Returns :
string
|
publish | ||||||
publish(pagestates: PreviousState)
|
||||||
This method records the prevoius state of the catalog page and updates the state. Example:Example :
Parameters :
Returns :
void
|
searchProducts | |||||||||||||||||||||||||
searchProducts(searchString: string, limit: number, fetchTranslations: boolean, memoizeOptions: MemoizeOptions)
|
|||||||||||||||||||||||||
Decorators :
@MemoizeWithHash()
|
|||||||||||||||||||||||||
This method is used to search products by search string ###Example : Example :
Parameters :
Returns :
Observable<Array<Product>>
returns an observable list of product records matching the search string. |
Static setValue |
setValue(key: string, pageValue: string)
|
The Static method updates the values such as page size, view etc in local storage. Example:Example :
Returns :
void
|
Protected assetService |
Type : AssetService
|
Default value : this.injector.get(AssetService)
|
Protected cartItemService |
Type : CartItemService
|
Default value : this.injector.get(CartItemService)
|
Protected cartService |
Type : CartService
|
Default value : this.injector.get(CartService)
|
deletedItems |
Type : Array<SelectedOption>
|
Default value : []
|
disabledItems |
Type : Array<SelectedOption>
|
Default value : []
|
Protected plService |
Type : PriceListService
|
Default value : this.injector.get(PriceListService)
|
Protected productService |
Type : ProductService
|
Default value : this.injector.get(ProductService)
|
Protected secondaryCartService |
Type : SecondaryCartService
|
Default value : this.injector.get(SecondaryCartService)
|
Protected accountService |
Default value : this.injector.get(AccountService)
|
Protected categoryService |
Type : CategoryService
|
Default value : this.injector.get(CategoryService)
|
eventback |
Type : BehaviorSubject<boolean>
|
Default value : new BehaviorSubject(false)
|
isDetailsPage |
Type : BehaviorSubject<boolean>
|
Default value : new BehaviorSubject<boolean>(false)
|
Protected pliService |
Type : PriceListItemService
|
Default value : this.injector.get(PriceListItemService)
|
Protected productCategoryService |
Default value : this.injector.get(ProductCategoryService, 'productCategoryService')
|
Protected queryParamsHandlerService |
Default value : this.injector.get(QueryParamsHandlerService)
|
state |
Type : BehaviorSubject<PreviousState>
|
Default value : new BehaviorSubject<PreviousState>(null)
|
Protected translatorService |
Type : TranslatorLoaderService
|
Default value : this.injector.get(TranslatorLoaderService)
|
type |
Default value : Product
|
Protected userService |
Type : UserService
|
Default value : this.injector.get(UserService)
|