Show If server behavior
The Show If server behavior displays content on a page dependent on whether the cart is or is not empty.
It is applied to the shopping cart display automatically when it is created using the eCart Display Manager. The shopping cart is configured to display when the shopping cart is not empty.
As well, default HTML is provided, specific to the cart design style, that states "The cart is empty." This HTML is displayed when there are no items in the cart.
Accessing this server behavior for a shopping cart display created using the eCart Display Manager allows you to update this HTML displayed specific to your own needs.
This server behavior can also be applied to any specified HTML region, as well as server-side code. It proves useful for displaying a region conditional to the state of the shopping cart, such as:
It is applied to the shopping cart display automatically when it is created using the eCart Display Manager. The shopping cart is configured to display when the shopping cart is not empty.
As well, default HTML is provided, specific to the cart design style, that states "The cart is empty." This HTML is displayed when there are no items in the cart.
Accessing this server behavior for a shopping cart display created using the eCart Display Manager allows you to update this HTML displayed specific to your own needs.
This server behavior can also be applied to any specified HTML region, as well as server-side code. It proves useful for displaying a region conditional to the state of the shopping cart, such as:
- Displaying buttons - Display Quick Cart display buttons (e.g. checkout, view cart) only when there are items in the shopping cart
- Displaying text - display information to the user applicable to the whether the cart does or does not contain items (e.g. "Your current cart total is X." or "Your cart is empty.").
To apply the eCart Show If server behavior:
- On your page, select the display area that will be controlled by the Show If server behavior.
- In the Server Behaviors panel group, click the Plus button and select eCart > Cart Display > Show Region If.
- Select the Cart name for the eCart Object specific to your shopping cart implementation. This can only be changed if multiple eCart Objects for different shopping cart implementations are applied to the page. .
- Select whether you wish the selected display area to be shown if the cart is empty, or is not empty.
- Specify the HTML or server-side code to be displayed/run if the state of the cart does not correspond to your selection in step 3.
If you leave this field blank, the selected display region will not be replaced.
Note: Ensure that the display area to which the server behavior is applied coincides with the format used in this field. For example, if you selected a <td> tag as the display area, be sure the replacement information contains a <td> tag to ensure that the HTML is rendered correctly. - Click OK to apply the server behavior to the page.