EVGProduct Class Reference

Inherits from EVGCategorizedItem : EVGItem : NSObject
Declared in EVGItems.h

Overview

A product is an item that can be sold to users. Products can be added to EVGLineItem objects when they have been ordered by the user.

See productWithId:name:price:url:imageUrl:evgDescription:

Initialization

Here is an example of EVGProduct initialization:

EVGProduct *product = [EVGproduct productWithId:@"B25787"
                                           name:@"Road Runners"
                                          price:@110.00
                                            url:@"http://www.shoes4u.com/us/road-runners/B25787.html"
                                       imageUrl:@"http://www.shoes4u.com/us/road-runners/B25787.png"
                                 evgDescription:@"Road Runners shoes are great for running!"];

  price

The unit price of the product. This is required when the product is being ordered but optional otherwise. For instance, if the product has variable pricing there may be no correct price for [EVGContext viewItem:] events.

@property (nullable, nonatomic, strong) NSNumber *price

Declared In

EVGItems.h

  priceDescription

Optional field for descriptive text for the price, e.g. ‘Sale Price’.

@property (nullable, nonatomic, copy) NSString *priceDescription

Declared In

EVGItems.h

  listPrice

Optional field for capturing e.g. MSRP in order to illustrate discount.

@property (nullable, nonatomic, strong) NSNumber *listPrice

Declared In

EVGItems.h

  currency

An ISO 4217 currency code for the currency of this item’s price such as "USD", "EUR", "GBP". If absent, the currency is assumed to be the dataset default currency.

@property (nullable, nonatomic, copy) NSString *currency

Declared In

EVGItems.h

  inventoryCount

A count of available units. Alternatively, this may be simply 1 or 0 to indicate available or unavailable, respectively.

@property (nullable, nonatomic, strong) NSNumber *inventoryCount

Declared In

EVGItems.h

  alternateId

An identifier for a product other than the one stored in evgId.

@property (nullable, nonatomic, copy) NSString *alternateId

Declared In

EVGItems.h

+ productWithId:

Builds an EVGProduct with the required id only.

+ (nonnull instancetype)productWithId:(nonnull NSString *)evgId

Parameters

evgId

See [EVGItem evgId]. This is the only required field.

Return Value

A product which can be further modified.

Declared In

EVGItems.h

+ productWithId:name:price:url:imageUrl:evgDescription:

Builds an EVGProduct, including many of the commonly used fields. This method only builds a data object. To use it, pass it to one of the tracking methods like [EVGContext viewItem:].

+ (nonnull instancetype)productWithId:(nonnull NSString *)evgId name:(nullable NSString *)name price:(nullable NSNumber *)price url:(nullable NSString *)url imageUrl:(nullable NSString *)imageUrl evgDescription:(nullable NSString *)evgDescription

Parameters

evgId

See [EVGItem evgId]. This is the only required field.

name

The name of the product. It should be provided whenever possible.

price

The unit price of the product. This is required when the product is being ordered but optional otherwise. For instance, if the product has variable pricing there may be no correct price for -viewItem: events.

url

A URL where the user can view information about the product.

imageUrl

A URL containing an image of the product.

evgDescription

A text description of the product.

Return Value

A product which can be further modified.

Declared In

EVGItems.h

+ productFromJSONDictionary:

Creates an EVGProduct from the provided JSON.

+ (nullable instancetype)productFromJSONDictionary:(nonnull NSDictionary<NSString*,id> *)json

Parameters

json

A product in JSON form

Return Value

A product which can be further modified, or nil if JSON is invalid

Declared In

EVGItems.h