using Microsoft.AspNetCore.Http; using Nop.Core.Domain.Catalog; namespace Nop.Services.Catalog; /// /// Product attribute parser interface /// public partial interface IProductAttributeParser { #region Product attributes /// /// Gets selected product attribute mappings /// /// Attributes in XML format /// /// A task that represents the asynchronous operation /// The task result contains the selected product attribute mappings /// Task> ParseProductAttributeMappingsAsync(string attributesXml); /// /// Get product attribute values /// /// Attributes in XML format /// Product attribute mapping identifier; pass 0 to load all values /// /// A task that represents the asynchronous operation /// The task result contains the product attribute values /// Task> ParseProductAttributeValuesAsync(string attributesXml, int productAttributeMappingId = 0); /// /// Gets selected product attribute values /// /// Attributes in XML format /// Product attribute mapping identifier /// Product attribute values IList ParseValues(string attributesXml, int productAttributeMappingId); /// /// Adds an attribute /// /// Attributes in XML format /// Product attribute mapping /// Value /// Quantity (used with AttributeValueType.AssociatedToProduct to specify the quantity entered by the customer) /// Updated result (XML format) string AddProductAttribute(string attributesXml, ProductAttributeMapping productAttributeMapping, string value, int? quantity = null); /// /// Remove an attribute /// /// Attributes in XML format /// Product attribute mapping /// Updated result (XML format) string RemoveProductAttribute(string attributesXml, ProductAttributeMapping productAttributeMapping); /// /// Are attributes equal /// /// The attributes of the first product /// The attributes of the second product /// A value indicating whether we should ignore non-combinable attributes /// A value indicating whether we should ignore the quantity of attribute value entered by the customer /// /// A task that represents the asynchronous operation /// The task result contains the result /// Task AreProductAttributesEqualAsync(string attributesXml1, string attributesXml2, bool ignoreNonCombinableAttributes, bool ignoreQuantity = true); /// /// Check whether condition of some attribute is met (if specified). Return "null" if not condition is specified /// /// Product attribute /// Selected attributes (XML format) /// /// A task that represents the asynchronous operation /// The task result contains the result /// Task IsConditionMetAsync(ProductAttributeMapping pam, string selectedAttributesXml); /// /// Finds a product attribute combination by attributes stored in XML /// /// Product /// Attributes in XML format /// A value indicating whether we should ignore non-combinable attributes /// /// A task that represents the asynchronous operation /// The task result contains the found product attribute combination /// Task FindProductAttributeCombinationAsync(Product product, string attributesXml, bool ignoreNonCombinableAttributes = true); /// /// Generate all combinations /// /// Product /// A value indicating whether we should ignore non-combinable attributes /// List of allowed attribute identifiers. If null or empty then all attributes would be used. /// /// A task that represents the asynchronous operation /// The task result contains the attribute combinations in XML format /// Task> GenerateAllCombinationsAsync(Product product, bool ignoreNonCombinableAttributes = false, IList allowedAttributeIds = null); /// /// Parse a customer entered price of the product /// /// Product /// Form /// /// A task that represents the asynchronous operation /// The task result contains the customer entered price of the product /// Task ParseCustomerEnteredPriceAsync(Product product, IFormCollection form); /// /// Parse a entered quantity of the product /// /// Product /// Form /// Customer entered price of the product int ParseEnteredQuantity(Product product, IFormCollection form); /// /// Parse product rental dates on the product details page /// /// Product /// Form /// Start date /// End date void ParseRentalDates(Product product, IFormCollection form, out DateTime? startDate, out DateTime? endDate); /// /// Get product attributes from the passed form /// /// Product /// Form values /// Errors /// /// A task that represents the asynchronous operation /// The task result contains the attributes in XML format /// Task ParseProductAttributesAsync(Product product, IFormCollection form, List errors); #endregion #region Gift card attributes /// /// Add gift card attributes /// /// Attributes in XML format /// Recipient name /// Recipient email /// Sender name /// Sender email /// Message /// Attributes string AddGiftCardAttribute(string attributesXml, string recipientName, string recipientEmail, string senderName, string senderEmail, string giftCardMessage); /// /// Get gift card attributes /// /// Attributes in XML format /// Recipient name /// Recipient email /// Sender name /// Sender email /// Message void GetGiftCardAttribute(string attributesXml, out string recipientName, out string recipientEmail, out string senderName, out string senderEmail, out string giftCardMessage); #endregion }