Я пытаюсь расширить модель продукта новым атрибутом, который я создал в -items. xml, но я не могу получить его на фронте Спартака. Я добавил файл product.model.ts со следующим кодом:
import { Product as CxProduct } from '@spartacus/core';
export interface Product extends CxProduct {
myAttribute: string;
}
И импортировал этот файл в канал, где я использую модель продукта, но он кажется пустым, хотя продукт имеет данные в myAttribute. поле в офисе. Есть ли что-то, что я могу упустить?
Я использую этот атрибут в компоненте product-images.com, который я создал, чтобы переопределить атрибут по умолчанию. Это новый продукт-images.component.ts
import { Component, OnInit } from '@angular/core';
import { CurrentProductService } from '@spartacus/storefront';
import { ProductImagesComponent as SpartacusProductImages } from '@spartacus/storefront'
@Component({
selector: 'cx-product-images',
templateUrl: './product-images.component.html',
styleUrls: ['./product-images.component.scss']
})
export class ProductImagesComponent extends SpartacusProductImages implements OnInit {
constructor(currentProductService: CurrentProductService) {
super(currentProductService)
}
ngOnInit() {
}
}
Большое спасибо