Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.

ccrz.cc_hk_UserInterface.resourcePath

Returns the relative URL path from the storefront to a JavaScript or CSS file included in a static resource that the managed package installs. Other methods of the ccrz.cc_hk_UserInterface class reference this path when constructing <script> or <link> elements for inclusion in each page's <head>.

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

This method returns a value for either a Bootstrap 3- or Bootstrap 2.3.2-enabled storefront, where the Template Version storefront configuration setting is either boot3 or classic. We recommend that new solutions always use boot3.

Note

Signature

global static String resourcePath(String, String)

Inputs

resourceName
String that specifies the name of a static resource that contains JavaScript or CSS files, such as the CC_JavaScript_Framework or CCRZ_JS static resources that the managed package installs.
elementPath
String that specifies the path to a specific file within the resourceName.

This string can't begin with a forward slash character (/).

Note

Outputs

String that specifies the relative path from the storefront to a file in the specified static resource, prefixed with the appropriate namespace, such as ccrz.

Example

The CCRZ_JS static resource that the managed package installs includes several files, such as bootstrap.css and jquery.js. To construct paths to these files, other methods of the ccrz.cc_hk_UserInterface class invoke the resourcePath method:

resourcePath(CCRZ_JS, 'v004/boot3/css/bootstrap.css')
resourcePath(CCRZ_JS, 'v004/boot3/jquery-3.5.1.js')

In a <link> or <script> element, these values output as:

/DefaultStore/resource/1590503075000/ccrz__CCRZ_JS/v004/boot3/css/bootstrap.css
/DefaultStore/resource/1590503075000/ccrz__CCRZ_JS/v004/boot3/jquery-3.5.1.js