File

projects/congarevenuecloud/ecommerce/src/lib/modules/catalog/services/product-attribute.service.ts

Description

This service is a work in progress.

Product attributes represent a characteristic of a product that can have different values like color, vendor etc.

Usage

Example :
import { ProductAttributeService, AObjectService} from '@congarevenuecloud/ecommerce';

export class MyComponent implements OnInit{
constructor( private productAttributeService: ProductAttributeService)
}
// or
export class MyService extends AObjectService {
private productAttributeService: ProductAttributeService = this.injector.get(ProductAttributeService);
}

Extends

AObjectService

Index

Properties
Methods

Methods

getAttributeGroupIdsForFields
getAttributeGroupIdsForFields(attributes: Array)

Method returns an array of product attributes.

Example:

Example :
import { ProductAttributeService, ProductAttribute, Product } from '@congarevenuecloud/ecommerce';
import { Observable } from 'rxjs/Observable';

export class MyComponent implements OnInit{
productAttributeList: Array<ProductAttribute>;
productAttributeList$: Observable<Array<ProductAttribute>>;

constructor(private productAttributeService: ProductAttributeService){}

getAttributeGroupIdsForFields(attributes: Array<ProductAttribute>){
this.productAttributeService.getAttributeGroupIdsForFields(attributes).subscribe(attributeList => this.productAttributeList = attributeList);
// or
this.productAttributeList$ = this.productAttributeService.getAttributeGroupIdsForFields(attributes);
}
}
Parameters :
Name Type Optional Description
attributes Array<ProductAttribute> No

An array of products attributes.

Returns : Observable<Array<ProductAttribute>>

An array of product attribute in an observable.

getAttributeValueDefaults
getAttributeValueDefaults(productAttributeList: Array)

Method returns ProductAttributeValue with default attribute values for a given list of ProductAttributes.

Example:

Example :
import { ProductAttributeService, ProductAttributeValue } from '@congarevenuecloud/ecommerce';
import { Observable, of } from 'rxjs/Observable';

export class MyComponent implements OnInit{
pav: ProductAttributeValue;
pav$: Observable<ProductAttributeValue>;

constructor(private productAttributeService: ProductAttributeService){}

getAttributeValueDefaults(product: Product){
this.productAttributeService.getAttributeValueDefaults(attributeList).subscribe(result => this.pav$ = result);
// or
this.pav$$ = of(this.productAttributeService.getAttributeValueDefaults(attributeList));
}
}
Parameters :
Name Type Optional Description
productAttributeList Array<ProductAttribute> No

accepts an array of ProductAttributes.

Returns : any

object of instance of an ProductAttributeValue.

getAttributeWithDefaults
getAttributeWithDefaults(product: Product)

Method returns attribute with default values for the product.

Parameters :
Name Type Optional Description
product Product No

the instance of the product to fetch the default attributes.

Returns : ProductAttribute

A ProductAttribute instance with default values.

getProductAttributes
getProductAttributes(product: Product, attributeGroupName?: string)

Method gets a list of product attributes for a given product. Can further filter the list by a group.

Example:

Example :
import { ProductAttributeService, ProductAttribute, Product } from '@congarevenuecloud/ecommerce';
import { Observable } from 'rxjs/Observable';

export class MyComponent implements OnInit{
productAttributeList: Array<ProductAttribute>;
productAttributeList$: Observable<Array<ProductAttribute>>;

constructor(private productAttributeService: ProductAttributeService){}

getProductAttributes(product: Product){
this.productAttributeService.getProductAttributes(product).subscribe(attributeList => this.productAttributeList = attributeList);
// or
this.productAttributeList$ = this.productAttributeService.getProductAttributes(product);
}
}
Parameters :
Name Type Optional Description
product Product No

the instance of the product for which to get the attributes for

attributeGroupName string Yes

an optional argument of a specific group name with which to get attributes for.

Returns : Observable<Array<ProductAttribute>>

A hot observable containing list of product attributes for the given product.

setDescribeInformationOnProductAttributes
setDescribeInformationOnProductAttributes(attributes: Array)

Method returns an array of product attributes. Adds an additional property to all attributes returned called '_.describe'. This property contains metadata information about the attribute.

Example:

Example :
import { ProductAttributeService, ProductAttribute, Product } from '@congarevenuecloud/ecommerce';
import { Observable } from 'rxjs/Observable';

export class MyComponent implements OnInit{
productAttributeList: Array<ProductAttribute>;
productAttributeList$: Observable<Array<ProductAttribute>>;

constructor(private productAttributeService: ProductAttributeService){}

setDescribeInformationOnProductAttributes(attributes: Array<ProductAttribute>){
this.productAttributeService.setDescribeInformationOnProductAttributes(attributes).subscribe(attributeList => this.productAttributeList = attributeList);
// or
this.productAttributeList$ = this.productAttributeService.setDescribeInformationOnProductAttributes(attributes);
}
}
Parameters :
Name Type Optional Description
attributes Array<ProductAttribute> No

An array of products attributes for which '_describe' property with metadata information needs to be added.

Returns : Observable<Array<ProductAttribute>>

An array of product attributes with metadata information for each attribute.

updateAllowPicklistValues
updateAllowPicklistValues(product: Product, attributeActions: Array)

Method updates the picklist values of the attributes for Allow rule action .

Example:

Example :
import { ProductAttributeService, ProductAttribute, Product } from '@congarevenuecloud/ecommerce';
import { Observable } from 'rxjs/Observable';

export class MyComponent implements OnInit{
product: Product;
product$: Observable<Product>;

constructor(private productAttributeService: ProductAttributeService){}

updateAllowPicklistValues(product: Product, attributeActions: Array<Object>){
this.productAttributeService.updateAllowPicklistValues(product, attributeActions).subscribe(product => this.product = product);
// or
this.product$ = this.productAttributeService.updateAllowPicklistValues(product, attributeActions);
}
}
Parameters :
Name Type Optional Description
product Product No

the instance of the product for which the attribute

attributeActions Array<Object> No

argument containing the list of attribute rule actions.

returns an observable of product record.

Properties

Protected productAttributeGrpMemberService
Type : ProductAttributeGroupMemberService
Default value : this.injector.get(ProductAttributeGroupMemberService)
type
Default value : ProductAttribute

results matching ""

    No results matching ""