public override RelatedModel GetProductRelationships(ProductModel productModel, string relationTypeName, bool includeBaseProductRelations = true, bool includeVariantRelations = true) { if (string.IsNullOrEmpty(relationTypeName)) { return(null); } var relationshipType = _relationshipTypeService.Get(relationTypeName); return(relationshipType != null?_relatedModelBuilder.Build(productModel, relationshipType, includeBaseProductRelations, includeVariantRelations) : null); }
private void InitRelationshipTypes(IEnumerable <RelationshipType> relationshipTypes) { foreach (var item in relationshipTypes) { if (IsAlreadyExecuted <RelationshipType>(item.Id)) { continue; } var currentItem = _relationshipTypeService.Get(item.Id); if (currentItem != null) { continue; } _relationshipTypeService.Create(item); SetAlreadyExecuted <RelationshipType>(item.Id); } }