ccrz.ccApiCategory.getUrlFor
Returns a map where each entry associates a category's ID with its
friendly URL.
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 static Map<String, Object> getUrlFor(Map<String, Object>)
Service Layer Classes
- Logic Service Provider
- ccrz.ccLogicCategoryUrlFor
Inputs (Required)
Map<String, Object> that must include the following required keys:
- ccrz.ccApi.API_VERSION
- The version of the B2B Commerce for Visualforce API to reference for the method call. We recommend that you use the ccrz.ccApi.CURRENT_VERSION constant whenever possible, and only reference a specific version for compatibility if necessary.
- ccrz.ccApiCategory.CATEGORYIDLIST
- List<String> of Salesforce IDs for categories whose URLs you want to return.
Inputs (Optional)
The input map can also include the following keys:
- ccrz.ccApiCategory.CATEGORYLOCALE
- String that specifies one of your storefront's supported locales.
- ccrz.ccApiCategory.CATEGORYLOCALES
- Set<String> of your storefront's supported locales.
- ccrz.ccApiCategory.STOREFRONT
- String that specifies the name of a storefront.
Outputs
Map<String, Object> that can include the following keys:
- ccrz.ccApi.API_VERSION
- Integer that indicates which API version was used for the query.
- ccrz.ccApi.SUCCESS
- Boolean
Value Usage true The call completed. false The call encountered errors. - ccrz.ccApiCategory.CATEGORYURLMAP
- Map<String, Object> for a single locale, where each key is a category ID and each value is the category's friendly URL.
- ccrz.ccApiCategory.LOCALECATEGORYURLMAP
-
Map<String, Map<String, Object>> for
multiple locales, where:
- The outer map is keyed by category ID.
- Each inner map is keyed by locale.
- Each inner map's value is the category's friendly URL for the locale.
- ccrz.ccApiCategory.LOCALESITEINDICES
-
Map<String, Map<String, Object>> for
multiple locales, where:
- The outer map is keyed by category ID.
- Each inner map is keyed by locale.
- Each inner map's value is the category's corresponding ccrz__E_SiteIndex__c record for the locale.
- ccrz.ccApiCategory.SITEINDICES
- Map<String, Object> for a single locale, where each key is a category ID and each value is the corresponding ccrz__E_SiteIndex__c record.
Example
Return the site indexes for a pair of category IDs.
try{
// Pass category IDs to the ccrz.ccApiCategory.getUrlFor method
Map<String, Object> categoryURLsToReturn = ccrz.ccApiCategory.getUrlFor(new Map<String, Object>{
ccrz.ccApi.API_VERSION => ccrz.ccApi.CURRENT_VERSION,
ccrz.ccApiCategory.CATEGORYIDLIST => new List<String>{'Category_ID_1', 'Category_ID_2'}
});
// Get the map of site indexes from the return data
Map<String, Object> categorySiteIndices = categoryURLsToReturn.get(ccrz.ccApiCategory.SITEINDICES);
}catch(Exception e){
// Error handling
}