|
1 |
| -using System.Collections.Generic; |
2 |
| -using Nop.Core.Domain.Catalog; |
3 |
| - |
4 |
| -namespace Nop.Services.Catalog |
5 |
| -{ |
6 |
| - /// <summary> |
7 |
| - /// Product attribute parser interface |
8 |
| - /// </summary> |
9 |
| - public partial interface IProductAttributeParser |
10 |
| - { |
11 |
| - #region Product attributes |
12 |
| - |
13 |
| - /// <summary> |
14 |
| - /// Gets selected product attribute mappings |
15 |
| - /// </summary> |
16 |
| - /// <param name="attributesXml">Attributes in XML format</param> |
17 |
| - /// <returns>Selected product attribute mappings</returns> |
18 |
| - IList<ProductAttributeMapping> ParseProductAttributeMappings(string attributesXml); |
19 |
| - |
20 |
| - /// <summary> |
21 |
| - /// Get product attribute values |
22 |
| - /// </summary> |
23 |
| - /// <param name="attributesXml">Attributes in XML format</param> |
24 |
| - /// <param name="productAttributeMappingId">Product attribute mapping identifier; pass 0 to load all values</param> |
25 |
| - /// <returns>Product attribute values</returns> |
26 |
| - IList<ProductAttributeValue> ParseProductAttributeValues(string attributesXml, int productAttributeMappingId = 0); |
27 |
| - |
28 |
| - /// <summary> |
29 |
| - /// Gets selected product attribute values |
30 |
| - /// </summary> |
31 |
| - /// <param name="attributesXml">Attributes in XML format</param> |
32 |
| - /// <param name="productAttributeMappingId">Product attribute mapping identifier</param> |
33 |
| - /// <returns>Product attribute values</returns> |
34 |
| - IList<string> ParseValues(string attributesXml, int productAttributeMappingId); |
35 |
| - |
36 |
| - /// <summary> |
37 |
| - /// Adds an attribute |
38 |
| - /// </summary> |
39 |
| - /// <param name="attributesXml">Attributes in XML format</param> |
40 |
| - /// <param name="productAttributeMapping">Product attribute mapping</param> |
41 |
| - /// <param name="value">Value</param> |
42 |
| - /// <param name="quantity">Quantity (used with AttributeValueType.AssociatedToProduct to specify the quantity entered by the customer)</param> |
43 |
| - /// <returns>Updated result (XML format)</returns> |
44 |
| - string AddProductAttribute(string attributesXml, ProductAttributeMapping productAttributeMapping, string value, int? quantity = null); |
45 |
| - |
46 |
| - /// <summary> |
47 |
| - /// Remove an attribute |
48 |
| - /// </summary> |
49 |
| - /// <param name="attributesXml">Attributes in XML format</param> |
50 |
| - /// <param name="productAttributeMapping">Product attribute mapping</param> |
51 |
| - /// <returns>Updated result (XML format)</returns> |
52 |
| - string RemoveProductAttribute(string attributesXml, ProductAttributeMapping productAttributeMapping); |
53 |
| - |
54 |
| - /// <summary> |
55 |
| - /// Are attributes equal |
56 |
| - /// </summary> |
57 |
| - /// <param name="attributesXml1">The attributes of the first product</param> |
58 |
| - /// <param name="attributesXml2">The attributes of the second product</param> |
59 |
| - /// <param name="ignoreNonCombinableAttributes">A value indicating whether we should ignore non-combinable attributes</param> |
60 |
| - /// <param name="ignoreQuantity">A value indicating whether we should ignore the quantity of attribute value entered by the customer</param> |
61 |
| - /// <returns>Result</returns> |
62 |
| - bool AreProductAttributesEqual(string attributesXml1, string attributesXml2, bool ignoreNonCombinableAttributes, bool ignoreQuantity = true); |
63 |
| - |
64 |
| - /// <summary> |
65 |
| - /// Check whether condition of some attribute is met (if specified). Return "null" if not condition is specified |
66 |
| - /// </summary> |
67 |
| - /// <param name="pam">Product attribute</param> |
68 |
| - /// <param name="selectedAttributesXml">Selected attributes (XML format)</param> |
69 |
| - /// <returns>Result</returns> |
70 |
| - bool? IsConditionMet(ProductAttributeMapping pam, string selectedAttributesXml); |
71 |
| - |
72 |
| - /// <summary> |
73 |
| - /// Finds a product attribute combination by attributes stored in XML |
74 |
| - /// </summary> |
75 |
| - /// <param name="product">Product</param> |
76 |
| - /// <param name="attributesXml">Attributes in XML format</param> |
77 |
| - /// <param name="ignoreNonCombinableAttributes">A value indicating whether we should ignore non-combinable attributes</param> |
78 |
| - /// <returns>Found product attribute combination</returns> |
79 |
| - ProductAttributeCombination FindProductAttributeCombination(Product product, |
80 |
| - string attributesXml, bool ignoreNonCombinableAttributes = true); |
81 |
| - |
82 |
| - /// <summary> |
83 |
| - /// Generate all combinations |
84 |
| - /// </summary> |
85 |
| - /// <param name="product">Product</param> |
86 |
| - /// <param name="ignoreNonCombinableAttributes">A value indicating whether we should ignore non-combinable attributes</param> |
87 |
| - /// <returns>Attribute combinations in XML format</returns> |
88 |
| - IList<string> GenerateAllCombinations(Product product, bool ignoreNonCombinableAttributes = false); |
89 |
| - |
90 |
| - #endregion |
91 |
| - |
92 |
| - #region Gift card attributes |
93 |
| - |
94 |
| - /// <summary> |
95 |
| - /// Add gift card attrbibutes |
96 |
| - /// </summary> |
97 |
| - /// <param name="attributesXml">Attributes in XML format</param> |
98 |
| - /// <param name="recipientName">Recipient name</param> |
99 |
| - /// <param name="recipientEmail">Recipient email</param> |
100 |
| - /// <param name="senderName">Sender name</param> |
101 |
| - /// <param name="senderEmail">Sender email</param> |
102 |
| - /// <param name="giftCardMessage">Message</param> |
103 |
| - /// <returns>Attributes</returns> |
104 |
| - string AddGiftCardAttribute(string attributesXml, string recipientName, |
105 |
| - string recipientEmail, string senderName, string senderEmail, string giftCardMessage); |
106 |
| - |
107 |
| - /// <summary> |
108 |
| - /// Get gift card attrbibutes |
109 |
| - /// </summary> |
110 |
| - /// <param name="attributesXml">Attributes in XML format</param> |
111 |
| - /// <param name="recipientName">Recipient name</param> |
112 |
| - /// <param name="recipientEmail">Recipient email</param> |
113 |
| - /// <param name="senderName">Sender name</param> |
114 |
| - /// <param name="senderEmail">Sender email</param> |
115 |
| - /// <param name="giftCardMessage">Message</param> |
116 |
| - void GetGiftCardAttribute(string attributesXml, out string recipientName, |
117 |
| - out string recipientEmail, out string senderName, |
118 |
| - out string senderEmail, out string giftCardMessage); |
119 |
| - |
120 |
| - #endregion |
121 |
| - } |
122 |
| -} |
| 1 | +using System.Collections.Generic; |
| 2 | +using Nop.Core.Domain.Catalog; |
| 3 | +using Nop.Services.Tax; |
| 4 | + |
| 5 | +namespace Nop.Services.Catalog |
| 6 | +{ |
| 7 | + /// <summary> |
| 8 | + /// Product attribute parser interface |
| 9 | + /// </summary> |
| 10 | + public partial interface IProductAttributeParser |
| 11 | + { |
| 12 | + #region Product attributes |
| 13 | + |
| 14 | + /// <summary> |
| 15 | + /// Gets selected product attribute mappings |
| 16 | + /// </summary> |
| 17 | + /// <param name="attributesXml">Attributes in XML format</param> |
| 18 | + /// <returns>Selected product attribute mappings</returns> |
| 19 | + IList<ProductAttributeMapping> ParseProductAttributeMappings(string attributesXml); |
| 20 | + |
| 21 | + /// <summary> |
| 22 | + /// Get product attribute values |
| 23 | + /// </summary> |
| 24 | + /// <param name="attributesXml">Attributes in XML format</param> |
| 25 | + /// <param name="productAttributeMappingId">Product attribute mapping identifier; pass 0 to load all values</param> |
| 26 | + /// <returns>Product attribute values</returns> |
| 27 | + IList<ProductAttributeValue> ParseProductAttributeValues(string attributesXml, int productAttributeMappingId = 0); |
| 28 | + |
| 29 | + /// <summary> |
| 30 | + /// Gets selected product attribute values |
| 31 | + /// </summary> |
| 32 | + /// <param name="attributesXml">Attributes in XML format</param> |
| 33 | + /// <param name="productAttributeMappingId">Product attribute mapping identifier</param> |
| 34 | + /// <returns>Product attribute values</returns> |
| 35 | + IList<string> ParseValues(string attributesXml, int productAttributeMappingId); |
| 36 | + |
| 37 | + /// <summary> |
| 38 | + /// Adds an attribute |
| 39 | + /// </summary> |
| 40 | + /// <param name="attributesXml">Attributes in XML format</param> |
| 41 | + /// <param name="productAttributeMapping">Product attribute mapping</param> |
| 42 | + /// <param name="value">Value</param> |
| 43 | + /// <param name="quantity">Quantity (used with AttributeValueType.AssociatedToProduct to specify the quantity entered by the customer)</param> |
| 44 | + /// <returns>Updated result (XML format)</returns> |
| 45 | + string AddProductAttribute(string attributesXml, ProductAttributeMapping productAttributeMapping, string value, int? quantity = null); |
| 46 | + |
| 47 | + /// <summary> |
| 48 | + /// Remove an attribute |
| 49 | + /// </summary> |
| 50 | + /// <param name="attributesXml">Attributes in XML format</param> |
| 51 | + /// <param name="productAttributeMapping">Product attribute mapping</param> |
| 52 | + /// <returns>Updated result (XML format)</returns> |
| 53 | + string RemoveProductAttribute(string attributesXml, ProductAttributeMapping productAttributeMapping); |
| 54 | + |
| 55 | + /// <summary> |
| 56 | + /// Are attributes equal |
| 57 | + /// </summary> |
| 58 | + /// <param name="attributesXml1">The attributes of the first product</param> |
| 59 | + /// <param name="attributesXml2">The attributes of the second product</param> |
| 60 | + /// <param name="ignoreNonCombinableAttributes">A value indicating whether we should ignore non-combinable attributes</param> |
| 61 | + /// <param name="ignoreQuantity">A value indicating whether we should ignore the quantity of attribute value entered by the customer</param> |
| 62 | + /// <returns>Result</returns> |
| 63 | + bool AreProductAttributesEqual(string attributesXml1, string attributesXml2, bool ignoreNonCombinableAttributes, bool ignoreQuantity = true); |
| 64 | + |
| 65 | + /// <summary> |
| 66 | + /// Check whether condition of some attribute is met (if specified). Return "null" if not condition is specified |
| 67 | + /// </summary> |
| 68 | + /// <param name="pam">Product attribute</param> |
| 69 | + /// <param name="selectedAttributesXml">Selected attributes (XML format)</param> |
| 70 | + /// <returns>Result</returns> |
| 71 | + bool? IsConditionMet(ProductAttributeMapping pam, string selectedAttributesXml); |
| 72 | + |
| 73 | + /// <summary> |
| 74 | + /// Finds a product attribute combination by attributes stored in XML |
| 75 | + /// </summary> |
| 76 | + /// <param name="product">Product</param> |
| 77 | + /// <param name="attributesXml">Attributes in XML format</param> |
| 78 | + /// <param name="ignoreNonCombinableAttributes">A value indicating whether we should ignore non-combinable attributes</param> |
| 79 | + /// <returns>Found product attribute combination</returns> |
| 80 | + ProductAttributeCombination FindProductAttributeCombination(Product product, |
| 81 | + string attributesXml, bool ignoreNonCombinableAttributes = true); |
| 82 | + |
| 83 | + /// <summary> |
| 84 | + /// Generate all combinations |
| 85 | + /// </summary> |
| 86 | + /// <param name="product">Product</param> |
| 87 | + /// <param name="ignoreNonCombinableAttributes">A value indicating whether we should ignore non-combinable attributes</param> |
| 88 | + /// <returns>Attribute combinations in XML format</returns> |
| 89 | + IList<string> GenerateAllCombinations(Product product, bool ignoreNonCombinableAttributes = false); |
| 90 | + |
| 91 | + #endregion |
| 92 | + #region taxAttribute |
| 93 | + /// <summary> |
| 94 | + /// Adds tax subdivision to existing attributesXml |
| 95 | + /// </summary> |
| 96 | + /// <param name="attributesXml">Attributes in XML format</param> |
| 97 | + /// <param name="taxSummary">Set Product tax subdivision</param> |
| 98 | + /// <returns>Updated result (XML format)</returns> |
| 99 | + string AddTaxAttribute(string attributesXml, TaxSummary taxSummary); |
| 100 | + |
| 101 | + /// <summary> |
| 102 | + /// Parse ProductAttributesTax |
| 103 | + /// </summary> |
| 104 | + /// <param name="attributesXml">Attributes in XML format</param> |
| 105 | + /// <returns>SortedDictionary with vatRate and vatRateWeight</returns> |
| 106 | + SortedDictionary<decimal, decimal> ParseTaxAttribute(string attributesXml); |
| 107 | + #endregion |
| 108 | + |
| 109 | + #region Gift card attributes |
| 110 | + |
| 111 | + /// <summary> |
| 112 | + /// Add gift card attrbibutes |
| 113 | + /// </summary> |
| 114 | + /// <param name="attributesXml">Attributes in XML format</param> |
| 115 | + /// <param name="recipientName">Recipient name</param> |
| 116 | + /// <param name="recipientEmail">Recipient email</param> |
| 117 | + /// <param name="senderName">Sender name</param> |
| 118 | + /// <param name="senderEmail">Sender email</param> |
| 119 | + /// <param name="giftCardMessage">Message</param> |
| 120 | + /// <returns>Attributes</returns> |
| 121 | + string AddGiftCardAttribute(string attributesXml, string recipientName, |
| 122 | + string recipientEmail, string senderName, string senderEmail, string giftCardMessage); |
| 123 | + |
| 124 | + /// <summary> |
| 125 | + /// Get gift card attrbibutes |
| 126 | + /// </summary> |
| 127 | + /// <param name="attributesXml">Attributes in XML format</param> |
| 128 | + /// <param name="recipientName">Recipient name</param> |
| 129 | + /// <param name="recipientEmail">Recipient email</param> |
| 130 | + /// <param name="senderName">Sender name</param> |
| 131 | + /// <param name="senderEmail">Sender email</param> |
| 132 | + /// <param name="giftCardMessage">Message</param> |
| 133 | + void GetGiftCardAttribute(string attributesXml, out string recipientName, |
| 134 | + out string recipientEmail, out string senderName, |
| 135 | + out string senderEmail, out string giftCardMessage); |
| 136 | + |
| 137 | + #endregion |
| 138 | + } |
| 139 | +} |
0 commit comments