feat: enhance variant attribute handling across components for improved selection and display

This commit is contained in:
2026-08-10 12:25:58 -03:00
parent d6bab24e1d
commit 56f602d876
9 changed files with 191 additions and 35 deletions

View File

@@ -14,6 +14,7 @@ import {
InventoryPolicy,
ProductAttribute,
ProductAttributeOption,
VariantAttributeValue,
} from '../../../../core/services/catalog/catalog.interface';
@Component({
@@ -198,7 +199,7 @@ export class ProductAttributeSelectorComponent {
private getVariantAttributeValues(
attribute: ProductAttribute,
variantAttributes: Record<string, string | string[]>,
variantAttributes: Record<string, VariantAttributeValue>,
): string[] {
const normalizedCodigo = this.normalizeText(attribute.codigo);
const normalizedNombre = this.normalizeText(attribute.nombre);
@@ -207,7 +208,9 @@ export class ProductAttributeSelectorComponent {
const normalizedKey = this.normalizeText(key);
if (normalizedKey === normalizedCodigo || normalizedKey === normalizedNombre) {
return (Array.isArray(value) ? value : [value]).map((item) => this.normalizeText(item));
return (Array.isArray(value) ? value : [value]).map((item) =>
this.normalizeText(typeof item === 'string' ? item : item.value),
);
}
}