EVGProduct Class Reference

Inherits fromDeclared in
EVGCategorizedItem : EVGItem : NSObjectEVGItems.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.

For more information, see productWithId:name:price:url:imageUrl:evgDescription:

Initialization 

Here is an example of EVGProduct initialization:

1EVGProduct *product = [EVGproduct productWithId:@"B25787"
2                                           name:@"Road Runners"
3                                          price:@110.00
4                                            url:@"http://www.shoes4u.com/us/road-runners/B25787.html"
5                                       imageUrl:@"http://www.shoes4u.com/us/road-runners/B25787.png"
6                                 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.

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

priceDescription 

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

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

listPrice 

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

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

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.

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

inventoryCount 

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

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

alternateId 

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

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

productWithId: 

Builds an EVGProduct with the required id only.

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

Parameters

ParameterDescription
evgIdSee [EVGItem evgId]. This is the only required field.

Return Value

A product which can be further modified.

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:].

1+ (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

ParameterDescription
evgIdSee [EVGItem evgId]. This is the only required field.
nameThe name of the product. It should be provided whenever possible.
priceThe 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.
urlA URL where the user can view information about the product.
imageUrlA URL containing an image of the product.
evgDescriptionA text description of the product.

Return Value

A product which can be further modified.

productFromJSONDictionary: 

Creates an EVGProduct from the provided JSON.

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

Parameters

ParameterDescription
jsonA product in JSON form

Return Value

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