The SingleProductViewModel is the primary model used to display a single product in various views 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 SingleProductViewModel 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 SingleProductViewModel object. The descriptions are based on default functionality and the default Viewset included with Hotcakes.
|ImageUrls||ProductImageUrls||This property is populated with all of the information for the primary product image, including the various URL's and alternate text.|
|Item||Product||This property will have a full Product object so that you may easily access any of the product information that's not already present in this object.|
|ProductAddToCartLink||String||If not an empty string, the current product can be added to the cart in a single click and this value will be the URL to do that.|
|ProductLink||String||This is the permanent URL to the product details page for the current product.|
|SwatchDisplay||String||If swatches are found for the product, they will be contained here in HTML format, ready to be rendered in the view.|
|UserPrice||UserSpecificPrice||This is the current pricing information for the product, based upon all sales and user specific pricing that may apply at the moment. For example, the price may be a certain value when the visitor is anonymous. Then, it could potentially be higher or lower once they log in, based upon price groups, promotions, etc.|