Product
Format a decimal to a price using the current currency.
Arguments
Name | Type | Default | Description |
price | decimal | | The price to format excl. VAT. |
storeId | long | _storeId | Id of the store. |
async | boolean | false | Specifies if a request should be asynchronously. |
successfn | function(json[, jQForm]) | | A function to be called if the request succeeds. |
errorfn | function(json) | | A function to be called if the request fails. |
Return values
Type | Description |
price | A price object. |
Example
Arguments
Name | Type | Description |
storeId | long | Id of the store. |
price | decimal | The price to format excl. VAT. |
Return values
Type | Description |
Price | A price object. |
Example
GetPrice
Gets a price for a specific product in the current currency.
Arguments
Name | Type | Default | Description |
productIdentifier | string | | A unique identifier of the product. E.g. the node id from Umbraco. |
storeId | long | _storeId | Id of the store. |
async | boolean | false | Specifies if a request should be asynchronously. |
successfn | function(json[, jQForm]) | | A function to be called if the request succeeds. |
errorfn | function(json) | | A function to be called if the request fails. |
Return values
Type | Description |
price | A price object. |
Example
Arguments
Name | Type | Description |
storeId | long | Id of the store. |
productIdentifier | string | A unique identifier of the product. E.g. the node id from Umbraco. |
Return values
Type | Description |
Price | A price object. |
Example
Example - Variant
GetStock
Gets the current stock for a specific product.
Arguments
Name | Type | Default | Description |
productIdentifier | string | | A unique identifier of the product. E.g. the node id from Umbraco. |
storeId | long | _storeId | Id of the store. |
async | boolean | false | Specifies if a request should be asynchronously. |
successfn | function(json[, jQForm]) | | A function to be called if the request succeeds. |
errorfn | function(json) | | A function to be called if the request fails. |
Return values
Type | Description |
float | The stock of the product. Will be null if no stock have been provided for this product. |
Example
Arguments
Name | Type | Description |
storeId | long | Id of the store. |
productIdentifier | string | A unique identifier of the product. E.g. the node id from Umbraco. |
Return values
Type | Description |
decimal? | The stock of the product. Will be null if no stock have been provided for this product. |
Example
GetVariant
Returns a single variant from a product node. The product must have a property with the Tea Commerce: Variant Editor property editor on it. Also you should enter the alias of the document type property on the Store in the Tea Commerce section.
Arguments
Name | Type | Description |
storeId | long | Id of the store. |
model | IPublishedContent | A product. |
variantId | string | Id of the variant. |
onlyValid | bool? | Will remove all variants that does not validate from the result set. A variant does not validate when there's problems with the combination of variant types. |
Return values
Type | Description |
VariantPublishedContent | A special IPublishedContent representation of a variant. |
Example
GetVariants
Returns a a list of variants from a product node. The product must have a property with the Tea Commerce: Variant Editor property editor on it. Also you should enter the alias of the document type property on the Store in the Tea Commerce section.
Arguments
Name | Type | Description |
storeId | long | Id of the store. |
storeId | IPublishedContent | A product. |
onlyValid | bool? | Will remove all variants that does not validate from the result set. A variant does not validate when there's problems with the combination of variant types. |
Return values
Type | Description |
IEnumerable<VariantPublishedContent> | A list of special IPublishedContent representations of variants |
Example
GetVariantGroups
Returns a list of variant groups that define the product variants. You can use this list to generate e.g. drop downs for the user to choose his variant combination.
Arguments
Name | Type | Description |
variants | IEnumerable<VariantPublishedContent> | A list of variants. |
Return values
Type | Description |
IEnumerable<VariantGroup> | A list of the Variant groups and types that define a list of variants. |
Example
GetVariantJson
Returns a json object containing all variants for the product. The data contains information about each variants combination of variant types. Use this data to javascript filter e.g. drop downs when a user/customer selects his variant.
Arguments
Name | Type | Description |
storeId | long | Id of the store. |
model | IPublishedContent | A product. |
onlyValid | bool | Will remove all variants that does not validate from the result set. A variant does not validate when there's problems with the combination of variant types. |
Return values
Type | Description |
string | A json object containing all variants for the product |
Example
Example data
GetPropertyValue
Returns the value of a property on the product. Will traverse the content tree recursively to find the value. Will also use the master relation property of the product to search master products.
Note
If you have a IPublishedContent model use that instead of the string productIdentifier, which is slightly slower.
Arguments 1
Name | Type | Description |
storeId | long | Id of the store. |
productIdentifier | string | A unique identifier of the product. E.g. the node id from Umbraco. |
propertyAlias | string | Alias of the property to find. |
func | Func<IPublishedContent, bool> | A function to filter the recursive call. |
Arguments 2
Name | Type | Description |
storeId | long | Id of the store. |
model | IPublishedContent | A product. |
propertyAlias | string | Alias of the property to find. |
variantId | string | Guid id of the variant. |
func | Func<IPublishedContent, bool> | A function to filter the recursive call. |
Return values
Type | Description |
T | The value of the property in the type you want. |
Example 1
Example 2
Example 3 - variant
Last Updated: 9/2/2019, 10:22:34 AM