export class ProductController {

  public product: any;

  constructor(
    public API_URL: string
  ) {}

  public gotoProduct(): void {
    location.pathname = `/catalog/product/view/id/${this.product.id}/`;
  }

  public getAttribute(attribute_code: string): string {
    let result = this.product.custom_attributes.find((item) => { return item.attribute_code === attribute_code });
    if (result) {
      return result.value;
    } else {
      return '';
    }
  }

}
