CartViewModel

Overview

Any time you view the cart in the front end of the store, a CartViewModel is primarily used to render that view. This article will help you understand what's available to you in the view model.

Requirements

The following pre-requisites will be necessary to accomplish the goals of this article:

  • General understanding of template engines
  • Understanding HTML, CSS, JavaScript
  • Familiarity with template languages
  • Familiarity with ASP.NET MVC Razor

Getting Started

There are no tasks needed to get started with understanding this object. 

CartViewModel

The CartViewModel object will contain all of the details of a single instance of a cart (or a pending order) in your Hotcakes Commerce store.

Members

The following table gives you details on the various members of the CartViewModel object.  The descriptions are based upon default functionality and the default Viewset included with Hotcakes.

Member Type Description
CartEmpty Bool

A flag that indicates whether cart is empty or not. This flag can be used by the cart controller when there is no item on cart or all cart items are free items.

CurrentOrder Order The order object that is bound to this cart. This may be a temporary order entry whenever new items are added to the cart.
DisplaySubItem String If something needs to be shown as Sub tile below the Shopping cart then it can be set through this parameter.  This property is currently not used anywhere in the system and may be depreciated.
DisplayTitle String User friendly name shown on the page for the cart.  This property is currently not used anywhere in the system and may be depreciated.
ItemListTitle String An optional title property that can be used to display text in your views. This is currently only used in the Minicart but is never populated. This property will likely become depreciated.
KeepShoppingUrl String The URL associated to the KeepShopping button in the cart views. The system has a URL rewrite module configured, so it may be a custom URL mapped to different actions. 
LineItems List<CartLineItemViewModel> This property shows the collection of the line items in the cart.
PayPalExpressAvailable Bool This is a quick check to see if PayPal Express is enabled or not. Whenever a cart is initialized, this will be true if you have PayPal Express enabled in the store administration area.
Rates List<ShippingRateDisplay> List of shipping rates needs to be shown based on the user address and other shipping method criteria on products.

 

Have more questions? Submit a request

Need More Help?

Do you need more assistance with this article? Please review your support options.