Product

Extends Object. Product objects appear throughout an Evance shop and support a number of product types - primarily physical or virtual/digital goods. A "product" variable containing a Product object is automatically instantiated on URLs governed by the product controller. 

<body>
    <div>
        <h1>{{ product.title }}</h1>
    </div>
</body>

You can gain access to any product within your shop when creating a new Product instance.

<body>
    <div>
        <h1>{{ product.title }}</h1>
    </div>
    
    <?ev var productA = new Product('/product/product-a'); ?>
    
    <h2>{{ productA.title }}</h2>
    <p>{{ productA.description }}</p>
</body>

Note: hard coding URLs in this manner can be open to error if URLs don't exist. If however the URL for a product did exist, but a user changed it within Product settings, Evance will attempt to load the product from its historical URL. It is however very unusual to load a single product in this manner.

Instantiation

Accessing any Product in your shop can be achieved from anywhere within your website and not just from a Product governed page. This can be done by instantiating a new Product object and supplying the page's URL or ID:


<?ev
    // new Product() class method
    var product = new Product('/product/path-to-product');
?>

Construct parameters
reference

Type String, Url or Number

The page reference is either a String/Url representing the URL relative to root or a Number representing the product.id. 

For international and multi-lingual sites you should use the default URL as the reference for the product and not the localised version. Evance will automatically correct the URL format for you once the Product object is retrieved.



Properties
allowEnquiries

Type Boolean

True if visitors may add this product to cart to enquire, else false.

allowPreOrders

Type Boolean

True if the product may be ordered even when product.isOutOfStock, else false.

averageRating

Type Number

The average review rating across totalReviews for the product.

barcode

Type String

The EAN barcode number for the product. If set this number should be compatible with the <ev:barcode> EV Tag, which is able to render barcodes as a PNG. 

canAddToCart

Type Boolean

True if visitors may add the product to their shopping cart for either purchase or enquiry, else false. This takes into account whether the all of the statuses for the product allow the product to be purchased or enquired upon.

categories

Type CategoryCollection

A collection of categories the product belongs to in order as they appear within the category manager.

condition

Type String

The condition of the product will be one of the following:

  • new
  • used
  • refurbished
created

Type Date

The date the product was added into the database.

description

Type String

The short description for the product.

discontinued

Type Date

The date a product was discontinued on.

discontinuedReason

Type String

A discontinuation message.

discount

Type PriceDiscount

The value of the saving between listPrice and current price.

discountPercentage

Type Number

The percentage saving between listPrice and current price to the nearest whole number.

expires

Type Date

The date the product will expire and will not longer be available online.

hasPrice

Type Boolean

True if product has a price set and is not null - set to Price Only Application (POA).

hasReviews

Type Boolean

True if reviews are enabled the totalReviews is greater than zero.

id

Type Number

The system's unique' ID for the product. The System ID is not sequential to an accout therefore the system ID is used for code reference (e.g. addition to cart) and is not used for visual reference. For human readable or visual reference please use either product.quickfind or product.sku .

includesTax

Type Boolean

True if the product price includes tax, else false. This is subject to the tax rule for the current visitor and is regardless of the setting for the product price within Evance

isAdvancedVariant

Type Boolean

True if the product is linked as a variant of a master product, but is also a product in its own right.

isBasicVariant

Type Boolean

True if the product is a basic variant of a master product.

isBuy

Type Boolean

True if the product's price mechanism is set to purchase rather than hire, else false.

isBuyable

Type Boolean

True if the product's price mechanism is set to purchase rather than hire and the product's statuses allow it to be purchased online, else false.

isDiscontinued

Type Boolean

True if the product has been discontinued, else false.

isEnquiryOnly

Type Boolean

True if the product is not purchasable but may be added to cart as an enquiry, else false.

isFromPrice

Type Boolean

True if the current price for the product is the lowest in its class. For example if a product has a cheaper price when ordering 5 or more the cheapest price will be shown due to volume pricing.

isHire

Type Boolean

True if the product's price mechanism is set to hire rather than purchase, else false.

isHirable

Type Boolean

True if the product's price mechanism is set to hire rather than purchase and the product may be hired online, else false.

isLowStock

Type Boolean

True if the product has warehouse stock tracking enabled and has a stock level less than or equal to product.lowStockLevel, else false.

isOffer

Type Boolean

True if the product's current product.price is lower than the product.listPrice, else false.

isOutOfStock

Type Boolean

True if the product has warehouse stock tracking enabled and has a stock level of zero across all warehouses, else false.

isStocked

Type Boolean

True if the product has warehouse stock tracking enabled, else false. Note that isStocked will be true even if a product's stock is depleted.

isSubscribable

Type Boolean

True if the product's price mechanism is set to subscription and the product is purchasable online.

isSubscription

Type Boolean

True if the product's price mechanism is set to subscription.

isSuperseded

Type Boolean

True if the product has been discontinued and superseded by another product, else false.

listPrice

Type Price

The standard list price for the product excluding offers or discounts.

lowStockLevel

Type Number

Show a low level alert to visitors (i.e. Limited availability) when stock levels reach this Number or less.

manufacturer

Type String

The name of the manufacturer of the product (e.g. Apple).

maxDispatchDate

Type Date

The latest the merchant is estimated to be able to dispatch this product (usually when out of stock). Does not include delivery time.

maxLeadTime

Type Number

The maximum number of days it takes to dispatch this item to the customer (usually when the product is out of stock). Does not include delivery time.

maxOrderQuantity

Type Number

The maximum quantity that may be ordered per order.

metaDescription

Type String

The product page's meta description.

metaKeywords

Type String

The product page's meta keywords.

metaTitle

Type String

The product page's meta/browser title.

minDispatchDate

Type Date

The soonest the merchant is estimated to be able to dispatch this product (usually when in stock). Does not include delivery time.

minLeadTime

Type Number

The minimum number of days it takes to dispatch this item to the customer (usually when the product is in stock). Does not include delivery time.

minOrderQuantity

Type Number

The minimum quantity that may be ordered per order.

minUnits

Type Number

The minimum number of product.priceUnit per order.

model

Type String

The manufacturer's product model (e.g. Apple iPhone 5S where Apple is the manufacturer and iPhone is the range and 5S is the model).

modified

Type Date

The date the product was last modified.

partNumber

Type String

The manufacturer's part number for the product, which may be different to the shop's SKU.

price

Type Price

The current price for the product including offers or discounts.

priceId

Type Number

The System ID for the current price associated with the product. The current price is calculated as the lowest available price for the visitor.

priceMechanism

Type String

The active price mechanism, which may either be buy, hire or subscription.

priceQuantity

Type Number

The order quantity at which the current price is applicable. This may be higher than one if the merchant has quantity based pricing.

priceSuffix

Type String

The the string to be shown after a price e.g. +VAT. This automatically knows whether to use an inclusive or exclusive of tax suffix subject to the current session tax rule.

priceType

Type String

The the price mechanism used by this product, which may be:

  • buy
  • hire
priceUnit

Type String

The units of measurement for the product pricing. This may currently be:

  • each
  • day
  • week
  • month
  • year
published

Type Date

The date the product was published and became visible online.

quickfind

Type Number

The sequential ID for the product for the Account. Because quickfind codes are sequential, but not unique they are only used for search/visual representation. They should not be used for code references (e.g. when adding a product to cart). For code reference please use product.id.

range

Type String

The manufacturer's product range (e.g. Apple iPhone 5S where Apple is the manufacturer and iPhone is the range and 5S is the model).

rrp

Type Price | null

The "Recommended Retail Price" of the product.

sku

Type String

The "Stock Keeping Unit" is a unique user specified code for the product and is used for tracking stock of a product.

stock

Type Number

The total available stock across all warehouses.

suspendOnDepletion

Type Boolean

True if the product may not be ordered when product.isOutOfStock, else false.

thumbnail

Type Url

The thumbnail Url chosen to represent the Product. This is called thumbnail for historic reasons, but may be of any size. The thumbnail is generally shown on the parent category page and will be the image selected for the primary media entry for the product.

title

Type String

The title for the product.

totalReviews

Type Number

The total number of reviews for the product.

url

Type Url

The URL of the Product. If you have an international website this Url will represent the current Locale of your website.



Methods
canAddReview()

Returns Boolean

True if the user is logged is allow to add a review.

categories()

Returns CategoryCollection

The list of Categories the product belongs to.

customisations()

Returns Array

An array containing ProductCustomisation groups and options. Product customisation allows visitors to customise a product for example engraving on a watch.

downloads()

Returns Array

Gets an array of available downloads for the product. Each element in the Array returned contains a ProductDownload object.

hasVolumePricing()

Returns Boolean

True if the product has order quantity/volume based pricing.

media()

Returns Array

Gets an array of available photos, videos or 360°s for the product. Each element in the Array returned contains a ProductMedia object.

priceOptions()

Returns Array

Gets an array of available price options for the current visitor based on available price Units. Each element in the Array returned contains a ProductPrice object. For example you may have a product that may be hired based on a monthly or annual rate.

prices()

Returns Array

Gets an array of available prices for the current visitor. Each element in the Array returned contains a ProductPriceobject.

related()

Returns ProductCollection

A list of related products in the order specified within the Evance product manager.

relatedByManufacturer()

Returns ProductSearch

Returns a ProductSearch pre-built to find products with the same manufacturer excluding itself.

relatedByRange()

Returns ProductSearch

Returns a ProductSearch pre-built to find products with the same manufacturer and in the same manufacturer's range, excluding itself.

share()

Returns PageSharer

Returns the PageSharer object, which allows you to build social media share links using the product's data.

specifications()

Returns Array

Gets the list of specifications assigned to the product. Each element within the Array contains a ProductSpecification object.

supersededBy()

Returns Product | null

If the product is discontinued and has been superseded by an alternative Product returns the available alternative Product, else null.

template()

Returns Template | null

Retrieves the available template settings for the current product, else null.

toString()

Returns String

Returns the product title as the string representation of the product.

variants()

Returns ProductCollection

Gets a list of available variants for the current product (must be the master product).

variations()

Returns Array

Gets a list of available variations for the current product. Each element within the Array contains a ProductVariation object.

volumePricing()

Returns Object

The Object returned has properties based on priceUnit e.g. product.volumePricing().each. Each property contains an Array of ProductPrice objects.