projects/congarevenuecloud/ecommerce/src/lib/modules/catalog/services/product.service.ts
Products are goods for buying/selling with detailed information. This service provides methods for interacting with the products.
import { ProductService, AObjectService } from '@congarevenuecloud/ecommerce';
constructor(private productService: ProductService) {}
// or
export class MyService extends AObjectService {
private productService: ProductService = this.injector.get(ProductService);
}
AObjectService
Properties |
|
Methods |
| fetch | |||||||||||||||||||||||||
fetch(id: string, memoizeOptions: MemoizeOptions, relatedRecords: string, additionalQueryParams: QueryParams)
|
|||||||||||||||||||||||||
Decorators :
@MemoizeWithHash()
|
|||||||||||||||||||||||||
|
This method fetches 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 returns up to 6 levels of option group configurations. Example:See QueryParams for more details on the structure and fields required
Parameters :
Returns :
Observable<AObject>
Observable |
| getFieldPickList | ||||||||||
getFieldPickList(fieldName: string)
|
||||||||||
|
This method returns the picklist values for a given field from product object. Example:
Parameters :
Returns :
Observable<Array<string>>
observable containing list of string picklist values. |
| getProductAggregate | |||||||||||||||||||||||||
getProductAggregate(aggregateFields?: Array<AggregateFields>, queryFields: Array
|
|||||||||||||||||||||||||
|
This method retrieves aggregated product data based on specified criteria. See AggregateFields for more details on the structure and fields required See FieldFilter for more details on the structure and fields required See AggregateResultSet for more details on the structure and fields required
Parameters :
Returns :
Observable<AggregateResultSet>
observable containing aggregate response. |
| 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:
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:
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:
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:
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:See PreviousState for more details on the structure and fields required.
Returns :
PreviousState
PreviousState object containing the sort order and page number values |
| Static getValue | ||||
getValue(key)
|
||||
|
The Static method fetches the values from the local storage. Example:
Parameters :
Returns :
string
|
| publish | ||||||
publish(pagestates: PreviousState)
|
||||||
|
This method records the prevoius state of the catalog page and updates the state. 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 :
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:
Returns :
void
|
| Protected accountService |
Default value : this.injector.get(AccountService)
|
| Protected assetService |
Type : AssetService
|
Default value : this.injector.get(AssetService)
|
| 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 plService |
Type : PriceListService
|
Default value : this.injector.get(PriceListService)
|
| 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)
|