The ProductPageViewModel is the primary model used to render the product details view to customers. This article will help you understand what's available to you in the view model.
The following pre-requisites will be necessary to accomplish the goals of this article:
- General understanding of template engines
- Familiarity with template languages
- Familiarity with ASP.NET MVC Razor
There are no tasks needed to get started with understanding this object.
The ProductPageViewModel object will contain all of the details of a single instance of a product in your Hotcakes Commerce store.
The following table gives you details on the various members of the ProductPageViewModel object. The descriptions are based on default functionality and the default Viewset included with Hotcakes.
If reviews are enabled and not overridden at the product level to be disabled, this value will be true. If true, the ability to add reviews will be displayed in the view. Otherwise, the value will be false.
|AlternateImageUrls||List<ProductImageUrls>||This is a listing of all of the additional product image information that the product may have.|
|AuthorizedToEditCatalog||Boolean||If true, the current visitor (user account) has permissions to edit the product catalog. This would include superusers and administrators.|
|BundledItems||List<BundledProductViewModel>||Contains a list of any products that this product may be bundled with. Most often, this will likely be an empty collection.|
|GiftCardAmount||Decimal||If the product is a gift card type, this value will represent the value of the gift card that is being purchased.|
|GiftCardMessage||String||If the product is a gift card type, this value will be the message that the gift card recipient will see.|
|GiftCardPredefinedAmounts||List<Decimal>||If the product is a gift card type, this will be a listing of all of the pre-configured gift card amount values that have been defined in the administration area.|
|GiftCardRecEmail||String||If the product is a gift card type, this value needs to contain a valid e-mail address for the recipient of the gift card.|
|GiftCardRecName||String||If the product is a gift card type, this value needs to contain the name of the recipient of the gift card.|
|ImageUrls||ProductImageUrls||This property contains all of the information for the URL's of the product currently being viewed.|
|InitialQuantity||Integer||This will represent the initial quantity for the product. This is most often 1, but may be changed to something else in the product editing administration view. This will initially be used by the Quantity property.|
|IsAvailableForSale||Bool||This may be true or false, based on the inventory settings for the product.|
|IsAvailableForWishList||Bool||If true, the wish list feature is enabled. Otherwise, this value will be false.|
|IsGiftCard||Bool||This property returns true if the current product is a gift card type. Otherwise, it will be false.|
|LineItemId||Integer||This value will normally be null, but will be populated with a value if the customer clicks a product link from the cart view.|
|LocalProduct||Product||There are numerous properties that aren't immediately available to the main ProductPageViewModel object. All of the other product information and settings can be found in this property.|
|PrerenderedTypeValues||String||If this product is of a custom product type and that type has properties, this will contain a HTML-friendly representation of those properties.|
|Prices||ProductPrices||This property contains various pricing information for the product such as site price, MSRP, and cost.|
|ProductAnalyticsUrl||String||This URL can be used to directly navigate to the product performance view. If empty, the current end-user is not authorized to see and use this view.|
|ProductEditUrl||String||This URL can be used to directly navigate to the product editing view. If empty, the current end-user is not authorized to see and use this view.|
|Quantity||Integer||This is the quantity of the product that the customer wishes to purchase.|
|RelatedItems||List<SingleProductViewModel>||If there are any related products for the current product, they will be contained in this property.|
|Selections||OptionSelections||If the current product has any options/variants, this property will list them all.|
|SocialItem||ISocialItem||This property is only used in instances of Hotcakes running on Evoq Social/Engage. When this is the case, this property will have a JSON value required to render the Evoq features for this product.
OBSOLETE in 03.03.00. Do not use. There is no replacement.
|StockMessage||String||This value will be a localized representation of the product's current inventory status, such as In Stock or Out of Stock.|
|StoreAdminUrl||String||The store administration URL for the dashboard. If empty, the current end-user is not authorized to see and use this view.|
|SwatchHtml||String||If swatches are found for the product, they will be contained here in HTML format, ready to be rendered in the view.|
|UserSuppliedPrice||Decimal||If the product is set to use a user supplied price instead of the standard pricing options, this value will contain the price entered by the customer before adding the product to the cart.|
|ValidationMessage||String||If there are any issues when attempting to add the product to the cart, this property will contain the text explaining why.|