ccrz.ccLogicCartInitItemGroups.initItemGroups
Determines whether the cart already contains at least shipping group, and assigns cart
items to the group. When no shipping group exists, this method creates a single default group
with all cart items and the account's default shipping address. This method also wraps the DML
update statement for assigning cart items.
Compatibility
This reference applies to:
Release | Managed Package Version | API Version |
---|---|---|
B2B Commerce for Visualforce Winter ’21 | 4.13 | 12 |
B2B Commerce for Visualforce Spring ’20 | 4.12 | 11 |
B2B Commerce for Visualforce Summer ’19 | 4.11 | 10 |
B2B Commerce for Visualforce Spring ’19 | 4.10 | 9 |
B2B Commerce for Visualforce Summer ’18 | 4.9 | 8 |
Signature
global virtual Map<String, Object> initItemGroups(Map<String, Object>)
Inputs (Required)
This method accepts the Map<String, Object> from the ccrz.ccLogicCartInitItemGroups.processInput method.
This method can accept either of the following parameters:
- ccrz.ccApiCart.CART_ID
- The Salesforce ID of the cart to initialize shipping groups for.
- ccrz.ccApiCart.CART_ENCID
- The encrypted ID of the cart to initialize shipping groups for.
Inputs (Optional)
If the working map includes the following key, this method evaluates it:
- ccrz.ccApi.SIZING
-
Map<String, Object> that specifies options for how the method returns data. For this method to
execute, this key must include ccrz.ccApi.SZ_REFETCH =>
true:
ccrz.ccApi.SIZING => new Map<String, Object> { ccrz.ccApiStoredPayment.ENTITYNAME => new Map<String, Object> { ccrz.ccApi.SZ_REFETCH => true } }
Logic Performed
This method completes the following actions:
- Calls the ccrz.ccApiCart.fetch method and returns the specified cart.
- If at least one shipping group exists on the cart, this method assigns any unassigned cart items to that group.
- If no shipping group exists on the cart, this method completes the following actions:
- Creates a single default shipping group for the cart.
- Sets the group's shipping address to the account's default shipping address.
- Adds all the cart items to the group.
- Executes the DML update operation for assigning cart items to the group.
- Sets the value of the cart's ccrz__ShipStructure__c field to LLI.
Outputs
This method returns the working Map<String, Object>, and sets the following key:
- ccrz.ccApi.SUCCESS
- Boolean
Value Usage true The call completed. false The call encountered errors. - ccrz.ccApiCart.CART_ENCID
- The encrypted ID of the updated cart.
- ccrz.ccApiCart.CART_OBJLIST
- List<Map<String, Object>>, where the Map<String, Object> represents the updated ccrz__E_Cart__c record.