Asset types
An asset type labels a family of files (product packshots, marketing visuals, documents) and carries defaults that the client applies whenever a set of files shares that type: grid or list view, which columns the list shows, whether the type is searched by default, and whether its files can be linked to products.
Fields of an asset type
Section titled “Fields of an asset type”The /admin/asset-types screen (admin only) lists Name, Description, Related products and Include in search by default. The Create Asset Type / Edit Asset Type dialog exposes:
| Label | Column | Rule |
|---|---|---|
Name * |
name |
1 to 30 characters |
Description |
description |
Up to 255 characters |
Related to products |
is_related_to_products |
Boolean, default false |
Search by default |
include_in_search_by_default |
Boolean, default false |
Default Display |
default_display |
grid or list, default grid |
PIM attributes displayed in List view |
list_display_items |
Ordered array of column ids |
The list-view items you can add are size, license, format, dimensions, updated_at, plus every product attribute flagged as viewable (see Products and PIM). Drag to reorder them; the order is the column order.
assetType.list is available to every approved user because the client needs the types to render collections and the search bar; create, update and remove are admin only. Removing a type sets asset_type_id to null on every folder and file that used it.
Assign a type to a folder
Section titled “Assign a type to a folder”Types are assigned from the Assets tree. Open a folder at /admin/assets/:id, choose a value in the Asset Type select (or No asset type) and press Save. asset.update writes asset_type_id to the folder, every descendant folder and every file in them, in one transaction.
The asset updater preserves this on each sync (server/src/services/asset.ts):
upsertFoldercopies the parent’sasset_type_idto a folder that is new or that changed parent. An existing folder that stays in place keeps its own value.upsertFilesetsasset_type_idto the folder’s value on every upsert, so a file always mirrors its folder.
A type is therefore effectively a property of a subtree, and the way to type a single file is to put it in its own folder.
Effect on search
Section titled “Effect on search”Two places read the flags:
- Default search state.
MainSearchBar.vuebuilds the initialassetTypesfilter from the types whereincludeInSearchByDefaultis true. Users can change the selection, and the client remembers their options in local storage. - Server filter.
collection.searchinserver/src/trpc/router/collection.tsaddsasset_file.asset_type_id IN (...)when the request carries asset type ids. When the request also filters by product views, it addsasset_type.is_related_to_products IS TRUE, so only files of product-related types match a product view filter.
Product views themselves come from the file name matching PRODUCT_MATCHING_REGEX; see Products and PIM.
Effect on display
Section titled “Effect on display”CollectionRenderFiles.vue decides how to render a list of files:
- If a forced view is passed, use it.
- If the files have no type, or do not all share the same type, use the user’s preference stored under the key
asset_file, defaulting togrid. - Otherwise use the user’s preference for that type id, defaulting to the type’s
defaultDisplay.
Users set their preferences per type in the member dialog (DialogMemberDisplay.vue), where each type appears with its name and description, plus an entry named Other Files without a type. The defaults shown there are each type’s defaultDisplay.
In list view, CollectionDisplayListFiles.vue resolves a “global” type only when every file has the same assetTypeId, then builds the columns as name, the type’s listDisplayItems in order, and actions. Mixed lists show only the name and actions columns.
Page blocks of type files use the shared type’s name as their default title when the block has no title of its own; see Menu and pages.