private string GetCustomAttribute(Magento2catalogProductRepositoryV1_v_2_1_0_0_CE.CatalogDataProductInterface catalogDataProductInterface, string attributesCode) { var descriptionNodes = (catalogDataProductInterface.customAttributes.FirstOrDefault(x => string.Equals(x.attributeCode, attributesCode, StringComparison.InvariantCultureIgnoreCase)) ?? new Magento2catalogProductRepositoryV1_v_2_1_0_0_CE.FrameworkAttributeInterface()).value; if (descriptionNodes is XmlNode[]) { var nodeValue = descriptionNodes as XmlNode[]; var temp = new List <string>(); if (nodeValue.Length > 0) { temp.AddRange(from XmlNode xmlNode in nodeValue where xmlNode != null select xmlNode.InnerText); } return(string.Join(",", temp.ToArray())); } else if (descriptionNodes is XmlNode) { var nodeValue = descriptionNodes as XmlNode; string temp = nodeValue.InnerText; return(temp); } else { return(null); } }
public SoapProduct(Magento2catalogProductRepositoryV1_v_2_1_0_0_CE.CatalogDataProductInterface catalogProductEntity) { this.Name = catalogProductEntity.name; this.ProductId = catalogProductEntity.id.ToString(CultureInfo.InvariantCulture); this.Sku = catalogProductEntity.sku; this.Type = catalogProductEntity.typeId; this.UpdatedAt = catalogProductEntity.updatedAt; }
private string GetSimpleStringCustomAttribute(Magento2catalogProductRepositoryV1_v_2_1_0_0_CE.CatalogDataProductInterface catalogDataProductInterface, string attributesCode) { var frameworkAttributeInterface = catalogDataProductInterface.customAttributes.FirstOrDefault(x => string.Equals(x.attributeCode, attributesCode, StringComparison.InvariantCultureIgnoreCase)) ?? new Magento2catalogProductRepositoryV1_v_2_1_0_0_CE.FrameworkAttributeInterface(); var descriptionNodes = frameworkAttributeInterface.value as XmlNode[]; string temp = null; if (descriptionNodes != null && descriptionNodes.Length > 0) { temp = string.Join("", descriptionNodes.Where(x => x != null).Select(x => x.InnerText)); } return(temp); }
private string[] GetArrayOfStringCustomAttribute(Magento2catalogProductRepositoryV1_v_2_1_0_0_CE.CatalogDataProductInterface catalogDataProductInterface, string attributesCode) { var frameworkAttributeInterfaces = catalogDataProductInterface.customAttributes; var firstOrDefault = frameworkAttributeInterfaces.FirstOrDefault(x => string.Equals(x.attributeCode, attributesCode, StringComparison.InvariantCultureIgnoreCase)); var frameworkAttributeInterface = firstOrDefault != null ? firstOrDefault : new Magento2catalogProductRepositoryV1_v_2_1_0_0_CE.FrameworkAttributeInterface(); var descriptionNodes = frameworkAttributeInterface.value as XmlNode[]; var temp = new List <string>(); if (descriptionNodes != null && descriptionNodes.Length > 0) { temp.AddRange(from XmlNode node in descriptionNodes where node != null select node.InnerText); } return(temp.ToArray()); }