Cart Operation also allows management of ItemLists
that can be used for simple lists of items like wishlists that do not require all of the overhead that goes with a cart.
Lists are primarily used through ItemListOperationEndpoint
and ItemListItemOperationEndpoint
.
The ItemListOperationEndpoint
even exposes a method to add entire lists to a customer’s cart in one call.
REST API access for managing ItemLists
is provided through the following endpoints
ItemListOperationEndpoint: Provides management of ItemLists
ItemListItemOperationEndpoint: Provides management of ItemListItems
Service responsible for managing actions against ItemLists
.
ItemLists
keep a list of ItemListItems
and attributes.
ItemListItems
contain a SKU reference, quantity, basic attributes, and any relevant attribute choice values such as for the color and size of a t-shirt that a customer configured.
ItemLists
can also have access rules that determine who has access and what to what level.
This can be useful in allowing lists of items to be shared across accounts or customer segments rather than just limiting them to a single customer.
See ItemListSecurityService for further information.
Service responsible for managing actions against ItemListItems
.
ItemListItems
contain a SKU reference, quantity, basic attributes, and any relevant attribute choice values such as for the color and size of a t-shirt that a customer configured.
Service that manages the security and access-control of ItemLists
.
ItemLists
can also have access rules that determine who has access and what to what level.
This can be useful in allowing lists of items to be shared across accounts or domains rather than just limiting them to a single customer.
DefaultItemListAccessRuleType
defines the default values for how a list can be accessed:
EMAIL_ADDRESS
: A list can be accessed by a customer with a particular email address.
EMAIL_ADDRESS_DOMAIN
: A list can be accessed by customers sharing a particular email domain like @broadleafcommerce.com
.
ACCOUNT_REF
: A list can be accessed by customers associated with a specific business Account
by ID.
CUSTOMER_REF
: A list can be accessed by a specific customer by ID.
DefaultItemListAccessRuleRole
defines the default values for the level of access given to the targeted user(s).
OWNER
: Defines the targeted user as the owner with full access to share and delete the list as well as manage all of its contents.
Includes all capabilities of EDIT
.
EDIT
: Defines the targeted user as having access to add, update, and remove items.
Incldues all capabilities of VIEW
.
VIEW
: Defines the targeted user as having access only to view items or copy them from the list into another.
There are also several configuration properties related to this service:
broadleaf.cartoperation.service.itemListSecurity.allowedViewRoles
: Defines the roles with access to view a list
Default value is VIEW,EDIT,OWNER
broadleaf.cartoperation.service.itemListSecurity.allowedEditRoles
: Defines the roles with access to edit a list and its contents
Default value is EDIT,OWNER
broadleaf.cartoperation.service.itemListSecurity.allowedDeleteRoles
: Defines the roles with access to delete the list
Default value is OWNER
broadleaf.cartoperation.service.itemListSecurity.allowedShareRoles
: Defines the roles with access to share the list with other users
Default value is OWNER
Service responsible for merging similar ItemListItems
on adds and updates.
This provides for configuring different merging types in cases such as adding the same item to the ItemList
multiple times.
The default types are:
COMBINE
: Items with the same configurations are combined into one line item.
Basically, this means the quantity of an existing item is incremented if the same item is added again.
SEPARATE
: Each add request results in a new line item even if the same item is already in the list.
REJECT_OR_IGNORE
: The same item cannot be added to the list more than once.
By default for single item add requests, this merging type will result in an RejectedItemMergeException
if the same item is already in the list.
The caller can handle as desired.
For bulk add requests, no exception is thrown, the item is simply ignored.
To change the default behavior, override DefaultItemListItemMergingService#handleRejectedMerges
Use broadleaf.cartoperation.service.mergingType
to set the global behavior.
This can be overridden for specific products with Product#mergingType
, which takes the same values.
It could be useful to have the global merging type be COMBINE
because that works for most products in a catalog but to also override it for specific products such as those that are very large or require special fulfillment considerations.
Service that handles converting the contents of one or more ItemLists
into CartItems
and adding them to a cart.
The response of these add requests contains the cart that was added to, the IDs of lists that the user did not have access to, and a list of the IDs of items that could not be added mapped to their parent list’s ID.
Tip
|
For adding individual ItemListItems , use the same APIs as for normal add-to-cart requests such as CartOperationService#addItemToCart for a single item or CartOperationService#addManyItemsToCart for multiple items at once.
|