In SFCC the same file can live in several cartridges, and the storefront uses the copy from the cartridge that comes first in the site's cartridge path. Intellij SFCC creates the override at the right path in one step and shows every copy of the file you have open
Override a file
Start from the original
Right-click the file in the Project view, an editor tab or the editor and choose Override ... in Another Cartridge . The same button is on the floating toolbar at the top of the editor
Pick the cartridge
Override Product.js shows your linked cartridges as a grid, numbered in the order of the selected site's cartridge path. The cartridge picked last time is selected, or else the first one on the path without the file or a copy, so the new copy wins. Type to filter, use Up and Down while you type, and press Enter or double-click a cell to override
Choose how to start
Pick one of Start with, see the table below. Then click Override
Edit the new file
The plugin creates the file at the same path inside the chosen cartridge, adds any missing folders and opens it. With Auto Upload on, the new file is uploaded right away
The menu label follows the selection, such as Override Controller in Another Cartridge or Override Templates in Another Cartridge. You can override several files at once: the dialog is then Override multiple files and the tags count the copies
The cartridge grid
The grid reads down each column: the cartridges on the selected site's path first, in their order, then the linked cartridges off it. Without a site, every linked cartridge is listed in the order you linked it. Change the site scope while the dialog is open and the grid follows the new site's path
| Part | Shows |
|---|---|
| Totals | 7 cartridges · 4 on the AcmeUS path · 3 off it · 1 has a copy |
| Filter 7 cartridges | Narrows the grid by name, with the match highlighted |
| Cell | The number, the icon (cartridge, B2C module, Modules folder or off the path), the name and a tag on the right. The cartridge you're overriding from is green and bold. A cartridge with a copy already is yellow |
| Tooltip | Position 2 on the AcmeUS cartridge path, or Not on the AcmeUS cartridge path with the sites that do run it, then which copy the site uses and what Override does there |
| Legend | What the numbers, icons and tags mean, under the grid |
| Line under the legend | What Override does in the picked cell, such as Creates app_acme_us/cartridge/controllers/Product.js or Opens the copy in app_acme_ca |
| Tag | Means |
|---|---|
| Current | The cartridge has the file you're overriding |
| Overrides | The cartridge has a copy already, before the file on the selected site's path, so the site uses the copy. Override opens it instead of creating one |
| Overridden | The cartridge has a copy already, after the file on the path, so the site uses the file. Override opens the copy |
| Has a copy | The cartridge has a copy already and no site is selected, or it is off the path. Override opens it instead of creating one |
| Has 2 of 3 | With several files, how many of them it has |
| 3 sites, No site | The cartridge is off the selected site's path. The tag says how many other sites run it. With a cartridge off the path picked, a 3 sites use it link lists them |
A cartridge that has every file you picked can't be the target: the dialog says The file is already in app_storefront_base: pick another cartridge
Options
The gear next to the filter sets the grid:
| Group | Options |
|---|---|
| Columns | Fit to Width, or 1 Column to 4 Columns |
| Order | Cartridge Path or Name |
| Show | Cartridges Not on the Path, Legend, Start on the Last Picked Cartridge |
The options apply to every project. All three Show options are on by default
Start with
| Option | Shown for | The new file |
|---|---|---|
| Empty file | Any file | An empty file, the default |
| Extend controller: server.extend(module.superModule) | Controllers | A controller that extends the original, ready for server.append, server.prepend or server.replace |
| Extend script: var base = module.superModule | Other JavaScript and Digital Script files | A script that starts from the original module and exports it |
| Copy file content | Any file | A full copy of the original |
'use strict';
var server = require('server');
server.extend(module.superModule);
module.exports = server.exports();'use strict';
var base = module.superModule;
module.exports = base;If the chosen cartridge already has a file at that path, the plugin opens it and doesn't overwrite it. With every file there already, Start with is off
See every copy of a file
When the file you have open exists in more than one linked cartridge, the floating toolbar shows Show Overrides for Product.js . It opens Overrides of Product.js with one entry per cartridge
- The file you have open is marked "app_acme_us - Current"
- Templates and forms add their locale folder, for example "app_storefront_base :: default"
- Hover an entry for Compare with app_storefront_base , which opens a diff of your file and that copy
- A copy in a cartridge off the selected site's path has the off-path icon and a help button. Its card says Not on the cartridge path of AcmeUS and whether other sites use the copy, or No site has this cartridge on its cartridge path, so this copy is never used. The sites button lists the sites that do, see Which sites use a cartridge
| File | Matched by |
|---|---|
| ISML template | The same path below the locale folder, for example product/productDetails.isml |
| JavaScript or JSON file | The same path below cartridge/, for example controllers/Product.js or scripts/helpers/productHelpers.js |
| Form definition | The same form ID, for example billing.xml in any forms folder |
Overrides and the cartridge path
With the cartridge path app_custom:int_paypal:app_storefront_base, a Product.js in app_custom wins over the one in app_storefront_base, and module.superModule in it points to the next copy to the right
Set a site scope so the grid, completion and navigation follow that site's order. A file in a cartridge off that path gets a banner, see Which sites use a cartridge. Module Resolution explains how */ and module.superModule are resolved
Troubleshooting
| Symptom | What to do |
|---|---|
| Override ... in Another Cartridge is missing | Every selected item must be inside a cartridge folder, the selection needs at least one file, and the project needs a linked cartridge |
| The cartridge you want is not in the grid | Only linked cartridges are listed. Link it in Cartridges & Modules, or turn on Cartridges Not on the Path in the gear |
| Show Overrides is missing | The file exists in only one linked cartridge, it is a client-side source, or indexing is still running |
| The storefront still runs the original | Put the cartridge with the override to the left of the original in the site's cartridge path, and upload the new file |