Displaying the shopping cart preview on pages

The shopping cart preview is a part of the website pages where you display, for example, the price of all products in the current shopping cart, and which serves as a hyperlink to the shopping cart from the whole on-line store.

The shopping cart preview

To add the shopping cart preview, use the Static text web part and combination of macros according to your requirements. This page provides a guideline on how to set up the shopping cart preview.

Configuring the shopping cart preview

To display the preview on pages, place the Static text web part on the main page of the template that should display the preview. Then, write the macros which display the information you want.

  1. Open the Pages application.
  2. Select the main page of the template that should display the preview (for example, the homepage of your website or the main page of your store).
  3. Switch to the Design tab.
  4. Place the Static text web part on the page.
  5. Enter the desired properties.
  6. Click Save & Close.

Your website now displays the shopping cart preview.

Suitable macros for creating the shopping cart preview

Total price of the shopping cart

To display the total price of products in the shopping cart, use the following macro:

{% FormatPrice(ECommerceContext.CurrentShoppingCart.TotalItemsPrice)|(resolver)WebPartRender %}

Since you need to delay the resolving of the macros, do not forget to include the |(resolver) parameter in the macro. Otherwise, it will not display the correct information.

Total units of the products in the shopping cart

To display the total units of all products in the shopping cart, use the following macro:

{% ECommerceContext.CurrentShoppingCart.TotalUnits|(resolver)WebPartRender %}

Since you need to delay the resolving of the macros, do not forget to include the |(resolver) part of the macro. Otherwise, it will not display the correct information.

The shopping cart URL

To get the URL of the current site's shopping cart, use the following macro:

{% Settings.CMSShoppingCartURL %}

The macro gets the value from the settings. To change the shopping cart URL:

  1. Open the Store configuration application (if you want to set the URL for the current site) or the Multistore configuration application (if you want to set the URL globally).
  2. On the Store settings -> General tab in the Pages category, type the URL in the Shopping cart URL field.

    Use the tilde character (~) in the URL. For example: ~/Store/Shopping-cart

    • If you are in the Store configuration application, clear the Inherit from global settings option first.
       
  3. Click Save.

The system now returns the specified address when you use the Settings.CMSShoppingCartURL macro.

Similarly, you can set and use the URL for the My account/My profile page and the Wishlist page:

The My account URL

{% Settings.CMSMyAccountURL %}

In the Store configuration application (the Multistore configuration application respectively), type the URL in the My account URL field.

The Wishlist URL

{% Settings.CMSWishlistURL %}

In the Store configuration application (the Multistore configuration application respectively), type the URL in the Wishlist URL field.


Was this page helpful?