Application providing the shopping cart and checkout used to purchase products, including those opted into reward programs and paid for with accumulated points. Registers the shopping cart, checkout form and purchased-products KEditor components, calculates promotional discounts and gifts against the items in a cart, and exposes cart and order lookups (such as counts of unfulfilled orders) used by admin and website templates. It is reached from Java and templates through the application context as ShoppingCartApp, and is required by other apps, such as Products and Rewards, that allow purchases.
Implements: Application, MenuApplication, ChildPageApplication, PortletApplication, TemplatingApplication, ComponentApplication, DependentApplication, SettingsApplication
Properties
| Property | Returns | Description |
|---|---|---|
| cashTopupsEnabled | boolean | Whether cash topups are enabled for the current organisation and website branch, resolved from the current request's root folder. |
| countOfOrders | Long | Returns orders created between the common start and end dates |
| instanceId | String | Unique identifier this application is registered under. |
| paymentApp | PaymentProviderApplication | Finds the active application that provides payment processing for the current organisation. |
| roles | List<Role> | Security roles this application registers. The shopping cart application does not register any roles of its own. |
| unfulfilledOrders | Long | Number of orders that have not yet been fulfilled, for the current organisation. |
| userPromoCodes | List<String> | Promo codes provided by the current user, read from the "promoCodes" request parameter if present, otherwise from the "promoCodes" cookie. |
Methods
registerCurrency(Currency currency) · getInstanceId() · getRoles() · getDescription(ShoppingCartBean shoppingCartBean) · getDescription(Cart cart) · isCashTopupsEnabled() · isCashTopupsEnabled(Organisation org, Branch websiteBranch) · getPaymentApp() · calcPromotionalItems(List<ShoppingCartItemBean> shoppingCartItemBeans) · getUserPromoCodes() · getUnfulfilledOrders() · getCountOfOrders() · searchCarts(String fulfilment, int max, String query)
registerCurrency(Currency currency)
Returns: void
Registers a currency for use by the shopping cart, keyed by its currency id.
| Parameter | Description |
|---|---|
currency | the currency to register |
getInstanceId()
Returns: String
Unique identifier this application is registered under.
getRoles()
Returns: List<Role>
Security roles this application registers. The shopping cart application does not register any roles of its own.
getDescription(ShoppingCartBean shoppingCartBean)
Returns: String
Get a description of the items in the cart.
| Parameter | Description |
|---|---|
shoppingCartBean | the cart bean to describe |
getDescription(Cart cart)
Returns: String
Get a description of the items in the cart.
| Parameter | Description |
|---|---|
cart | the cart to describe |
isCashTopupsEnabled()
Returns: boolean
Whether cash topups are enabled for the current organisation and website branch, resolved from the current request's root folder.
isCashTopupsEnabled(Organisation org, Branch websiteBranch)
Returns: boolean
Whether cash topups are enabled for the given organisation and website branch. When a website branch is given the setting is read from the branch, otherwise it is read from the organisation.
| Parameter | Description |
|---|---|
org | the organisation to check the setting for |
websiteBranch | the website branch to check the setting for, or null to check the organisation-level setting |
getPaymentApp()
Returns: PaymentProviderApplication
Finds the active application that provides payment processing for the current organisation.
calcPromotionalItems(List<ShoppingCartItemBean> shoppingCartItemBeans)
Returns: List<IPromotionItem>
Look for all active promotions (aka rewards) and compile a list of items
| Parameter | Description |
|---|---|
shoppingCartItemBeans | the items currently in the cart, checked against each active reward's discount and gift conditions |
getUserPromoCodes()
Returns: List<String>
Promo codes provided by the current user, read from the "promoCodes" request parameter if present, otherwise from the "promoCodes" cookie.
getUnfulfilledOrders()
Returns: Long
Number of orders that have not yet been fulfilled, for the current organisation.
getCountOfOrders()
Returns: Long
Returns orders created between the common start and end dates
searchCarts(String fulfilment, int max, String query)
Returns: List<Cart>
Searches for carts matching the given fulfilment status, up to a maximum number of results.
| Parameter | Description |
|---|---|
fulfilment | the fulfilment status to filter by, or null to match any status |
max | the maximum number of results to return |
query | free text to search for, or null to not filter by text |