Skip to Content

Overrides

Override a controller, script, template or resource file in another cartridge and jump between every copy of a file

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

The Override dialog lists the linked cartridges in the order of the selected site's cartridge path, with the ones off it last. Hover a cell for its position and what Override does there, set the columns and the order from the gear, pick how the new file starts, then list every copy with Show Overrides

Override a file

The Override dialog lists the linked cartridges in the order of the selected site's cartridge path, with the ones off it last. Hover a cell for its position and what Override does there, set the columns and the order from the gear, pick how the new file starts, then list every copy with Show Overrides

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

PartShows
Totals7 cartridges · 4 on the AcmeUS path · 3 off it · 1 has a copy
Filter 7 cartridgesNarrows the grid by name, with the match highlighted
CellThe 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
TooltipPosition 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
LegendWhat the numbers, icons and tags mean, under the grid
Line under the legendWhat Override does in the picked cell, such as Creates app_acme_us/cartridge/controllers/Product.js or Opens the copy in app_acme_ca
TagMeans
CurrentThe cartridge has the file you're overriding
OverridesThe 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
OverriddenThe cartridge has a copy already, after the file on the path, so the site uses the file. Override opens the copy
Has a copyThe 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 3With several files, how many of them it has
3 sites, No siteThe 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:

GroupOptions
ColumnsFit to Width, or 1 Column to 4 Columns
OrderCartridge Path or Name
ShowCartridges 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

OptionShown forThe new file
Empty fileAny fileAn empty file, the default
Extend controller: server.extend(module.superModule)ControllersA controller that extends the original, ready for server.append, server.prepend or server.replace
Extend script: var base = module.superModuleOther JavaScript and Digital Script filesA script that starts from the original module and exports it
Copy file contentAny fileA full copy of the original
Extend controller
'use strict';

var server = require('server');
server.extend(module.superModule);

module.exports = server.exports();
Extend script
'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 Override dialog lists the linked cartridges in the order of the selected site's cartridge path, with the ones off it last. Hover a cell for its position and what Override does there, set the columns and the order from the gear, pick how the new file starts, then list every copy with Show Overrides
  • 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
FileMatched by
ISML templateThe same path below the locale folder, for example product/productDetails.isml
JavaScript or JSON fileThe same path below cartridge/, for example controllers/Product.js or scripts/helpers/productHelpers.js
Form definitionThe 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

SymptomWhat to do
Override ... in Another Cartridge is missingEvery 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 gridOnly linked cartridges are listed. Link it in Cartridges & Modules, or turn on Cartridges Not on the Path in the gear
Show Overrides is missingThe file exists in only one linked cartridge, it is a client-side source, or indexing is still running
The storefront still runs the originalPut the cartridge with the override to the left of the original in the site's cartridge path, and upload the new file

On this page