CCD-102 practice question 25 of 30

A Digital Developer added a file named MyBusinessController.js in the cartridge named app_project. The project design calls for this new file to…

Full set: 206 questions
A Digital Developer added a file named MyBusinessController.js in the cartridge named app_project. The project design calls for this new file to override MyBusinessController.js in client_project. The client_project cartridge contains other necessary functionality. Additional functionality is also included in the storefront_core and storefront_controllers cartridges. Which cartridge path meets the project requirements?
Answer options
A: client_project:app_project:storefront_controllers:storefront_core
B: app_project:storefront_controllers:storefront_core
C: app_project:client_project:storefront_controllers:storefront_core Correct answer
D: storefront_core:storefront_controllers:client_project:app_project
Correct Answer:
C. app_project:client_project:storefront_controllers:storefront_core
Explanation

In Salesforce B2C Commerce, the cartridge path dictates the order in which the platform searches for files like controllers, templates, and scripts. The search proceeds from left to right, and the first instance of a file found is the one that is executed. To override the MyBusinessController.js located in the clientproject cartridge, the appproject cartridge containing the new version must be listed before clientproject in the path. Option C correctly establishes this order (appproject:clientproject:...), ensuring the override occurs while still including clientproject for its other necessary functionality and the base cartridges for core features.

References

1. Salesforce B2C Commerce Infocenter, "Cartridges": "The order of the cartridges in the path is important. B2C Commerce searches for code and other resources in the cartridges from left to right. The first resource it finds is the one it uses... To override a resource, you place a cartridge with the new version of the resource before the cartridge with the old version." (This principle is detailed in the "Cartridge Path" section of the documentation).

2. Salesforce B2C Commerce Infocenter, "Implement a Cartridge Path": "To customize your storefront, you create a new cartridge and place it at the beginning of the cartridge path. This new cartridge can override the default functionality of the base cartridges." This document reinforces the concept that customization and overriding are achieved by placing custom cartridges at the beginning of the path.

Scroll to Top