File
Description
Price lists are the core object for defining the catalog seen by the end user. Categories, products and pricing are all derived from the selected price list.
Usage
import { PriceListService, AObjectService} from '@congarevenuecloud/ecommerce';
export class MyComponent implements OnInit{
constructor( private priceListService: PriceListService)
}
// or
export class MyService extends AObjectService {
private priceListService: PriceListService = this.injector.get(PriceListService);
}
Extends
Methods
getDefaultPriceList
|
getDefaultPriceList()
|
Method returns the default pricelist from the storefront.
The default pricelist is the pricelist based on the default pricelist id on the storefront.
Example:
import { PriceListService, PriceList } from '@congarevenuecloud/ecommerce';
import { Observable } from 'rxjs/Observable';
export class MyComponent implements OnInit{
defaultPriceList: PriceList;
defaultPriceList$: Observable<PriceList>;
constructor(private pricelistService: PriceListService){}
getDefaultPriceList(){
this.pricelistService.getDefaultPriceList().subscribe(a => this.defaultPriceList = a);
// or
this.defaultPriceList$ = this.pricelistService.getDefaultPriceList();
}
}
Returns : Observable<PriceList>
a hot observable containing the default pricelist from the storefront.
|
getEffectivePriceList
|
getEffectivePriceList()
|
Method returns the entire price list instance of the current effective price list. If the account is associated with based on price list, this will return the based on price list.
Example:
import { PriceListService, PriceList } from '@congarevenuecloud/ecommerce';
import { Observable } from 'rxjs/Observable';
export class MyComponent implements OnInit{
priceList: PriceList;
priceList$: Observable<PriceList>;
constructor(private pricelistService: PriceListService){}
getEffectivePriceList(){
this.pricelistService.getEffectivePriceList().subscribe(a => this.priceList = a);
// or
this.priceList$ = this.pricelistService.getEffectivePriceList();
}
}
Returns : Observable<PriceList>
a hot observable containing the effective price list instance.
|
getEffectivePriceListId
|
getEffectivePriceListId()
|
Method returns the current effective price list id. If the account is associated with based on price list, this will return the based on price list id.
Example:
import { PriceListService, PriceList } from '@congarevenuecloud/ecommerce';
import { Observable } from 'rxjs/Observable';
export class MyComponent implements OnInit{
priceListId: string;
priceListId$: Observable<string>;
constructor(private pricelistService: PriceListService){}
getEffectivePriceListId(){
this.pricelistService.getEffectivePriceListId().subscribe(a => this.priceListId = a);
// or
this.priceListId$ = this.pricelistService.getEffectivePriceListId();
}
}
Returns : Observable<string>
a hot string observable containing the current effective price list id.
|
getPriceList
|
getPriceList()
|
Method returns the entire price list instance of the current active price list in the application.
The active price list is the price list associated to current account or default price list on the storefront.
Example:
import { PriceListService, PriceList } from '@congarevenuecloud/ecommerce';
import { Observable } from 'rxjs/Observable';
export class MyComponent implements OnInit{
priceList: PriceList;
priceList$: Observable<PriceList>;
constructor(private pricelistService: PriceListService){}
getPriceLists(){
this.pricelistService.getPriceList().subscribe(a => this.priceList = a);
// or
this.priceList$ = this.pricelistService.getPriceList();
}
}
Returns : Observable<PriceList>
a hot observable containing the price list instance.
|
getPriceListById
|
getPriceListById(id: string)
|
Method returns the pricelist based on the string identifier passed.
Example:
import { PriceListService, PriceList } from '@congarevenuecloud/ecommerce';
import { Observable } from 'rxjs/Observable';
export class MyComponent implements OnInit{
priceList: PriceList;
priceList$: Observable<PriceList>;
constructor(private pricelistService: PriceListService){}
getPriceListsById(id:string){
this.pricelistService.getPriceListById(id).subscribe(a => this.priceList = a);
// or
this.priceList$ = this.pricelistService.getPriceListById(id);
}
}
Parameters :
Name |
Type |
Optional |
id |
string
|
No
|
Returns : Observable<PriceList>
a hot observable containing the price list instance based on Id passed.
|
getPriceListId
|
getPriceListId()
|
Method returns the current active price list id in the application.
The active price list is the price list associated to current account or default price list on the storefront.
Example:
import { PriceListService, PriceList } from '@congarevenuecloud/ecommerce';
import { Observable } from 'rxjs/Observable';
export class MyComponent implements OnInit{
priceListId: string;
priceListId$: Observable<string>;
constructor(private pricelistService: PriceListService){}
getPriceListId(){
this.pricelistService.getPriceListId().subscribe(a => this.priceListId = a);
// or
this.priceListId$ = this.pricelistService.getPriceListId();
}
}
Returns : Observable<string>
a hot string observable containing the current price list id.
|
apiService
|
Default value : this.injector.get(ApiService)
|
storefrontService
|
Default value : this.injector.get(StorefrontService)
|
type
|
Default value : PriceList
|
userService
|
Default value : this.injector.get(UserService)
|